Created: 2021-07-11 — modified: 2021-10-03 — 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.
Unfortunately, it looks like it has some performance issues with scripting languages like Python, PHP, and bash.
And my experience confirms this.
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:
Baikal CardDav server 0.8.0, using one of these:
In both cases, SquirrelMail was running behind reverse nginx proxy.
I was loading main SquirrelMail addressbook page
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:
633/702/953 (min/med/max) ms with both servers running Alpine.
479/522/632 (min/med/max) ms with SquirrelMail running under Alpine and Baikal - under Debian;
406/445/479 (min/med/max) ms when both servers run Debian;
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:
Why is the Alpine Docker image over 50% slower than the Ubuntu image? - also linked at the top of this article
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.