gubernator-io / gubernator

High Performance Rate Limiting MicroService and Library - Developed at Mailgun
Apache License 2.0
103 stars 10 forks source link

How many system threads to expect? #24

Closed dimaqq closed 5 months ago

dimaqq commented 5 months ago

I've configured gubernator to start 1 worker via env var. I've confirmed that gubernator logs "starting 1 workers".

However, pstree output didn't seem to change, with 11 or 12 threads running in total.

I guess perhaps some of these are golang deps, like dns?

How can I validate that the worker setting is really in effect?

dimaqq commented 5 months ago

I think it's a red herring. I don't have any gubernator traffic at the moment, and system threads as well as goroutine dump only show the golang innards, and not workers.

Workers limited to 1

root@hexanator-0:/# cat /proc/23/environ | tr \\0 \\n | grep GUBER
GUBER_WORKER_COUNT=1
root@hexanator-0:/# pstree
pebble-+-gubernator---11*[{gubernator}]
       `-12*[{pebble}]

Workers not limited, 8 are started per cpu detection

root@hexanator-0:/# cat /proc/38702/environ | tr \\0 \\n | grep GUBER
root@hexanator-0:/# pstree
pebble-+-gubernator---9*[{gubernator}]
       `-12*[{pebble}]
dimaqq commented 5 months ago

I've confirmed that GUBER_WORKER_COUNT is honoured by doing a SIQUIT goroutine dump after hammering the service with concurrent traffic