Skip to content

🐛(scalingo) isolate the metrics endpoint in its own gunicorn pool#776

Open
NathanVss wants to merge 1 commit into
mainfrom
feat/scalingo-deadlock
Open

🐛(scalingo) isolate the metrics endpoint in its own gunicorn pool#776
NathanVss wants to merge 1 commit into
mainfrom
feat/scalingo-deadlock

Conversation

@NathanVss

Copy link
Copy Markdown
Contributor

DeployCenter calls the usage metrics endpoint synchronously while answering our entitlements requests. Served by the same sync workers, this callback could queue behind the very requests blocked waiting for DeployCenter, freezing the whole pool until timeouts fire. A dedicated single-worker gunicorn behind nginx guarantees the callback always finds a free worker, making the circular wait impossible.

The main pool is sized to WEB_CONCURRENCY minus the reserved worker so the container keeps the worker count its size was provisioned for, and both values are logged at boot to ease diagnosing worker starvation.

This is a first approach solution, with @sylvinus we talked about providing the metrics data directly in the /entitlements calls, avoiding DeployCenter to make a call to drive's /metrics api routes, which would speed up the call and make impossible dead locks.

DeployCenter calls the usage metrics endpoint synchronously while
answering our entitlements requests. Served by the same sync workers,
this callback could queue behind the very requests blocked waiting for
DeployCenter, freezing the whole pool until timeouts fire. A dedicated
single-worker gunicorn behind nginx guarantees the callback always
finds a free worker, making the circular wait impossible.

The main pool is sized to WEB_CONCURRENCY minus the reserved worker so
the container keeps the worker count its size was provisioned for, and
both values are logged at boot to ease diagnosing worker starvation.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants