Ruby on Rails and Docker: Jemalloc in multi-platform images
Teamtailor has been running with jemalloc in production for a couple of days, with great success. Today, we wanted to try running the app on AWS's Graviton, their ARM-based CPUs, to see if we could get a better cost/performance ratio.
Our Docker image setup for jemalloc, based on a gist from John Bachir, was using a hard-coded path containing a reference to x86_64
:
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
ENV MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true"
The solution I came up with to support both linux/amd64
and linux/arm64
was to use a symlink:
RUN ln -s /usr/lib/*-linux-gnu/libjemalloc.so.2 /usr/lib/libjemalloc.so.2
ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2
ENV MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true"
Published at | |
---|---|
Tags | ruby docker programming |
Related posts | |
Have some thoughts? | Reply by email |
Reactions |