egze
Best docker image for Elixir (glibc, malloc, musl)
Just saw this comment on HN:
„ Uses alpine images for small footprint
That’s really become a docker meme. Please be aware you’re sacrificing performance due to not using glibc. glibc has thread-local pools for malloc, afaik musl uses locks.„
I always try to use alpine images. Does this make the Beam run slower than with other images?
Most Liked
garazdawi
It does indeed. There are a few scenarios when it would fall-back to using malloc, but they should not occur during normal operations.
cnck1387
That’s partly why I switched to Debian. It’s to avoid having to think about these things and wondering if some low level alternate implementation of a popular library is going to cause issues.
A few years ago I remember a post on Reddit where someone ran an artificial benchmark that performed ~10,000 SQL queries from a web app into PostgreSQL using psycopg2 (a Python library to interface with Postgres) and it was noticeably slower with Alpine vs Debian.
I don’t know if that would be the same with Elixir but it’s an example where choosing your base image may have performance implications, although in this case it’s hard to say how useful that benchmark is because it was basically a vacuum test.
cnck1387
Personally I use the slim variants which are usually the latest Debian release. A lot of other images have Buster tags at the moment but the official Elixir image is still only offering Stretch.
I used to use Alpine but I moved to using Debian for all of my base images at least a year ago.
Personally I sleep better at night knowing I’m using super well tested libraries at the cost of only having images that are maybe 50-100mb larger in practice on a real world app. I never ran into a project where that file size difference made a difference. If you were running at “roflcopter” scale you would probably pre-seed your host images with your base Docker image already on the system so it’s not a network win.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








