I think it’s meant to be monotonic within one node but not cross-node (cross-node the sort order is random within the same millisecond). The random portion of the IDs are sequentially incrementing within a single MS on a given node.
Re:ULID: Like UUID but Sortable (2019)
by GeertJohan on Sunday July 14, 2024 @02:30AM
(#40959245)
Afaik it depends on the generate function you use. You can let it keep track of the increment when generating, at a performance cost (atomic operations).
> Within the same millisecond, sort order is not guaranteed
And:
> Monotonic sort order (correctly detects and handles the same millisecond)
Which is it?
To make it more confusing, the spec later contains a section about monotonic sort order[1]. And looks like not all libraries implement it [2].
[1]: https://github.com/ulid/spec?tab=readme-ov-file#monotonicity
[2]: https://github.com/suyash/ulid/issues/10