# Compute Engine v1 API - Class BackendServiceConnectionTrackingPolicy (3.28.0)

3.28.0 (latest) 3.27.0 3.26.0 3.25.0 3.24.0 3.23.0 3.22.0 3.21.0 3.20.0 3.19.0 3.18.0 3.17.0 3.16.0 3.15.0 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 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.17.0 2.16.0 2.15.0 2.14.0 2.13.0 2.12.0 2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.4.0 1.3.0 1.2.0 1.1.0 1.0.0

    public sealed class BackendServiceConnectionTrackingPolicy : IMessage<BackendServiceConnectionTrackingPolicy>, IEquatable<BackendServiceConnectionTrackingPolicy>, IDeepCloneable<BackendServiceConnectionTrackingPolicy>, IBufferMessage, IMessage

Reference documentation and code samples for the Compute Engine v1 API class BackendServiceConnectionTrackingPolicy.

Connection Tracking configuration for this BackendService.

## Inheritance

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

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[BackendServiceConnectionTrackingPolicy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.BackendServiceConnectionTrackingPolicy), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[BackendServiceConnectionTrackingPolicy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.BackendServiceConnectionTrackingPolicy), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[BackendServiceConnectionTrackingPolicy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.BackendServiceConnectionTrackingPolicy), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## 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.Compute.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1)

## Assembly

Google.Cloud.Compute.V1.dll

## Constructors

### BackendServiceConnectionTrackingPolicy()

    public BackendServiceConnectionTrackingPolicy()

### BackendServiceConnectionTrackingPolicy(BackendServiceConnectionTrackingPolicy)

    public BackendServiceConnectionTrackingPolicy(BackendServiceConnectionTrackingPolicy other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.BackendServiceConnectionTrackingPolicy` |

## Properties

### ConnectionPersistenceOnUnhealthyBackends

    public string ConnectionPersistenceOnUnhealthyBackends { get; set; }

Specifies connection persistence when backends are unhealthy. The default
value is DEFAULT_FOR_PROTOCOL.

If set to DEFAULT_FOR_PROTOCOL, the existing connections
persist on unhealthy backends only for connection-oriented protocols
(TCP and SCTP) and only if the Tracking Mode isPER_CONNECTION (default tracking mode) or the Session
Affinity is configured for 5-tuple. They do not persist forUDP.

If set to NEVER_PERSIST, after a backend becomes unhealthy,
the existing connections on the unhealthy backend are never persisted on
the unhealthy backend. They are always diverted to newly selected healthy
backends (unless all backends are unhealthy).

If set to ALWAYS_PERSIST, existing connections always
persist on unhealthy backends regardless of protocol and session
affinity. It is generally not recommended to use this mode overriding the
default.

For more details, see [Connection Persistence for Network Load
Balancing](https://cloud.google.com/load-balancing/docs/network/networklb-backend-service#connection-persistence)
and [Connection Persistence for Internal TCP/UDP Load
Balancing](https://cloud.google.com/load-balancing/docs/internal#connection-persistence).
Check the ConnectionPersistenceOnUnhealthyBackends enum for the list of possible values.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### EnableStrongAffinity

    public bool EnableStrongAffinity { get; set; }

Enable Strong Session Affinity for external passthrough Network Load
Balancers. This option is not available publicly.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### HasConnectionPersistenceOnUnhealthyBackends

    public bool HasConnectionPersistenceOnUnhealthyBackends { get; }

Gets whether the "connection_persistence_on_unhealthy_backends" field is set

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### HasEnableStrongAffinity

    public bool HasEnableStrongAffinity { get; }

Gets whether the "enable_strong_affinity" field is set

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### HasIdleTimeoutSec

    public bool HasIdleTimeoutSec { get; }

Gets whether the "idle_timeout_sec" field is set

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### HasTrackingMode

    public bool HasTrackingMode { get; }

Gets whether the "tracking_mode" field is set

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### IdleTimeoutSec

    public int IdleTimeoutSec { get; set; }

Specifies how long to keep a Connection Tracking entry while there is no
matching traffic (in seconds).

For internal passthrough Network Load Balancers:

- The minimum (default) is 10 minutes and the maximum is 16 hours.
- It can be set only if Connection Tracking is less than 5-tuple (i.e. Session Affinity is CLIENT_IP_NO_DESTINATION,CLIENT_IP or CLIENT_IP_PROTO, and Tracking Mode is PER_SESSION).

For external passthrough Network Load Balancers the default is 60
seconds. This option is not available publicly.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### TrackingMode

    public string TrackingMode { get; set; }

Specifies the key used for connection tracking. There are two
options:

- PER_CONNECTION: This is the default mode. The Connection Tracking is performed as per the Connection Key (default Hash Method) for the specific protocol.
- PER_SESSION: The Connection Tracking is performed as per the configured Session Affinity. It matches the configured Session Affinity.

For more details, see [Tracking Mode for Network Load
Balancing](https://cloud.google.com/load-balancing/docs/network/networklb-backend-service#tracking-mode)
and [Tracking Mode for Internal TCP/UDP Load
Balancing](https://cloud.google.com/load-balancing/docs/internal#tracking-mode).
Check the TrackingMode enum for the list of possible values.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |