Skip to content

Memory usage calculation is incorrect #1015

Description

@joanhey

Now calculate also the memory used for the Linux disk cache, not the really memory used by the applications.
It's important to have this measure correct, but with the default memory efficient factor in the composite leaderboard the problem is worst.

All the frameworks are affected, some with some Mb but others with Gb's.
The memory of the disk cache is normal in any linux, but it is NOT memory used for the apps, it's available memory.
Some frameworks use more because compile in the same FROM in dockerfile, others because use more files,use apt,... anyway this memory is not memory used.

More information here:
https://www.linuxatemyram.com/

And we can't use top, htop, free, .... inside the container, because not only show the memory disk cache, but also the memory used by the host.

Yes, almost all OSs use file-system cache, it's for that than the static files test is as fast using the file system than direct from memory.
Without a line of code we almost have the same memory cache to serve static files.

With a simple docker stats it's easy to check, as it show the real container mem usage.

Examples:

Framework test connections bench memory used docker stats*
Fastapi Python uvicorn baseline 512 4.7 GiB ~705 MiB
Fastapi Python uvicorn baseline 4096 5.3 GiB ~752 MiB
Rage Ruby Iodine baseline 512 5.0 GiB ~317 MiB
Rage Ruby Iodine baseline 4096 4.5 GiB ~329 MiB
Ngx-php baseline 512 4.4 GiB ~85 MiB
Ngx-php baseline 4096 4.4 GiB ~89 MiB
Hono-bun js baseline 4096 1.9 GiB ~172 MiB
Mark PHP Workerman baseline 4096 152 MiB ~69 MiB
Workerman baseline 4096 220 MiB ~66 MiB
Aspnet-minimal baseline 4096 274.3 MiB ~90 MiB
Actix baseline 4096 142 MiB ~28 MiB

Etc, etc, ...
** Docker stats in local with 8 cores and wrk.

When we saw the numbers for all nginx variants, from 3.5 Gb to 4.5 Gb with any test and any number of concurrent connections, even with API4, than only use 4 cores and 256 connections, was using the same memory 🤔 .
We have apps actually working with nginx with 4 workers_processes ++ php-fpm ++ php app ++ mysql ++ fail2ban ++ .... serving more than 512 connections at the same time and never used the 1 Gb memory of the server. So the calculation was incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    platformEverything related to benchmark exection, including the PR workflow.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions