When not to use Alpine

Created: — modified: — tags: linux python

When you use scripting languages and want to squeeze some performance.


Alpine is a nice and small Linux distro, very popular among container creators.

As many know, it uses musl libc library (after all, it mentioned on the Alpine website main page!), which is an alternative to more popular GNU glibc.

Unfortunately, it looks like it has some performance issues with scripting languages like Python, PHP, and bash.

And my experience confirms this.

Testing setup

Recently I converted my server setup to using separate containers for various services: Postfix SMTP server, SquirrelMail webmail server, Baikal CardDav server, etc - see repo for details. It lets me have several containers running simultaneously, with different, even conflicting, programs: various OSes, webservers, etc.

Test bench contains of two PHP services:

In both cases, SquirrelMail was running behind reverse nginx proxy.

I was loading main SquirrelMail addressbook page (…/src/addressbook.php) which was fetching all contacts from CardDav address book, reloading that page 11 times and recording maximum, minimum, and median values.


And the numbers look like this:

You can see more than 2x difference between worst and best values (953 and 406), and about ⅓ difference between median values on first and last rows (702 vs 445).


Indeed, subjectively, with PHP servers running under Debain, SquirrelMail feels more responsive.

One might notice many shortcomings in my testing method: changing not only OS, but also webserver and sometimes even PHP version, using a VPS for performance testing, and testing over network.

But you are welcome to repeat this testing themselves - I will include a link to your results on this page, also if they don't agree with mine. Moreover, I'm probably more interested in results which differ from what I got!

Some more links:

Update from 2021-09-21

Also, note that musl library does not not support DNS-over-TLS.

It means that if a DNS response doesn't fit into a single UDP packet - musl library users won't able to read it.

Musl author says that they should use more advanced dedicated DNS libraries for that.

But if your app developer doesn't agree - then you're out of luck.

It looks like that's what happened to me with Alpine opendkim container.