Skip to content

Conversation

@joseluisq
Copy link
Collaborator

@joseluisq joseluisq commented Nov 28, 2025

Description

This PR replaces statically-linked binaries (musl) with dynamically-linked binaries (libc) for Debian Docker images to improve containers' performance and resource utilisation.

Resource optimization

At startup, a SWS Docker container (linux/amd64) using a statically-linked binary requires ~31MiB of RAM:

docker run -it --rm --name sws -p 8787:80 -v $PWD/docker/public:/public joseluisq/static-web-server:2-debian

$ docker stats sws
CONTAINER ID   NAME      CPU %     MEM USAGE / LIMIT     MEM %     NET I/O         BLOCK I/O     PIDS 
6cb1ab2a8394   sws       0.00%     31.52MiB / 7.617GiB   0.40%     6.78kB / 126B   7.16MB / 0B   5

However, its dynamically-linked counterpart will require ~1.5MiB of RAM:

$ docker stats sws
CONTAINER ID   NAME      CPU %     MEM USAGE / LIMIT     MEM %     NET I/O        BLOCK I/O    PIDS 
1a239fa41740   sws       0.00%     1.555MiB / 7.617GiB   0.02%     3.4kB / 126B   225kB / 0B   5

Affected targets

  • linux/amd64 updated to x86_64-unknown-linux-gnu
  • linux/arm64 updated to aarch64-unknown-linux-gnu
  • linux/386 updated to i686-unknown-linux-gnu
  • linux/arm/v6 updated to arm-unknown-linux-gnueabihf

Note affected yet

  • linux/arm/v7 still uses armv7-unknown-linux-musleabihf (statically-linked), but it will be updated to armv7-unknown-linux-gnueabihf once a binary is available (post v2.40.0).

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

@joseluisq joseluisq self-assigned this Nov 28, 2025
@joseluisq joseluisq added v2 v2 release performance Related to server performance docker Related to Docker environment or images labels Nov 28, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Nov 28, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  .github/workflows/release.docker.devel.yml  20% smaller
  Makefile Unsupported file format
  docker/debian/Dockerfile Unsupported file format
  docs/content/features/docker.md Unsupported file format

As dynamically-linked binaries can not be executed for obvious reasons
@joseluisq joseluisq marked this pull request as ready for review November 29, 2025 01:42
@joseluisq joseluisq merged commit c66c791 into master Nov 29, 2025
@joseluisq joseluisq deleted the prefer-dynamically-linked-binaries-for-debian-docker branch November 29, 2025 02:04
@joseluisq joseluisq added this to the v2.40.0 milestone Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Related to Docker environment or images performance Related to server performance v2 v2 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants