Answer the question
In order to leave comments, you need to log in
How to lock a resource in an asynchronous application?
There is a service on tonado and postgres.
Tornado receives data, takes data from the database, processes it, and writes to the database. Let the data be some "quantity". Which is always limited. And it shouldn't go negative.
The problem is... the data is very sensitive. Already now, when I loaded the application, the "quantity" went into the red. I foresee even more problems when the service is launched in production - 16 instances.
How to make a locking mechanism? So that until one request completes its actions, others could not read? And at the same time not to slide down from the situation when 16 users put the service down?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question