Aphora
Aphora is a system do distributedly generate unique IDs without any coordination. It is similiar to Snowflake, but generates ASCII sortable strings instead of integers.
It uses 72 bit long Binaries which get encoded to 12 characters long Strings.
An Aphora ID is composed of:
45 Bits Timestampwith millisecond precision. It gives up to 1115 years with a custom epoch.5 Bits Datacenterallows up to 32 different datacenters.10 Bits Workerallows up to 1024 different processes/workers/machines within a datacenter.12 Bits Counterallows for 4096 Aphora IDs to be generated each millisecond. Aphora also protects against rollovers to happen within the same millisecond.
Just like Snowflake, Aphora protects from non-monotonic clocks, by refusing to generate timestamps until it gets provided with a time equals or after the last generated ID.
Installation
The package can be installed by adding aphora to your list of dependencies in mix.exs:
def deps do
[
{:aphora, "~> 0.3.2"}
]
end
The docs can be found at Hex.
License
Aphora is licensed under the Apache License 2.0.