Score:0

Remove sticky session setup with clustered database - sync delay duplication?

ec flag

I am currently trying to remove my server setup with "Sticky Sessions" and go over to a setup with a Database for the session storage. Instead of one database (single point of failure) we thought about having a redis replica on every server so that all servers share the same database of the master.

The Problem: What if 2 requests get sent at the same time from the same user and hit 2 database-slaves who both execute their code at the same time?

An example: A user shops for a limited one-time only item. He sends 2 requests to buy the item and the database on both receiving servers thinks "He didn't buy it, so it's OK to buy it". Now the user has 2 items instead of one.

This could happen right? If the servers don't sync their data fast enough both servers could execute the database query at once?

Or is there already a solution to fixing this session-stickyness problem?

Thanks! BR Chris

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.