This video shows how to implement leader election using a lease mechanism.
Пікірлер: 5
@mostinho74 жыл бұрын
Done thanks We don’t want to implement leader election ourselves due to race condition on crashes, so we use one of these mechanisms. 0:10 Lease (all instanced try to be the leader): 1:47 a new task shows up in the db with a work time and status (done or not done) Each task has “leases” for the leader election
@user-eg7yz4ub6u5 жыл бұрын
I wonder what magic makes leasee attribute to disappear when service 1 crushed? In my experience some timeout attributes usually are used for other services to understand that the lease is expired
@JeffreyRichter5 жыл бұрын
Yes, the lease expires due to timeout
@TheHellst0rm4 жыл бұрын
i wonder how does the work item appear in the database? Who puts it there? Doesnt it cause the same problem with leadership again?
@JeffreyRichter4 жыл бұрын
Usually a customer initiates some workflow which sends a request to a service which passes through a load balancer in order to select 1 server which then goes and adds an entry to a database. So, in this scenario, the load balancer effectively performs the leader election.