# Google Cloud Spanner v1 API - Class SessionPoolOptions (5.13.0-beta07)

5.13.0-beta07 5.13.0-beta06 5.12.0 (latest) 5.11.0 5.10.0 5.9.0 5.8.0 5.7.0 5.6.0 5.5.0 5.4.0 5.3.0 5.2.0 5.1.0 5.0.0 4.6.0 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.15.1 3.14.0 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0

    public sealed class SessionPoolOptions

Reference documentation and code samples for the Google Cloud Spanner v1 API class SessionPoolOptions.

Options for session pools.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> SessionPoolOptions

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Spanner.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1)

## Assembly

Google.Cloud.Spanner.V1.dll

## Constructors

### SessionPoolOptions()

    public SessionPoolOptions()

Constructs a new [SessionPoolOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.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** |
| `https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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** |
| `https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.idictionary-2https://learn.microsoft.com/dotnet/api/system.stringhttps://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SessionPoolOptions#Google_Cloud_Spanner_V1_SessionPoolOptions_MaximumActiveSessions) has been reached.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ResourcesExhaustedBehavior` |   |

**Remarks** The default value is [Block](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ResourcesExhaustedBehavior#Google_Cloud_Spanner_V1_ResourcesExhaustedBehavior_Block).