A universally unique identifier (UUID) is a randomly generated identifier used to distinguish records or objects without requiring centralized coordination. Identical UUIDs are unlikely, so a client can generate one before sending a request. section 16.2.2 section 7.1
UUIDs support distributed application designs in several ways:
- Use a UUID as a database primary key when creating a record through a load-balanced backend. section 16.2.2
- Use the same UUID on retries so the backend can detect an existing record instead of inserting a duplicate. section 16.2.2
- Use a globally unique identifier as an object-store key for addressing data from different machines. section 7.1
Idempotent blog-post creation
A client generates 550e8400-e29b-11d4-a716-446655440000 and sends it with a blog post. The backend inserts the post only when that primary key is absent. If a retry arrives with the same UUID, the existing record means the operation has already succeeded. section 16.2.2
Figure 16.5 Idempotent database insert: Creating a blog post entry in the database only if it doesn’t already exist
Trace the insert-if-absent flow that uses a UUID to make database writes safe to retry. section 16.2.2









