Skip to content

Commit 00459e7

Browse files
committed
Add more links on leases and locks
1 parent ec6d1d3 commit 00459e7

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

README.rst

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,14 @@ coordinating Machine IDs in your deployment.
139139

140140
Task is not trivial, but neither is impossible. Here are a few ideas:
141141

142-
* Coordinate ID assignment via something like etcd_ or ZooKeeper_ using lease_
143-
pattern. Optimal, but a bit bothersome to implement.
142+
* Coordinate ID assignment using:
143+
144+
* Lease_ pattern (etcd_, ZooKeeper_)
145+
* Distributed locks:
146+
147+
* Redlock_ (Redis_, Valkey_)
148+
* Advisory locks (PostgreSQL_, MariaDB_, etc...)
149+
144150
* Reinvent Twitter's SnowFlake_ by having a centralized service/sidecar. Extra
145151
round-trips SonyFlake intended to avoid.
146152
* Assign Machine IDs manually. DevOps team will hate you.
@@ -174,10 +180,15 @@ should figure out on your own. Here's some numbers for you to start
174180

175181
.. [#] 1409529600 + 0x874AD4993 / 100 = 2026-03-05T09:15:19.87Z
176182
.. _UUIDv6: https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-6
177-
.. _etcd: https://etcd.io/
178-
.. _ZooKeeper: https://zookeeper.apache.org/
183+
.. _Lease: https://martinfowler.com/articles/patterns-of-distributed-systems/lease.html
184+
.. _etcd: https://etcd.io/docs/v3.6/tasks/developer/how-to-create-lease/
185+
.. _ZooKeeper: https://zookeeper.apache.org/doc/r3.9.5/recipes.html#sc_recipes_Locks
186+
.. _Redlock: https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html
187+
.. _Redis: https://redis.io/docs/latest/develop/clients/patterns/distributed-locks/
188+
.. _Valkey: https://valkey.io/topics/distlock/
189+
.. _PostgreSQL: https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS
190+
.. _MariaDB: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/get_lock
179191
.. _SnowFlake: https://en.wikipedia.org/wiki/Snowflake_ID
180-
.. _lease: https://martinfowler.com/articles/patterns-of-distributed-systems/lease.html
181192
.. _LCG: https://en.wikipedia.org/wiki/Linear_congruential_generator
182193

183194
Clock Rollback
@@ -215,7 +226,7 @@ above was that IDs lost its "monotonically increasing" property [#]_. Ofc, some
215226
of our and other team's code were dependent on this SonyFlake's feature. Duh.
216227

217228
Adding even more workarounds like pre-generate IDs, sort them and ingest was
218-
a compelling idea, but I did not feel right. Hence, this library was born.
229+
a compelling idea, but it did not feel right. Hence, this library was born.
219230

220231
.. [#] E.g. if you cycle through generators with Machine IDs 0xCAFE and 0x1337
221232
You may get the following IDs: ``0x0874b2a7a0cafe00``,

0 commit comments

Comments
 (0)