UUID എന്നാൽ എന്ത്?
ഒരു UUID (Universally Unique Identifier) ഒരു 128-bit value ആണ്, 550e8400-e29b-41d4-a716-446655440000 പോലുള്ള 36-character string ആയി render ചെയ്യുന്നു. v1 മുതൽ v5 വരെ RFC 4122-ഉം, പുതിയ v6, v7, v8 versions RFC 9562-ഉം define ചെയ്യുന്നു. ഈ ടൂൾ v4 (purely random), v1 (timestamp plus random node ID), v7 (Unix-millisecond timestamp prefix plus random suffix, generation time-ൽ sortable) generate ചെയ്യുന്നു — ബ്രൗസറിൽ, platform-ന്റെ Web Crypto API ഉപയോഗിച്ച്. Data server-ലേക്ക് send ചെയ്യില്ല.
UUID generation എങ്ങനെ പ്രവർത്തിക്കുന്നു?
ഓരോ version-ഉം determinism, sortability, entropy വ്യത്യസ്ത trade-off ചെയ്യുന്നു. ടൂൾ നിങ്ങളുടെ selection-ൽ ശരിയായ algorithm pick ചെയ്യുന്നു:
- v4 (random) browser-ന്റെ
crypto.randomUUID()call ചെയ്യുന്നു, 122 bits cryptographic randomness return ചെയ്യുന്നു, 6 fixed bits (version0100,10variant) ശരിയായ positions-ൽ set ആകുന്നു. Collisions astronomically unlikely — ഒരൊറ്റ duplicate-ൽ 50% probability-ക്ക് ഏകദേശം 2.71 quintillion v4 UUIDs generate ചെയ്യേണ്ടതുണ്ട്. - v1 (timestamp + node) ഒരു 60-bit Gregorian timestamp (1582-10-15 മുതൽ 100-nanosecond ticks)
time_low/time_mid/time_hi_and_version-ൽ pack ചെയ്യുന്നു, version nibble0001set ആകുന്നു, variant bits-ഉമായി 14-bit clock sequence pick ചെയ്യുന്നു, multicast bit forced on ആയ random 48-bit node ID ഉപയോഗിക്കുന്നു. - v7 (sortable timestamp), RFC 9562 §5.7 അനുസരിച്ച്, 48-bit big-endian Unix-millisecond timestamp, ശേഷം 4-bit version
0111, ശേഷം 12 random bits, ശേഷം 2-bit variant10, ശേഷം 62 more random bits. Timestamp most-significant bits-ൽ ഉള്ളതിനാൽ v7 UUIDs generation order-ൽ lexicographically sort ആകുന്നു — extra encoding ഇല്ലാതെ ഏത് UUID version-ഉം offer ചെയ്യാത്ത property. - എല്ലാ randomness-ഉം
crypto.getRandomValues()-ൽ നിന്ന് ലഭിക്കുന്നു, browser-ന്റെ cryptographically-secure RNG. v1-ഉം v7-ഉം ഒരു intra-tick monotonic guard include ചെയ്യുന്നു, അതിനാൽ ഒരേ clock tick-ൽ consecutive calls-ഉം second ആദ്യത്തിനു മുകളിൽ sort ആകുന്നു — millisecond clock race ചെയ്യുന്ന bulk generation runs-ൽ important. - Format pipeline generation ശേഷം run ആകുന്നു. Hyphens strip ചെയ്ത്, uppercase ആക്കി, braces-ൽ wrap ചെയ്ത് (
{…}— Microsoft GUID convention), raw 16 bytes base64 ആക്കി (22-character output, no padding) render ചെയ്യാം. Base64 mode മറ്റ് format options override ചെയ്യുന്നു.
ഈ UUID generator ഉപയോഗിക്കേണ്ടതെന്തുകൊണ്ട്?
- Browser-ൽ നിന്ന് ഒന്നും പോകില്ല. Web Crypto API locally run ആകുന്നു; initial document load ശേഷം page zero network requests നടത്തുന്നു. DevTools തുറന്ന് Generate ക്ലിക്ക് ചെയ്ത്, Network panel നിശ്ശബ്ദമാകുന്നത് കാണുക.
- RFC-correct output. v4 RFC 4122 §4.4 follow ചെയ്യുന്നു, v1 §4.2, §4.5 follow ചെയ്യുന്നു, v7 RFC 9562 §5.7 follow ചെയ്യുന്നു. Version nibble, variant bits standards-ൽ നിർദ്ദേശിക്കുന്ന positions-ൽ — ഓരോ UUID-ഉം canonical version regex-ൽ validate ആകുന്നു.
- Database keys-നായി sortable v7. Postgres, MySQL, SQL Server-ൽ clustered primary key ആയി v7 UUID ഉപയോഗിക്കുമ്പോൾ inserts index-ൽ append-only ആകുന്നു — page splits ഇല്ല, random I/O ഇല്ല — globally unique ആയിരിക്കുമ്പോൾ. v4-ന് ഇത് ചെയ്യാൻ കഴിയില്ല, bits random ആണ്.
- Rate limits ഇല്ലാതെ bulk generation. ഒരൊറ്റ click-ൽ 1, 10, 100, 1,000 UUIDs generate ചെയ്യുക. Quota ഇല്ല, signup ഇല്ല — ടൂൾ tab-ൽ run ആകുന്നു, limit CPU ആണ്, vendor API tier ഇല്ല.
UUIDs-ന്റെ സാധാരണ applications എന്തൊക്കെ?
Central authority-ഉമായി coordinate ചെയ്യാതെ globally-unique identifier ആവശ്യമുള്ളിടത്തെല്ലാം UUIDs കാണപ്പെടുന്നു:
- Database primary keys. Auto-incrementing integers row counts leak ചെയ്ത് sharding break ചെയ്യുന്നു. UUIDs shards-ൽ stable, regions-ൽ safe to merge, (v7-ഉമായി) B-tree inserts hot ആക്കുന്നു page splits ഇല്ലാതെ. ഒരു typical application UUID client-side generate ചെയ്ത്, insert-ൽ send ചെയ്ത്, key-നായി server round-trip ആവശ്യമില്ല.
- Request correlation IDs. HTTP middleware ഓരോ incoming request-ലും v4 UUID attach ചെയ്ത്, ഓരോ span-ലും log ചെയ്ത്, downstream propagate ചെയ്യുന്നു (പലപ്പോഴും
X-Request-Idheader ആയി). Customer bug report ചെയ്യുമ്പോൾ, support engineer ID paste ചെയ്ത്, services-ലും time zones-ലും ambiguity ഇല്ലാതെ request trace surface ആകുന്നു. - Idempotency keys. Payment APIs (Stripe, Razorpay, Cashfree)
Idempotency-Keyheader accept ചെയ്യുന്നു, retried request customer-ന് twice charge ചെയ്യില്ല. Client-generated UUID ഓരോ logical operation-നും unique key ഉറപ്പ് വരുത്തുന്നു, ആ APIs require ചെയ്യുന്ന contract.
UUID example എങ്ങനെ ഇരിക്കും?
Node.js-ൽ അല്ലെങ്കിൽ modern browser-ൽ crypto.randomUUID() one-liner fresh v4 UUID return ചെയ്യുന്നു — ഉദാ. 3f50b5a8-2c54-4b9c-9c1f-3e5c7e2b8d12. Request ID അല്ലെങ്കിൽ idempotency key-നായി ഉപയോഗിക്കുക. UUID clustered primary key ആകുന്ന database column-ലേക്ക് പോകുന്നുവെങ്കിൽ, v7 generate ചെയ്യുക: ഒരു millisecond apart produce ചെയ്ത രണ്ട് v7 values, 0190a3b0-7d4f-7c9e-8b21-a4d6f0bd9c11-ഉം 0190a3b0-7d50-7f15-9c4e-72b3e0c1d8a4-ഉം, generation order-ൽ lexicographically sort ആകുന്നു. Postgres-ന്റെ uuid type രണ്ട് versions-ഉം identical ആയി store ചെയ്യുന്നു — വ്യത്യാസം index-write time-ൽ, v7 B-tree-ന്റെ right-ൽ append ആകുന്നു, v4 scatter ചെയ്ത് random I/O force ചെയ്യുന്നു.
ഈ UUID Generator ഒരൊറ്റ ജോലി ചെയ്യുന്നു: ഒരു click RFC-compliant identifiers ഒന്നോ അതിലധികമോ ആക്കുന്നു, ആവശ്യമുള്ള format-ൽ, request server-ലേക്ക് send ചെയ്യാതെ. Version തിരഞ്ഞെടുക്കൂ, count തിരഞ്ഞെടുക്കൂ, format തിരഞ്ഞെടുക്കൂ — generate ചെയ്ത്, copy ചെയ്ത്, മുന്നോട്ട് പോകുക.