Open-source solutions for building highly available cache Clusters

Source: Internet
Author: User

Many applications use cache to prevent all requests from querying the database to speed up system response. memcached is a common Cache Server (redis is a popular one ), it is a high-performance distributed memory object cache system designed to cache database query results and reduce database access times. However, when running multiple memcached servers, you often need to consider other issues, such as cache consistency and cache failure. cache consistency refers to ensuring data consistency among multiple memcached servers, the consequence of cache invalidation is relatively serious. When the memcached cache becomes invalid in the case of large concurrent access, all requests will access the database concurrently at the same moment, which may cause database downtime. To ensure the stability and high availability of the cache system, many companies have developed corresponding systems. This article summarizes the caching solutions for Twitter, Facebook, and YouTube for your reference.

  1. Twitter's redis/memcached proxy service: twemproxy
    Twemproxy is a redis and memcache Proxy Server written in C language. By introducing a proxy layer, twemproxy centrally manages multiple redis or memcached instances at the application backend, so that the application only needs to operate on twemproxy, without worrying about the specific number of real redis or memcached instances. When a node goes down, twemproxy can automatically remove it from the cluster, and when it recovers service, twemproxy will also automatically connect. As it is a proxy, twemproxy has minor performance losses.

  2. Facebook's memcached protocol router: mcrouter
    Mcrouter is a memcached-based Router developed using C ++ (the main language, using a large number of C ++ 11 features). It is the core component of the Facebook and Instagram cache architectures, you can process nearly 5 billion requests during peak hours. Clients in mcrouter can share the connection pool to reduce the number of connections. The mcrouter can allocate clients to different memcached Pools Based on the key prefix, allowing you to set the threshold value for any request rate on the unit of host, pool, or cluster, it also supports limiting the request speed to reduce the request sending speed and ensure the service quality.

  3. YouTube's MySQL middleware: vitess
    The original intention of the cache layer is to reduce the interaction between applications and databases to improve the response time. Instead of separating the cache from the database, it is better to directly embed the cache into the database. Vitess is an open-source distributed MySQL tool set for YouTube. It is mainly written in go and has been used in the YouTube production environment. Vitess supports row-level caching and is integrated with memcached, which can effectively improve the speed of primary key query. The query enters the database query only when the query in memcached is not available, when the data is modified or the database table structure changes, the cached data is deleted.

In addition, there are some unopen-source solutions, such as box Tron. Infoq is also very concerned about solutions to domestic problems. You are welcome to leave a comment to discuss with me.

Open-source solutions for building highly available cache Clusters

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.