Skip to content

Commit f3da775

Browse files
committed
Renderer: give PDFBox 70% of the container's memory as heap
Two of DocSpring's PDFs (large images) ran out of Java heap on the cluster's 1 GiB renderers: the JVM's default heap is a quarter of the container's memory. Pixels don't change, so renderer.version stays.
1 parent 4862d15 commit f3da775

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎docker/renderer.Dockerfile‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ RUN set -eu; mkdir -p /opt/pdfbox/libs; cd /opt/pdfbox; \
4040
curl -fsSL -o libs/jai-imageio-jpeg2000.jar "https://repo1.maven.org/maven2/com/github/jai-imageio/jai-imageio-jpeg2000/${JAI_IMAGEIO_VERSION}/jai-imageio-jpeg2000-${JAI_IMAGEIO_VERSION}.jar"; \
4141
echo "${JAI_IMAGEIO_JPEG2000_SHA256} libs/jai-imageio-jpeg2000.jar" | sha256sum -c -
4242

43-
# The same JVM flags as DocSpring's document worker: one core per run, C1 only, headless.
43+
# The same JVM flags as DocSpring's document worker (one core per run, C1 only, headless), plus a heap of 70% of the
44+
# container's memory: the JVM's default quarter (256 MB of a 1 GiB limit) runs out on PDFs with large images.
4445
RUN printf '%s\n' '#!/bin/sh' \
45-
'exec java -XX:ActiveProcessorCount=1 -XX:TieredStopAtLevel=1 -XX:CICompilerCount=1 -XX:-BackgroundCompilation \
46+
'exec java -XX:MaxRAMPercentage=70 -XX:ActiveProcessorCount=1 -XX:TieredStopAtLevel=1 -XX:CICompilerCount=1 -XX:-BackgroundCompilation \
4647
-Djava.awt.headless=true -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider \
4748
-Dpdfbox.fontcache=/opt/pdfbox \
4849
-cp "/opt/pdfbox/pdfbox-app.jar:/opt/pdfbox/libs/*" org.apache.pdfbox.tools.PDFBox "$@"' \

0 commit comments

Comments
 (0)