Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Memory Configuration For Redis 3.0

Enrico Giordani edited this page Oct 14, 2015 · 3 revisions

Premise

Redis on Windows 3.0 introduces a new memory management architecture that:

  • improves the performance
  • reduces the system requirements
  • simplifies the configuration

On top of the new architecture, the switch from dlmalloc to jemalloc improves the heap management reducing the heap fragmentation.

Memory Configuration Settings Changes

In Redis on Windows 2.8 the memory allocation architecture was based on a memory mapped file that was created at startup. The size and location of the memory mapped file were configured using two flags:

  • maxheap
  • heapdir

Since Redis on Windows 3.0 doesn't use a memory mapped file anymore, those two flags are treated as any other invalid flag, therefore if they are present in the configuration file or passed as a command line argument, Redis will fail to start.

System Paging File Size Requirements

The new memory management architecture uses the system paging file as memory heap, therefore there are some system requirements to make sure that Redis doesn't run out of heap space.

Redis on Windows 2.8 was allocating the heap space at once at startup, if more heap space was needed later on, it was going to fail with an out of memory error. Redis on Windows 3.0, on the contrary, allocates the heap memory on demand. At startup it only allocated the minimum amount of heap required to start and it keeps allocating new heap memory on demand.

Given that the heap is subject to fragmentation and given some other internal requirements (i.e. copy on write mechanism to simulate the Unix fork API), a safe minimum requirement for the system paging file is 2 times the physical memory.

By default a freshly installed Windows machine allows the system paging file to grow up to 3.5 times the physical memory (given that there is enough disk space for it), therefore the default system paging file configuration is already sufficient to run Redis on Windows 3.0.

Preventing Redis from running out-of-memory

If other programs, beside Redis, are running on the same machine and they also use the system paging file or if the system paging file reaches a high degree of fragmentation, there is still the possibility of an out of memory error. To reduce the possibility of such event a machine reboot will defrag the system paging file. Also increasing the size setting and setting the Initial size equal to the Maximum size will help.