Google Cloud Spanner v1 API - Class SessionPoolOptions (5.0.0-beta05)

public sealed class SessionPoolOptions

Reference documentation and code samples for the Google Cloud Spanner v1 API 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
Type Description
int
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
Type Description
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
Type Description
int
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
Type Description
int

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
Type Description
int
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
Type Description
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
Type Description
IDictionarystringstring

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
Type Description
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
Type Description
ResourcesExhaustedBehavior
Remarks

The default value is Block.