Memcached compared to MySQL's query cache

Source: Internet
Author: User
Tags memcached mysql query

It takes a lot of work to introduce memcached into the application. MySQL has a handy query cache that can automatically cache the results of SQL queries, and cached SQL queries can be executed quickly and repeatedly. How does memcached compare with it? MySQL's query cache is centralized and will benefit from the MySQL server connected to the query cache.

* When you modify the table, the MySQL query cache is immediately refreshed (flush). It only takes a little time to store a memcached item, but when the write operation is frequent, the MySQL query cache often invalidates all cached data.

* On multi-core CPUs, MySQL's query cache encounters an extension problem (scalability issues). On multi-core CPUs, query cache adds a global lock, which can become slower due to the need to flush more cached data.

* In MySQL's query cache, we cannot store arbitrary data (only SQL query results). With memcached, we can build a variety of efficient caches. For example, you can execute multiple independent queries, build a user object, and then cache the user object into memcached. The query cache is at the level of the SQL statement and it is not possible to do so. In a small website, query cache helps, but with the increase in the size of the site, query cache will do more harm than benefit.

* The amount of memory available to query cache is limited by the free memory space of the MySQL server. It is good to add more memory to the database server to cache the data. However, with memcached, you can increase the size of the memcached cluster as long as you have free memory, and then you can cache more data.

Memcached compared to MySQL's query cache

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.