The Mechanics of Global LSN and Vector Clocks in Session Consistency Guarantees
Updated Apr 28, 2026
Short answer
Session consistency uses a 'Session Token' (effectively a vector clock or LSN) passed between client and server to ensure read-your-own-writes within a specific version boundary.
Deep explanation
When a client writes to Cosmos DB under Session consistency, the server returns an x-ms-session-token. This token contains the LSN (Log Sequence Number) of that specific write. In subsequent reads, the client sends this token back. The server ensures that the replica processing the read has at least reached that LSN. If the replica is lagging, the server waits or routes to a more up-to-date replica. This provides a 'Monotonic Read' guarantee for that specific client without the high cost of Strong consistency.
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro