Race conditions more than anything else
Race conditions, more than anything else. With KV for a session store, you have to worry about cache times if you need to invalidate things, propagation delays, etc. For most use-cases, it's probably fine. But DOs would give you the durability that can be necessary for critical use-cases.
4 Replies
I know KVs can take up to 60 seconds to be globally consistent but I remember somewhere that it's more like 500ms for the local datacenter. Assuming the KV is created in the same datacenter as the user, and that user tries to access a page soon after, the login seems to always work for me. Even in cases where the login results in a refresh to a different page and that page checks the session cookie, it seems to always work. I wonder if there is some sort of session affinity algorithm running or if I've just gotten lucky?
I'd say you've just gotten lucky. It's usually way less than 500ms from my experience. The other thing I'd be concerned with is invalidation. With KV, the lowest cacheTTL you can do is 60, so you potentially have ~60 seconds where your session revoking doesn't stick properly.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yep
I meant "up to 500ms within the same data center" so yes, I'm experiencing much less. I'm not all that worried about not being able to revoke a session in less than 60 seconds. Thanks for engaging here. I learned that in some contexts KV might not be the right choice for a session store.