Answer the question
In order to leave comments, you need to log in
How to implement guaranteed execution of operations on the server under heavy loads?
Let's take Google Docs as an example. When working with a document, each character entered is guaranteed to be written to the database and we will always get the document in the state in which we finished working with it (of course, anything can happen, but we will assume that the developers intended the system that way).
Now let's take our application in which we also need to perform guaranteed data saving. It would seem nothing complicated: sent a request, waited for a record in the database, and here it is "guaranteed record". When the number of users is not large, then you can stop there, but what if there are a lot of them and they all actively work with the application? If each client waits for a response, it will simply put the whole system down.
A similar task can be solved using some kind of queue of operations (recording not immediately, but after some time), for example, if we implement some kind of chat, then you can really send a message to put it in the queue, since it does not need to reach this second (even if it is lost, it is not critical).
But what if you need to receive an answer about a successful entry into the database immediately, because, as in the case of Google Docs, all further work depends on it. It will be strange if a person types some text and then finds that some sentences are missing for the reason that they have not yet reached the turn of their processing.
Tell me how systems are implemented in which guaranteed recording is required under heavy loads?
Answer the question
In order to leave comments, you need to log in
I am not a professional in this field, and therefore I have no right to recommend anything to you. But as I remember, servers of highly loaded services (Google, Yandex, etc) rarely load above 20 percent, and if the threshold is exceeded, the load is balanced on others, spreading the total load on the entire fleet of involved servers. It seems to me that the question is not the complexity of implementing queues, but where to write changes, given that they may not always occur on the same server. Therefore, I join this issue and I will be glad if they correct me and explain how the changes are merged if they are spread (whether?) on different machines.
Yes, there is no guaranteed record in Googledox, it also sometimes goes offline.
It’s either goodies or go, if the servers have enough resources to serve customers, then what problems with recording do you see?
If there are not enough resources, then you still cannot solve the problem programmatically.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question