Does anyone know of a light-weight [1] but good/co...
# server
r
Does anyone know of a light-weight [1] but good/consistent [2] distributed lock / leader election Kotlin/JVM library? [1] Ideally, doesn't require a separate server or service i.e. is peer-to-peer, or that uses an easily integrated backing store / database [2] Subject to interpretation, but it should at least implement fencing tokens (https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html) I found https://github.com/coditory/sherlock-distributed-lock/issues which has the former but not the latter (though I may submit a PR if I can't find anything else). There is also HazelCast
FencedLock
(https://docs.hazelcast.com/imdg/4.2/data-structures/fencedlock) but I wouldn't call that light-weight. Same for Zookeeper / etcd and company.
j
It may be too primitive depending on your usecase, but my company uses the Redisson library on top of redis. https://github.com/redisson/redisson/wiki/8.-distributed-locks-and-synchronizers
We just have all of our servers "fight" for the lock and block until it is available.
r
AFAIK Redisson / redis locking doesn't implement fencing tokens. So its on the same "level" as the sherlock library (though far more well-known).
👍 1
Its interesting that the redis site about distributed locks talks specifically about using fencing tokens, but Redisson doesn't implement it: https://redis.io/docs/manual/patterns/distributed-locks/#disclaimer-about-consistency.
Yup, mentioned it in my post. Was hoping for something a little lighter but it's not a bad option.
l
ShedLock
is also a “popular” option… but I don’t think it supports fencing tokens. https://github.com/lukas-krecan/ShedLock
👍 1
b
you can take a look at Hazelcast and its CP Subsystem: https://docs.hazelcast.com/hazelcast/5.2/cp-subsystem/cp-subsystem
d
What does "districuted" mean? 😮
😁 1
r
Looks like Redisson just added a fenced lock implementation: https://github.com/redisson/redisson/commit/b9513bc12286b151c999a29b495ef6e4515e8470
🙌 1
116 Views