ID, EGO and Super EGO of your entity
summary
Benchmarks on OpenJDK 20 (Ubuntu machine, many threads) compare sequence IDs, UUID/ULID, Snowflake and custom Base58 strings, measuring generation rate and index-insert conflicts into a ConcurrentHashMap. Key findings: sequence via AtomicLong is fastest but in multi-node or crash scenarios causes lost or highly conflicting IDs (tests show millions of conflicts); UUIDs and SecureRandom are slower and non-ideal for B-tree indexes; ULID/time-based IDs remain sortable and avoid some coordination pain. Recommendation: prefer business-friendly or time-sortable IDs when you need gap-free or index-friendly behavior.
AI-written summary · about
chapters (16)
- 0:00Introduction to entities
- 1:17Freud’s ID ego super ego
- 2:22ID in Java objects
- 8:12EGO identifiers in programming
- 12:09Ideal identifier requirements
- 15:20Sequences and their flaws
- 16:22UUIDs and their trade-offs
- 19:14ULID sortable identifiers
- 22:14Super EGO natural identifiers
- 28:16Short readable IDs
- 34:03Index-friendly IDs
- 36:31Performance tests on ID generation
- 40:51Databases and ID generation
- 42:16Domain-driven design and IDs
- 44:00Sortable and gap-free IDs
- 49:19YouTube ID generation
related talks
44mID, EGO and Super EGO of Your Entity
22mIdentity and GraphQL: More Than You Want to Think About IDs
18mAvoiding Conflicts in Highly-Concurrent Applications
12mA practical way to generate unique id with Go
27mThe Mutability Matrix of Pain
49mAvoiding mistakes with events, one at a time
32mApproaching Join Index for Lucene #bbuzz
50mWelcome to the Jungle - A safari through the JVM landscape
