ringord
ringord

Reputation: 958

Calculating redis max memory when running multiple redis instance in same machine

I want to set up a Redis cluster with 6 Redis instances with 3 machines(so 2 Redis instances with one machine) each with 32GB memory, 8 core CPU. I am not sure how many bytes will be enough for Redis max-memory config.

  1. Considering 4GB memory is used by OS, I guess 28GB is left for the user processes. And since running 2 Redis instances in a multi-core environment, I think I should set 14GB max memory config value for each Redis instance because both processes are both up and running simultaneously. But I am not sure. Which max memory value is correct for this case?

  2. I remember that the operating system saves page tables for each process, and loads and unloads the process's page table to physical memory when the core works on the process. So in the case of a single-core CPU environment with 32GB memory, is it ok to set 28GB max memory for each instance, since there will be only one process running concurrently?

Upvotes: 0

Views: 584

Answers (1)

Renshaw
Renshaw

Reputation: 1155

Usually, multi Redis instance in one machine is not recommended. Because of the L3 cache of CPU can not work effectively. If you want Redis run more effectively, you can bind Redis instances to different cpu cores mannually.

Then, the max memory.

  1. if you use RDB for data save. The answer is 7GB. The BGSAVE thread will fork from main thread, the COW(Copy-on-write) will copy page tables when new write comming, so it will use another 7GB for maximum. Two Redis instance will cost 28GB.
  2. single-core CPU environment is not friendly for Redis. I suggest two-core. The max memory is 14GB.

Upvotes: 1

Related Questions