The Redis memory management method supports Tcmalloc,jemalloc,malloc three memory allocations, memcache using memory allocation methods such as Slabs,malloc.
The simple point, Redis, is to use the side of the application, using the field to apply memory to store data, and rarely use free-list and other ways to optimize memory allocation, memcache using a pre-allocated memory pool, using slab and different sizes of chunk to manage memory, Item selects the appropriate chunk storage based on size, the memory pool can be omitted to request/free memory cost
Optimized parameters: 1. Setting the MaxMemory option in redis.conf, my experience is that when your Redis physical memory is using more than 3/5 of the total memory capacity, it starts to be more dangerous.
2. You need to set the Vm.overcommit to 1, which is useful when writing a large number of
Overcommit_memory=0, default, Smart Super, each time the allocation of memory is required, kernel will compare the requested space and free space is sufficient to allocate overcommit_memory=1, request allocation of memory, always pretend to have enough memory overcommit_memory=2, do not allow hyper-fat memory, that is, the size of the allowed allocation is less than
3. Be sure to set a certain amount of swap, preferably as large as memory, otherwise the kernel oom (out-of-memory) killer will kill the Redis process
Redis parameter optimization