HAProxy docker high memory

Hi,

I want to run multiple HAProxy instances with Nomad but I don’t understand why HAProxy is consuming so much memory compared to running it natively.

My host OS is Ubuntu 20.04 with up -to-date docker.io package and I’m using the official haproxy images found on Docker Hub. When I use HAProxy >= 2.4, a basic configuration with one HTTP frontend and 2 backends consumes 137MB of memory, when I use >= 2.0 it “only” consumes 68MB of memory whereas when I use the “old” 1.8 image it only consumes 10MB of memory.

Why is there so much difference for the same basic configuration ? I plan to run hundreds of HAProxy instances so the smaller the memory footprint is, the more instances on the same host I can put.

When I run a “native” HAProxy instance with the same compile options, it consume much less memory (55MB).

I tried to build an image without openssl, pcre and promex but it keeps consuming 137MB of memory.

Have you an idea ?

Thanks

Emilien