-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Server Self Preservation Mode
Eureka servers will enter self preservation mode if they detect that a larger than expected number of registered clients have terminated their connections in an ungraceful way, and are pending eviction at the same time. This is done to ensure catastrophic network events do not wipe out eureka registry data, and having this be propagated downstream to all clients.
To better understand self preservation, it help to first understand how does eureka clients 'end' their registration lifecycle. The eureka protocol requires clients to execute an explicit unregister action when they are permanently going away. For example, in the provided java client, this is done in the shutdown() method. any clients that fails 3 consecutive heartbeat renewals is considered to have an unclean termination, and will be evicted by the background eviction process. It is when > 15% of the current registry is in this later state, that self preservation will be enabled.
When in self preservation mode, eureka servers will stop eviction of all instances until either:
- the number of heartbeat renewals it sees is back above the expected threshold, or
- self preservation is disabled (see below)
Self preservation is enabled by default, and the default threshold for enabling self preservation is > 15% of the current registry size.
The self preservation config is defined here. To change self preservation threshold in the example, set the property: eureka.renewalPercentThreshold=[0.0, 1.0]
.
The self preservation config is defined here. To disable self preservation in the example, set the property: eureka.enableSelfPreservation=false
.
In a production environment, if for some reason your servers have entered self preservation due to a legitimate reason, you can force the servers to be out of self preservation mode by temporarily disabling self preservation via config. We would expect that in these cases, a human operation is evaluating the situation and taking the appropriate actions.
- Eureka at a glance
- Configuring Eureka
- Building Eureka Client and Server
- Running the Demo Application
- Deploying-Eureka-Servers-in-EC2
- Understanding Eureka Client/Server Communication
- Server Self Preservation Mode
- Eureka REST operations
- Understanding Eureka Peer to Peer communication
- Overriding Default Configurations
- FAQ