Memcache Cache Avalanche Phenomenon

Source: Internet
Author: User
Cache Avalanche Phenomenon
The cache hit ratio of the other nodes is degraded due to the failure of one node. The actual data in the cache is to be found in the database.
Causes the database to crash in a short time. May restart DB (database), short-term will be crushed, only a small number of cache.
Once the DB restarts repeatedly, the cache is rebuilt.

Cache is periodically invalidated. Expires every 6 hours. Then a request spike occurs every 6 hours. May cause DB to crash

Cache bottomless Phenomenon
Even if you increase the cache nodes, the access speed is still unpleasant. is called a cache bottomless pit.
The previous two cache servers are accessed once. It was later increased to 4 units, with the result that each one was connected only once. Because the information is scattered on four servers.
Originally as long as access to 2 units, and later to visit 4 units. So the number of links to Memcache is not decreasing with the increase of nodes ...

NoSQL and traditional rdbmsm (relational database) can be referenced to one another in a design.
This k-v design for NoSQL memcache and Redis. Key design can refer to the table-column design in MySQL
Solutions
Distribute a set of keys according to a common prefix.
user:133 is the user name and the age Nam height key underneath. Should not be divided into open, should be put together.
User:133-age, User:133-name,user:133-height fold 3 keys
The user:133 is used to compute the node of the distribution algorithm. Instead of using user:133-age/name/height to calculate
Such These 3 keys for personal information will fall on the same node. And not be scattered anywhere else.
When you visit again, you just need to connect to a single node.

Persistent data is kicked (persistent data is inactive, the expired data is active before it expires, and is not get after it expires).
memcached Data loss
Inertia mechanism (no known failure) and LRU removal mechanism (least recently used principle)

Then there is a problem, when there is an inactive data and a data that has expired (we do not know that he expired, only get the time to know). When new data is inserted, it will kick off the inactive

Due to the existence of inertia mechanism, a data if it has expired, but there is no get. Then the memory will still exist.
1. Non-permanent data is get in the expiration period. To become active.
2. While permanent data has not been get for a long time. has become inactive.
3. When inserting new data. Permanent data will be kicked

Workaround: Separate storage of permanent and non-permanent data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.