build(docker): pin onnxruntime threads in the image

OMP_NUM_THREADS=4 capped torch in the old image, but FastEmbed runs on
onnxruntime, which ignores it and sizes its pool to the host's core count.
A CPU-limited container still reports every host core, so embedding ran with
64 threads on a 4-CPU sandbox and took up to 12x longer per file. The image
now sets EMBEDDINGS_THREADS=4 next to the existing caps; the settings guide
documents the knob.
This commit is contained in:
Alex committed 2026-09-05 22:15:31 +01:00
1 parent 482e043e67
commit 03cc60d481
2 files changed
+6 -1

No files matched your search

+5 -1
View File
@@ -143,10 +143,14 @@ RUN mkdir -p /app/application/inputs/local /app/inputs /app/indexes /app/vectors
ENV FLASK_APP=app.py
# Thread caps. onnxruntime (FastEmbed) ignores OMP_NUM_THREADS and sizes its
# pool to the host's core count, which a CPU-limited container still reports;
# EMBEDDINGS_THREADS pins it the way OMP_NUM_THREADS pinned torch before.
ENV MALLOC_ARENA_MAX=2 \
OMP_NUM_THREADS=4 \
MKL_NUM_THREADS=4 \
OPENBLAS_NUM_THREADS=4
OPENBLAS_NUM_THREADS=4 \
EMBEDDINGS_THREADS=4
EXPOSE 7091