diff options
author | Andrew Clayton <a.clayton@nginx.com> | 2024-08-12 22:56:16 +0100 |
---|---|---|
committer | Andrew Clayton <a.clayton@nginx.com> | 2024-08-19 23:40:07 +0100 |
commit | 57c88fd4086d47bf866e3fe7e4c03d0262d413ae (patch) | |
tree | cde9db01fb59c821c16229f860e2bdc7536f6b7c /src/nxt_port_hash.c | |
parent | 2444d45ec969a539c6e1f4484783dd9e9ce21626 (diff) | |
download | unit-57c88fd4086d47bf866e3fe7e4c03d0262d413ae.tar.gz unit-57c88fd4086d47bf866e3fe7e4c03d0262d413ae.tar.bz2 |
router: Make the number of router threads configurable
Unit generally creates an extra number of router threads (to handle
client connections, not incl the main thread) to match the number of
available CPUs.
There are cases when this can go wrong, e.g on a high CPU count machine
and Unit is being effectively limited to a few CPUs via the cgroups cpu
controller. So Unit may create a large number of router threads when
they are only going to effectively run on a couple of CPUs or so.
There may be other cases where you would like to tweak the number of
router threads, depending on your workload.
As it turns out it looks like it was intended to be made configurable
but was just never hooked up to the config system.
This adds a new '/settings/listen_threads' config option which can be
set like
{
"listen": {
...
},
"settings": {
"listen_threads": 2,
...
},
...
}
Before this patch (on a four cpu system)
$ ps -efL | grep router
andrew 419832 419829 419832 0 5 Aug12 pts/10 00:00:00 unit: router
andrew 419832 419829 419833 0 5 Aug12 pts/10 00:00:00 unit: router
andrew 419832 419829 419834 0 5 Aug12 pts/10 00:00:00 unit: router
andrew 419832 419829 445145 0 5 03:31 pts/10 00:00:00 unit: router
andrew 419832 419829 445146 0 5 03:31 pts/10 00:00:00 unit: router
After, with a threads setting of 2
$ ps -efL | grep router
andrew 419832 419829 419832 0 3 Aug12 pts/10 00:00:00 unit: router
andrew 419832 419829 419833 0 3 Aug12 pts/10 00:00:00 unit: router
andrew 419832 419829 419834 0 3 Aug12 pts/10 00:00:00 unit: router
Closes: https://github.com/nginx/unit/issues/1042
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src/nxt_port_hash.c')
0 files changed, 0 insertions, 0 deletions