Use MySQL to build a simple and sustainable Cache System

Source: Internet
Author: User

Trademanager is about to engage in operational activities in a short period of time. In the past two days, when designing the system, there is a need to update the data about 5 million times within half an hour. The data volume is small, up to 10 million; the database cannot be used, and the cache system must be used to import data to the database. However, because the data in memcache is stored in the memory, whenProgramWhen the crash or the machine is down, the data will be lost and the reliability cannot be met. I developed a set of pesistented memcache by myself, but it took time to develop and the progress was not allowed. So I thought of the MySQL memory dB mechanism. MySQL adopts the plug-in mechanism and supports the memory dB mode. Dual-machine data backup is achieved through the replication technology. The performance of MySQL's memory dB is tested. The test results show that 15000-can be achieved by using a common server (2 CPUs ~ 25000/s of data insertion/update operations can meet 15000/s of data read operations. From the test results, the performance can meet the requirements of 5 million and a half hours. In addition, the use of replication technology also meets the data reliability requirements. After all, the probability of two machines going down at the same time is negligible.

During replication configuration, set sync_binlog to 0. Upgrade the update operation.

Use mysqlbinlog to restore data. When the MySQL machine is down or the mysqld server program is down, you can use mysqlbinlog to restore data. For example:

Mysqlbinlog -- disable-log-bin-L/tmp/-- force-read -- Set-charset = GBK -- start-position = 981 mysql-bin.000003 | MySQL

 

After testing, it takes about 20 minutes to restore 10 million logs that record update operations.

 

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.