#ulid — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #ulid, aggregated by home.social.
-
ULID, UUIDv4 и UUIDv7 в логах nginx: как сделать поиск по ID быстрым и удобным в ClickHouse
Когда вы работаете с распределённой системой — будь то микросервисы, фронтенд + бэкенд или nginx + приложение — жизненно важно иметь возможность «протянуть» один и тот же идентификатор запроса через все её компоненты. Это позволяет сопоставлять логи из разных источников, быстро находить ошибки и проводить корреляционный анализ. В nginx для этого из коробки есть переменная $request_id — 32-символьный hex-идентификатор (например, a1b2c3d4e5f678901234567890abcdef ). Его можно передать бэкенду через proxy_set_header X-Request-ID $request_id; или fastcgi_param HTTP_X_REQUEST_ID $request_id; , а также сохранить в access-логах. Однако стандартный $request_id — это просто случайная строка без временной привязки и без структуры, удобной для аналитики. В этой статье мы рассмотрим, как улучшить ситуацию с помощью ULID и UUIDv7.
-
"A few secure, random bytes without `pgcrypto`" 🔮
Generating a ULID using a roundabout way to avoid a dependency on the pgcrypto extension used just to get `gen_random_bytes()`
https://brandur.org/fragments/secure-bytes-without-pgcrypto
By @brandur
#PostgreSQL #Postgres #PGcrypto #UUID #ULID #Random #Bytes #SQL
-
there seems to be a lot of excitement for #uuidV7 these days (timestamp-based). it's very cool, and a good choice if you're using the #uuid or #guid as a database key (to avoid fragmentation)
https://ntietz.com/blog/til-uses-for-the-different-uuid-versions/
i also really like #ulid for this, and they can be converted to uuids/guids easily and quickly.
one thing i don't see many people talk about when they move to monotonically incrementing ids (like v7/ulid) is this: if you have a distributed database you will end up with poor balancing with these ids. not what most people do, i guess, but it's something to think about.