I was asked in an interview the following scenario:
- User1 looks at empty seats for a movie.
- User2 also looks at empty seats for a movie.
- Both select 'same seat' and hit submit.
1, What mechanisms would prevent same resource from being allocated to both ?
I answered, we will check the timestamp of each request on the app server. He said, what if load-balancer would redirect requests to different app servers ?
- Also asked if I could do anything on the
DB-layer
to prevent this ? I am weak on transactions and ACID but is it anything related to that ? Please explain ?