Question

Hello,I'd like to ask you two questions. (I am using java and jedis)

  1. I want to write 2G data to redis, how can I write faster?
  2. Does the redis dump the data to several files, not only the dump.rdb? Such as the data is too large as 4G, the data will be dumped to the dump.rdb and dump2.rdb ?
Was it helpful?

Solution

You can import data faster into Redis by using variadic parameters commands (such as MSET), and/or using pipelining (which is supporting by Jedis) to aggregate roundtrips to the Redis instance. The less roundtrips, the faster import.

Another good practice is to deactivate the AOF (if it is activated), and background RDB dump (if it is activated) during the import operation (and reactivate them after).

Redis cannot dump to several data files. But if you write 2 GB of data in Redis, there is no way the dump file can take 4 GB. The dump file is always much more compact than the data in memory. The only way to get several dump files is to start multiple Redis instances and shard the data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top