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.