Increasing Informer memory allocation
With the Informer Load Balancer, work is spread across multiple threads, each responsible for a set of tasks. If performance degrades for a thread, it may be time to give it more memory. By default, each thread can use up to 1 GB of RAM. These steps raise the limit for a specific thread, on Windows and on Docker.
This uses the Node.js max-old-space-size property, which limits only the Old Space in the V8 heap, one of several memory types. Other memory types may exceed this value. For background, see the Node.js memory documentation.
Windows
Edit service.config.json and add --max-old-space-size=nnn (where nnn is megabytes) to the node_args of the thread that needs more memory. In this example, the query threads are set to 2 GB:
{
"name": "Informer5-query",
"script": "node_modules/@entrinsik/informer-server/index.js",
"instances": 2,
"args": "--http 3002 --schedule.enabled false",
"node_args": "--max-old-space-size=2048"
}
PM2 can also restart a thread automatically when its memory passes a threshold, which prevents a thread from locking up when it maxes out. Add max_memory_restart to the matching thread. In this example, the query threads restart at 2500 MB:
{
"name": "Informer5-query",
"script": "node_modules/@entrinsik/informer-server/index.js",
"instances": 2,
"args": "--http 3002 --schedule.enabled false",
"node_args": "--max-old-space-size=2048",
"max_memory_restart": "2500M"
}
Docker
Run these from the instance directory that has the docker-compose.yml, with the Informer containers stopped. Edit the entrypoint of the container that needs more memory. In this example, informer-api is raised to 2 GB with a 2500 MB restart threshold:
informer-api:
image: docker.entrinsik.com:5000/informer:target
working_dir: /informer
entrypoint: "/bin/sh -c 'node dockerpreboot.js && pm2 start node_modules/@entrinsik/informer-server/index.js -i 2 --node-args=\"--max-old-space-size=2048\" --max-memory-restart 2500M --name informer --no-daemon'"