You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We tried to switch a small service from php-fpm to nginx-unit, but this new setup consumes ~10 times more CPU than the previous one.
The app is very simple, it receives http request from client, then makes 3 requests to a Redis storage and send the response back to the client. The usual load is around 300 req/second.
with php-fpm it consumes ~150mcpus (we use kubernetes)
Do you see behaviour where the response is good/ cpu usage low when starting, but within a little time, it starts going up?
Is it possible to test a simply php to echo something back without the redis coming into play, and see if you see the same behavour?
I ask because almost exact use case and it turned out redis connections running out, causing delay, causing cpu usage to go high. Yours may be completely different, but just sharing my experience.
Bug Overview
We tried to switch a small service from php-fpm to nginx-unit, but this new setup consumes ~10 times more CPU than the previous one.
The app is very simple, it receives http request from client, then makes 3 requests to a Redis storage and send the response back to the client. The usual load is around 300 req/second.
perfscrip.t.gz
Versions we tried:
Most of the tests were made on the RPM from Remi's repo:
unit version: 1.34.2
configured as ./configure --libdir=/usr/lib64 --sbindir=/usr/sbin --prefix=/usr --statedir=/var/lib/unit --control=unix:/run/unit/control.sock --pid=/run/unit/unit.pid --runstatedir=/var/run --log=/var/log/unit/unit.log --logdir=/var/log --tmpdir=/var/tmp --user=unit --group=unit --openssl --cc-opt='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --tests --njs --otel --modulesdir=/usr/lib64/unit/modules
But we alse tried 1.30 also from Remi, and official bookworm-based image 1.34.2-php8.2
The result is always the same.
Config we used:
{ "access_log": { "path": "/dev/null" }, "listeners": { "*:9000": { "pass": "routes" } }, "routes": [ { "match": { "uri": "/ping" }, "action": { "return": 200 } }, { "match": { "uri": "/announce.php" }, "action": { "pass": "applications/p2p/announce" } } ], "applications": { "p2p": { "type": "php", "stdout": "/dev/null", "stderr": "/proc/self/fd/2", "processes": { "max": 64, "spare": 64 }, "working_directory": "/var/www", "limits": { "timeout": 5, "requests": 5000 }, "targets": { "announce": { "root": "/var/www/public", "script": "announce.php" } } } } }
Expected Behavior
nginx-unit consumes the same amount of cpu time as php-fpm (or less)
Steps to Reproduce the Bug
Run application and check cpu consumption under the load of 300 req/sec
Environment Details
Additional Context
No response
The text was updated successfully, but these errors were encountered: