Redis-persist went live

Source: Internet
Author: User
Tags diff

In September, the code quality was not high enough, and it was sprayed into a sieve by the boss. It has been repeatedly mentioned that high-quality code, maintenance, and high performance are required ......

 

Fortunately, during the last week, we finally got into short working hours and launched redis-land-go in gray scale. The project also changed to redis-persist, where GitHub was located.

 

Previously Implemented interfaces from redis to leveldb and Skynet to read data from leveldb. The last week added functions that may be used by SA colleagues. Mainly:

  • Dump
  • Restore_one
  • Restore_all
  • Sync
  • Sync_all
  • Count
  • Diff
  • Keys
  • Check_all
  • Fast_check

These commands can be divided into three types: Copy commands from redis to leveldb, such as commands starting with sync, and copy commands starting with restore from leveldb to redis; the rest is used to check the data on both sides, such as checking the diff of a player data, checking the count of the number, and listing the keys of the leveldb player uid

 

Fast_check is a special optimization for the current player storage. In leveldb, a special key table is prefixed with the key-value pair of the player UID-player data version. This table is small enough and can be put into the memory. Therefore, when you only need to compare the data version, it can be completed in a very short time. When redis and leveldb are connected over the network and are not on one machine, the data volume of million data cannot exceed 1 minute.

 

At the same time, I also looked at the leveldb structure while tossing this tool. Leveldb has the sstable concept. sstable is a table in the memory sorted by keys. It can be changed to memtable, and another table is to be written to the disk, sstable. When there is a small amount of data, the level is also relatively small. The specific LDB file corresponds to which key range, which is recorded in manifest. The written records are first recorded in the log. This is sequential writing, so it is extremely fast. Then, sort the data in the background regularly and combine the existing LDB files on the sstable and disk to make the data on the disk more and more orderly.

Redis-persist went live

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.