I was just wondering what other people who work with microservices do to make sure everything gets done right.
- If say two services try to modify the same data at the same time, how do you prevent that? e.g. Using Redis as a fast cache to have a distributed lock?
- If for example you want to reduce a user's balance then decrease an inventory amount (assuming those are different services), what do you do if two people are trying to buy the last item? What if a person tries to buy something twice?
Any good reads on distributed systems like that?