Reference documentation and code samples for the Compute V1 Client class BackendServiceConnectionTrackingPolicy.
Connection Tracking configuration for this BackendService.
Generated from protobuf message google.cloud.compute.v1.BackendServiceConnectionTrackingPolicy
Namespace
Google \ Cloud \ Compute \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ connection_persistence_on_unhealthy_backends
string
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 is PER_CONNECTION (default tracking mode) or the Session Affinity is configured for 5-tuple. They do not persist for UDP. 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 and Connection Persistence for Internal TCP/UDP Load Balancing. Check the ConnectionPersistenceOnUnhealthyBackends enum for the list of possible values.
↳ enable_strong_affinity
bool
Enable Strong Session Affinity for external passthrough Network Load Balancers. This option is not available publicly.
↳ idle_timeout_sec
int
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.
↳ tracking_mode
string
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 and Tracking Mode for Internal TCP/UDP Load Balancing. Check the TrackingMode enum for the list of possible values.
getConnectionPersistenceOnUnhealthyBackends
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 is PER_CONNECTION (default tracking mode) or the Session Affinity is configured for 5-tuple. They do not persist for UDP. 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 and Connection Persistence for Internal TCP/UDP Load Balancing.
Check the ConnectionPersistenceOnUnhealthyBackends enum for the list of possible values.
Returns
Type
Description
string
hasConnectionPersistenceOnUnhealthyBackends
clearConnectionPersistenceOnUnhealthyBackends
setConnectionPersistenceOnUnhealthyBackends
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 is PER_CONNECTION (default tracking mode) or the Session Affinity is configured for 5-tuple. They do not persist for UDP. 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 and Connection Persistence for Internal TCP/UDP Load Balancing.
Check the ConnectionPersistenceOnUnhealthyBackends enum for the list of possible values.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getEnableStrongAffinity
Enable Strong Session Affinity for external passthrough Network Load Balancers. This option is not available publicly.
Returns
Type
Description
bool
hasEnableStrongAffinity
clearEnableStrongAffinity
setEnableStrongAffinity
Enable Strong Session Affinity for external passthrough Network Load Balancers. This option is not available publicly.
Parameter
Name
Description
var
bool
Returns
Type
Description
$this
getIdleTimeoutSec
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.
Returns
Type
Description
int
hasIdleTimeoutSec
clearIdleTimeoutSec
setIdleTimeoutSec
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.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getTrackingMode
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 and Tracking Mode for Internal TCP/UDP Load Balancing.
Check the TrackingMode enum for the list of possible values.
Returns
Type
Description
string
hasTrackingMode
clearTrackingMode
setTrackingMode
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 and Tracking Mode for Internal TCP/UDP Load Balancing.
Check the TrackingMode enum for the list of possible values.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Compute V1 Client - Class BackendServiceConnectionTrackingPolicy (1.35.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.35.0 (latest)](/php/docs/reference/cloud-compute/latest/V1.BackendServiceConnectionTrackingPolicy)\n- [1.34.0](/php/docs/reference/cloud-compute/1.34.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.33.0](/php/docs/reference/cloud-compute/1.33.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.32.0](/php/docs/reference/cloud-compute/1.32.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.31.0](/php/docs/reference/cloud-compute/1.31.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.30.0](/php/docs/reference/cloud-compute/1.30.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.29.0](/php/docs/reference/cloud-compute/1.29.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.28.0](/php/docs/reference/cloud-compute/1.28.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.27.0](/php/docs/reference/cloud-compute/1.27.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.26.0](/php/docs/reference/cloud-compute/1.26.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.25.0](/php/docs/reference/cloud-compute/1.25.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.24.0](/php/docs/reference/cloud-compute/1.24.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.23.0](/php/docs/reference/cloud-compute/1.23.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.22.1](/php/docs/reference/cloud-compute/1.22.1/V1.BackendServiceConnectionTrackingPolicy)\n- [1.21.0](/php/docs/reference/cloud-compute/1.21.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.20.0](/php/docs/reference/cloud-compute/1.20.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.19.0](/php/docs/reference/cloud-compute/1.19.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.18.1](/php/docs/reference/cloud-compute/1.18.1/V1.BackendServiceConnectionTrackingPolicy)\n- [1.17.0](/php/docs/reference/cloud-compute/1.17.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.16.2](/php/docs/reference/cloud-compute/1.16.2/V1.BackendServiceConnectionTrackingPolicy)\n- [1.14.0](/php/docs/reference/cloud-compute/1.14.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.13.0](/php/docs/reference/cloud-compute/1.13.0/V1.BackendServiceConnectionTrackingPolicy)\n- [1.12.1](/php/docs/reference/cloud-compute/1.12.1/V1.BackendServiceConnectionTrackingPolicy)\n- [1.11.1](/php/docs/reference/cloud-compute/1.11.1/V1.BackendServiceConnectionTrackingPolicy)\n- [1.10.1](/php/docs/reference/cloud-compute/1.10.1/V1.BackendServiceConnectionTrackingPolicy)\n- [1.9.1](/php/docs/reference/cloud-compute/1.9.1/V1.BackendServiceConnectionTrackingPolicy)\n- [1.8.3](/php/docs/reference/cloud-compute/1.8.3/V1.BackendServiceConnectionTrackingPolicy)\n- [1.7.1](/php/docs/reference/cloud-compute/1.7.1/V1.BackendServiceConnectionTrackingPolicy)\n- [1.6.1](/php/docs/reference/cloud-compute/1.6.1/V1.BackendServiceConnectionTrackingPolicy)\n- [1.5.0](/php/docs/reference/cloud-compute/1.5.0/V1.BackendServiceConnectionTrackingPolicy) \nReference documentation and code samples for the Compute V1 Client class BackendServiceConnectionTrackingPolicy.\n\nConnection Tracking configuration for this BackendService.\n\nGenerated from protobuf message `google.cloud.compute.v1.BackendServiceConnectionTrackingPolicy`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Compute \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getConnectionPersistenceOnUnhealthyBackends\n\nSpecifies 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 is PER_CONNECTION (default tracking mode) or the Session Affinity is configured for 5-tuple. They do not persist for UDP. 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).\n\nCheck the ConnectionPersistenceOnUnhealthyBackends enum for the list of possible values.\n\n### hasConnectionPersistenceOnUnhealthyBackends\n\n### clearConnectionPersistenceOnUnhealthyBackends\n\n### setConnectionPersistenceOnUnhealthyBackends\n\nSpecifies 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 is PER_CONNECTION (default tracking mode) or the Session Affinity is configured for 5-tuple. They do not persist for UDP. 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).\n\nCheck the ConnectionPersistenceOnUnhealthyBackends enum for the list of possible values.\n\n### getEnableStrongAffinity\n\nEnable Strong Session Affinity for external passthrough Network Load Balancers. This option is not available publicly.\n\n### hasEnableStrongAffinity\n\n### clearEnableStrongAffinity\n\n### setEnableStrongAffinity\n\nEnable Strong Session Affinity for external passthrough Network Load Balancers. This option is not available publicly.\n\n### getIdleTimeoutSec\n\nSpecifies 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.\n\n### hasIdleTimeoutSec\n\n### clearIdleTimeoutSec\n\n### setIdleTimeoutSec\n\nSpecifies 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.\n\n### getTrackingMode\n\nSpecifies 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).\n\nCheck the TrackingMode enum for the list of possible values.\n\n### hasTrackingMode\n\n### clearTrackingMode\n\n### setTrackingMode\n\nSpecifies 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).\n\nCheck the TrackingMode enum for the list of possible values."]]