Analysis of simple usage process of memcached distributed memory Object caching system

Source: Internet
Author: User
Keywords Caching systems memory objects
Tags access analysis cache caching caching system caching systems data data sharing

Wind Network (ithov.com) original article: Memcached is a set of distributed memory object caching system, which can reduce the load of database in the dynamic system, and improve the system performance. Memcached is used most of the time as a front-end cache for the database, because it is less expensive than a database for SQL parsing, disk operations, and uses memory to manage data, so it can provide better performance than directly reading the database. In addition, memcached is often used as a storage medium for data sharing between servers. After studying this chapter, I believe that readers can have a comprehensive understanding of memcached, so that building a set of their own distributed memory object caching system becomes very simple things.

What is memcached

&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP; Memcached is a free, Open-source, high-performance, distributed memory object caching system that accelerates dynamic Web applications by mitigating database load. The initial version was developed by Brad Fitzpatrick of LiveJournal in 2003. Many users around the world are using it to build their own big load sites or to improve their response to high access sites. Memcache is the name of this project, and memcached is the server-side main program file name.

Caching is typically used to keep objects or data that are frequently accessed (for example, browsers cache frequently visited pages), and access to objects or data through caching is much faster than disk access. Memcache is a memory cache that caches frequently accessed objects or data in memory, which is accessed through the API in memory, and the data is like a large hash table, Key-value. Memcache reduces database pressure by caching frequently accessed objects or data, improving Web site responsiveness and building faster, scalable Web applications. Figure 3-1 shows the process of memcache and database collaboration.

The specific logic of this process is as follows:

1 Check whether the data requested by the client is present in the memcache, and if it exists, return the requested data directly, and no longer do any operation on the data.
2 If the requested data is not in Memcache, query the database, return the data obtained from the database to the client, and cache the data into the MEMCACHC.
3 Update the data in Memcache every time the database is updated, such as updating and deleting data from the database, to ensure that the data in the memcache is consistent with the data in the database.

Figure 3-1 Memcache and database collaboration workflow

4 when allocated to memcache memory space, the LRU (least recently Used, least recently used) policy plus expiration policy is used, and the invalid data is replaced first and then replaced with the most recent unused data.

Related Article

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.