Answer the question
In order to leave comments, you need to log in
Parallel queries to the DBMS during the absence of the write cache - which algorithm?
I can not find information on this topic, I found only one article :
If there is a request that takes 10 seconds to complete, the ttl for its cache is 1 hour.The problem is described, but the solution is not clear, because confuses the phrase " At the moment when the data is deleted in the cache, you must first ... ".
When this time passes, the data in the cache is deleted.
In the first 10 seconds after that, a situation occurs when several users simultaneously call this request. This can be disastrous, as there may be several hundred or thousands of such calls within 10 seconds.
To avoid this, it is necessary to use a special duplication technique. For each heavy request, not one, but two keys are created - ttl and ttl +10 sec.
At the moment when data is deleted in the cache, you must first write the value from the spare to the main key, and only then proceed to execute the SQL query.
Answer the question
In order to leave comments, you need to log in
The problem is not in the cache and its expiration, the problem is in the generation of content when there is no data in the cache or when it needs to be regenerated when the data changes.
Definitely, it is necessary to catch this situation and stop the generation of content on all pages except one, literally - 'slow down to move faster'.
Implementation option - a method in which content is generated using an in memory key-value database (probably better not memcached, since it does not guarantee the safety of data, although if you administer with an eye to this, why not, you can suggest adding a certain value to memcache before the start of generation, and check for it), marks the beginning and end of this process, with a link to the identifier of this data (for example, a website page), i.e. the record appears only for the time of data generation, and if there is a record, it slows down the process.
It would be logical not to do a random sleep for this, but to wait for an event from a neighboring process, ideally using this database
this is called the dogpile effect and is treated by warming up the cache
The cache can be deleted by memcached itself after the expiration of time.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question