Redis batch import data

Source: Internet
Author: User

Environment:

An openstack Virtual Machine with 8-core CPU, 16 GB memory, and GB disk

Ubuntu 12.04x64 Server

Install redis2.6.7

Process:

During the experiment, we need to import 0.21 billion key-value data into redis for fast query.

After installing, configuring, and starting redis, You need to import data to redis.

If you try to use jedis to write the client to insert data into redis one by one, the speed is very slow. Just insert tens of thousands of data entries in one minute, thank God, it takes several days for 0.21 billion records (I guess the insert speed of 0.1 million records per second in redis is the batch insert speed, and the insert speed is relatively short ).

Redis batch plug, check, some use a tool named redis_import_tools https://github.com/unbracketed/redis-import-tools

I wrote it using python. I thought it was a little troublesome to read readme. It was faster than the pipe line function provided by redis. I still don't believe it, try how slow the pipe line of redis can be:

Reference http://redis.io/topics/mass-insert

You can easily generate a data file in redis protocol format. It takes about 12 minutes to import 0.21 billion entries (9 GB, with less than 4 GB of pure data, after the import, the redis-server process consumes about 90% of the memory (16 GB in total ). It seems that:

1. redis's own pipe is still very powerful;

2. redis is very memory-consuming. The physical memory should be more than 4 times the data (and the physical memory is not occupied by other processes). Otherwise, the system's memory allocation method should be set, this allows redis to use virtual memory, but the query speed may be reduced.

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.