Class SessionPoolOptions (3.10.0)

public sealed class SessionPoolOptions

Options for session pools.

Inheritance

Object > SessionPoolOptions

Namespace

Google.Cloud.Spanner.V1

Assembly

Google.Cloud.Spanner.V1.dll

Constructors

SessionPoolOptions()

public SessionPoolOptions()

Constructs a new SessionPoolOptions with default values.

Properties

CreateSessionMaximumBatchSize

public int CreateSessionMaximumBatchSize { get; set; }

The maximum number of sessions that will be created in a batch. Sessions created are associated to the gRPC channel they are created on, so all sessions created in a batch are associated to the same gRPC channel. Batch size should be limited so as not to overload a given channel. If the sessions needing to be created at any given time are more than this value then multiple batches of this size or less will be created.

Property Value
TypeDescription
Int32
Remarks

This value must be positive. The default value is 5.

IdleSessionRefreshDelay

public TimeSpan IdleSessionRefreshDelay { get; set; }

The amount of time a session must be idle before it is refreshed.

Property Value
TypeDescription
TimeSpan
Remarks

This property must always be positive. The default value is 15 minutes.

The exact value used is subject to "jitter" to avoid a lot of sessions being refreshed at the exact same time.

A lower value will cause sessions to be refreshed more often, slightly reducing the risk of sessions expiring while being used, at the cost of performing more refreshes.

This value must be less than the expire timer on the Spanner server which is currently set at 60 minutes.

MaximumActiveSessions

public int MaximumActiveSessions { get; set; }

Maximum number of sessions that can be active per database. An active session is one that has been acquired but not yet released back to the pool.

Property Value
TypeDescription
Int32
Remarks

This property has a minimum value of 1, and a default value of 400.

MaximumConcurrentSessionCreates

public int MaximumConcurrentSessionCreates { get; set; }

The maximum number of sessions that will be created concurrently per session pool. Spanner has limits on the number of sessions that can be created concurrently without affecting performance. This value is not typically changed.

Property Value
TypeDescription
Int32

MinimumPooledSessions

public int MinimumPooledSessions { get; set; }

The minimum number of sessions to maintain in the pool of available sessions. If the number of pooled sessions falls below this number, more sessions are added automatically.

Property Value
TypeDescription
Int32
Remarks

This property has a minimum value of 0, and a default value of 100.

PoolEvictionDelay

public TimeSpan PoolEvictionDelay { get; set; }

The amount of time before sessions are forcibly evicted from the pool. This is usually in the order of days, as sessions can be reused for a long time if they're suitably refreshed. Deleting long-lasting sessions can help with server-side resource management.

Property Value
TypeDescription
TimeSpan
Remarks

This property must always be positive. The default value is 7 days.

The exact value used is subject to "jitter" to avoid a lot of sessions being evicted at the exact same time.

A lower value will cause sessions to be evicted more often, delaying operations if no sessions are available when requested.

SessionLabels

public IDictionary<string, string> SessionLabels { get; }

Labels to use for any sessions created with this pool.

Property Value
TypeDescription
IDictionary<String, String>

Timeout

public TimeSpan Timeout { get; set; }

The total time allowed for a network call to the Cloud Spanner server, including retries. This setting is applied to calls to create, refresh and delete sessions, as well as beginning transactions.

Property Value
TypeDescription
TimeSpan
Remarks

This value must be positive. The default value is one minute.

WaitOnResourcesExhausted

public ResourcesExhaustedBehavior WaitOnResourcesExhausted { get; set; }

Determines the behavior of a request for a session when MaximumActiveSessions has been reached.

Property Value
TypeDescription
ResourcesExhaustedBehavior
Remarks

The default value is Block.

WriteSessionsFraction

public double WriteSessionsFraction { get; set; }

Fraction of sessions to be kept prepared for write transactions.

Property Value
TypeDescription
Double
Remarks

This is an optimisation to avoid the cost of sending a BeginTransaction() rpc. If all such sessions are in use and a write request comes, we will make the BeginTransaction() rpc inline.

This property must always be in the range 0-1 (inclusive). The default value is 0.2.