Comments (5)
IDs from the same second have a local monotonic incrementing random inited counter, so they will still sort well when generated on the same machine/process.
from xid.
ULID requires locking if you need to use it concurrently.
from xid.
many years later, I think another major difference compare to ULID is xid
is only up to 1 second precise, meaning sorting is only possible within the same second, whereas ULID is up to millisecond precise.
from xid.
For concurrency ULID requires a lock while xid uses an atomic counter as a workaround. Depending on the application, this can be a factor. Conciseness is another.
from xid.
xid
seems relatively better if the priority is conciseness, indexing-performance and zero-configurability. But I am not too sure if the locking argument holds true @rs :
ULID requires locking if you need to use it concurrently.
According this comparison of Golang ID packages actually https://github.com/oklog/ulid also achieves fast lock-free concurrent ULID generation
Besides millisecond precision, ULID also enjoys broader support due backward compatibility with UUID columns e.g. Cockroach DB has a builtin function to generate ULIDs for PKs
For a distributed DB like Cockroach DB with xid
generated in the application layer over distributed containers / serverless functions sharing a DB cluster, @rs are there any reasons you would still recommend xid
over ULID all things considered, especially when there's no guarantee that the xid
will be generated on the same machine/process?
from xid.
Related Issues (20)
- `kern.uuid` is misinterpreted as a machine ID when it's actually a kernel version identifier
- Xid needs a Kotlin Multiplattform port
- Could there be a conflict use it in diffrent docker? HOT 2
- Is xid thread-safe? HOT 1
- Can a new release be released? HOT 1
- [Query] How can I verify that generated code is done by my code? HOT 1
- What happens when the 4 byte time value overflows? HOT 2
- '/proc/self/cpuset' not found inside the container
- [bug] xid.FromString return string is difference. HOT 17
- How do I use/implement it?
- Rewriting this some recommendations HOT 2
- Tag a release
- upgrade go version to 1.13 or later?
- How do you pronounce xid? HOT 2
- Question around readMachineID HOT 5
- What is "K-ordered" and "sortable"? HOT 1
- big bug: not sortable HOT 1
- Command-line tool HOT 1
- Potential curse/profane/offensive words generated using xid (in a user-facing setting) HOT 2
- Release Tagging
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xid.