docker: set MALLOC_CONF in docker image.

Set the MALLOC_CONF environment variable in the Docker image to tune the
Jemalloc configuration. Configuring Jemalloc to use two memory arenas
reduces memory fragmentation, and using background threads and low decay
times allows freed memory to be returned to the OS sooner.

Previously we set this environment variable at runtime in Kubernetes,
but baking it into the image is simpler.
This commit is contained in:
evazion
2022-01-12 17:03:59 -06:00
parent 5ba71f2a79
commit 4cb01d5813

View File

@@ -61,6 +61,7 @@ RUN \
FROM base as production
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
ENV MALLOC_CONF=background_thread:true,narenas:2,dirty_decay_ms:1000,muzzy_decay_ms:0,tcache:false
COPY --from=development /root /root
COPY --from=development /danbooru /danbooru