str
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
enable_strong_affinity
bool
Enable Strong Session Affinity for external
passthrough Network Load Balancers. This option
is not available publicly.
This field is a member of oneof_ _enable_strong_affinity.
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.
This field is a member of oneof_ _idle_timeout_sec.
tracking_mode
str
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
Classes
ConnectionPersistenceOnUnhealthyBackends
ConnectionPersistenceOnUnhealthyBackends(value)
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 <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>.
TrackingMode
TrackingMode(value)
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>.
[[["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-11 UTC."],[],[],null,["# Class BackendServiceConnectionTrackingPolicy (1.35.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.35.0 (latest)](/python/docs/reference/compute/latest/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.34.0](/python/docs/reference/compute/1.34.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.33.0](/python/docs/reference/compute/1.33.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.32.0](/python/docs/reference/compute/1.32.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.31.0](/python/docs/reference/compute/1.31.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.30.0](/python/docs/reference/compute/1.30.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.29.0](/python/docs/reference/compute/1.29.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.28.0](/python/docs/reference/compute/1.28.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.27.0](/python/docs/reference/compute/1.27.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.26.0](/python/docs/reference/compute/1.26.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.25.0](/python/docs/reference/compute/1.25.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.24.0](/python/docs/reference/compute/1.24.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.23.0](/python/docs/reference/compute/1.23.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.22.0](/python/docs/reference/compute/1.22.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.21.0](/python/docs/reference/compute/1.21.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.20.1](/python/docs/reference/compute/1.20.1/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.19.2](/python/docs/reference/compute/1.19.2/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.18.0](/python/docs/reference/compute/1.18.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.17.0](/python/docs/reference/compute/1.17.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.16.1](/python/docs/reference/compute/1.16.1/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.15.0](/python/docs/reference/compute/1.15.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.14.1](/python/docs/reference/compute/1.14.1/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.13.0](/python/docs/reference/compute/1.13.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.12.1](/python/docs/reference/compute/1.12.1/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.11.0](/python/docs/reference/compute/1.11.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.10.1](/python/docs/reference/compute/1.10.1/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.9.0](/python/docs/reference/compute/1.9.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.8.0](/python/docs/reference/compute/1.8.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.7.0](/python/docs/reference/compute/1.7.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.6.1](/python/docs/reference/compute/1.6.1/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.5.2](/python/docs/reference/compute/1.5.2/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.4.0](/python/docs/reference/compute/1.4.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.3.2](/python/docs/reference/compute/1.3.2/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.2.0](/python/docs/reference/compute/1.2.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.1.0](/python/docs/reference/compute/1.1.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [1.0.0](/python/docs/reference/compute/1.0.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [0.9.0](/python/docs/reference/compute/0.9.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [0.8.0](/python/docs/reference/compute/0.8.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [0.7.0](/python/docs/reference/compute/0.7.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [0.6.0](/python/docs/reference/compute/0.6.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [0.5.0](/python/docs/reference/compute/0.5.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [0.4.2](/python/docs/reference/compute/0.4.2/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [0.3.0](/python/docs/reference/compute/0.3.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [0.2.1](/python/docs/reference/compute/0.2.1/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy)\n- [0.1.0](/python/docs/reference/compute/0.1.0/google.cloud.compute_v1.types.BackendServiceConnectionTrackingPolicy) \n\n BackendServiceConnectionTrackingPolicy(\n mapping=None, *, ignore_unknown_fields=False, **kwargs\n )\n\nConnection Tracking configuration for this BackendService.\n\n.. _oneof: \u003chttps://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields\u003e\n\nClasses\n-------\n\n### ConnectionPersistenceOnUnhealthyBackends\n\n ConnectionPersistenceOnUnhealthyBackends(value)\n\nSpecifies connection persistence when backends are unhealthy. The\ndefault value is DEFAULT_FOR_PROTOCOL. If set to\nDEFAULT_FOR_PROTOCOL, the existing connections persist on unhealthy\nbackends only for connection-oriented protocols (TCP and SCTP) and\nonly if the Tracking Mode is PER_CONNECTION (default tracking mode)\nor the Session Affinity is configured for 5-tuple. They do not\npersist for UDP. If set to NEVER_PERSIST, after a backend becomes\nunhealthy, the existing connections on the unhealthy backend are\nnever persisted on the unhealthy backend. They are always diverted\nto newly selected healthy backends (unless all backends are\nunhealthy). If set to ALWAYS_PERSIST, existing connections always\npersist on unhealthy backends regardless of protocol and session\naffinity. It is generally not recommended to use this mode\noverriding the default. For more details, see `Connection\nPersistence for Network Load\nBalancing \u003chttps://cloud.google.com/load-balancing/docs/network/networklb-backend-service#connection-persistence\u003e`**and `Connection Persistence for Internal TCP/UDP Load\nBalancing \u003chttps://cloud.google.com/load-balancing/docs/internal#connection-persistence\u003e`**.\n\n### TrackingMode\n\n TrackingMode(value)\n\nSpecifies the key used for connection tracking. There are two\noptions: - PER_CONNECTION: This is the default mode. The Connection\nTracking is performed as per the Connection Key (default Hash\nMethod) for the specific protocol. - PER_SESSION: The Connection\nTracking is performed as per the configured Session Affinity. It\nmatches the configured Session Affinity. For more details, see\n`Tracking Mode for Network Load\nBalancing \u003chttps://cloud.google.com/load-balancing/docs/network/networklb-backend-service#tracking-mode\u003e`**and `Tracking Mode for Internal TCP/UDP Load\nBalancing \u003chttps://cloud.google.com/load-balancing/docs/internal#tracking-mode\u003e`**."]]