Skip to main content
Ayakaleaf Pro runs on a server with 2 CPU cores and 2 GB of memory, Git integration included, once you add 2 GB of swap. Without swap it runs out of memory while it starts. The settings in step 2 then cut its swap use almost in half.
We measured this on Ayakaleaf Pro 6.3.1 with the Toolkit, in a 2 vCPU / 2 GiB QEMU/KVM virtual machine running Ubuntu 24.04, with sandboxed compiles (texlive-basic:2025.1) and Git integration on.

Why 2 GB is not enough by default

Idle, with the default settings, Ayakaleaf Pro needs about 1.9 GiB. Ubuntu and Docker already use 364 MiB of a 2 GiB machine, which leaves about 1600 MiB.

1. Add 2 GB of swap

This is the step that matters most.

2. Lower memory use

Add these lines to config/variables.env. The Git integration container reads this file too.
variables.env
To cap the MongoDB cache, add a mongo entry under services in config/docker-compose.override.yml (the same file that sets the Ayakaleaf Pro image):
docker-compose.override.yml
Then run bin/up -d.
NODE_OPTIONS replaces the value set in the image, so the line must keep --require /overleaf/.pnp.cjs --import /overleaf/.pnp.register.mjs. Without them the Node.js services cannot load their packages and don’t start. --optimize-for-size can’t be used: Node.js refuses it in NODE_OPTIONS.--replSet overleaf is what the Toolkit passes to MongoDB by default. Keep it.
With a 160 MiB heap, cloning or pushing a large project over Git may run out of memory, and the Git integration container restarts. We did not test this. If it happens, raise -Xmx.

Results

Each test compiled a 33-page LuaLaTeX document with fontspec and 30 TikZ figures; concurrent compiles were different projects. Without swap, one out-of-memory kill leads to the next: web restarts, its start needs memory again, and the server hangs until a hard reset. With swap, three compiles at once take about as long as one, because what goes to swap are idle Node.js pages. Not tested: Git clone and push load, many users editing at the same time, and swap on slow disks (our host used an SSD).

Kubernetes

Our Kubernetes guide turns swap off on the nodes (Prepare the nodes), so only step 2 applies there. Put NODE_OPTIONS and MALLOC_ARENA_MAX in the overleaf-env ConfigMap (Personalizing your instance). The MongoDB cache is already set in Deploy MongoDB and Redis.
Last modified on November 21, 2026