egze

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

garazdawi

Erlang Core Team

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

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

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.

Where Next?

Popular in Questions Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
dotdotdotPaul
Okay, I’m having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I’m sure I’...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

Other popular topics Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New

We're in Beta

About us Mission Statement