Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frankenphp_worker_php_ready_worker is skewing to negative values with worker restarts #1163

Closed
LauJosefsen opened this issue Nov 14, 2024 · 4 comments · Fixed by #1171
Closed
Labels
bug Something isn't working

Comments

@LauJosefsen
Copy link

LauJosefsen commented Nov 14, 2024

What happened?

Hi.

We have excitingly been trying out the new 1.3.0 release. We immediately setup an alert on the frankenphp_worker_php_ready_worker metric on our environments.

We however observed that this metric has a decreasing pattern to it, that is not equal to the relationship of total_workers - busy_workers.

Look at this plot of the metric of a somewhat busy container (20RPS ish) (each line is a seperate container)

image

I was very worried of this metric, however it has now become a negative value, indicating that is keep decreasing even below 0. In our case we may see the ready_worker metric report -2, while the busy worker metric is 4 and total workers is 60. So in this case I assume the correct value is 56? Or close to 56.

It looks to be somewhat correlated to worker restarts, looking at this graph:

image

The service is responding as normal even with negative ready workers

Build Type

Docker (Debian Bookworm)

Worker Mode

Yes

Operating System

GNU/Linux

CPU Architecture

x86_64

PHP configuration

Not relevant

Relevant log output

No response

@LauJosefsen LauJosefsen added the bug Something isn't working label Nov 14, 2024
@AlliBalliBaba
Copy link
Collaborator

Yeah it looks like ReadyWorker is only called once, while StopWorker is called every time a worker restarts, skewing the metric.
@withinboredom after #1137 this could maybe also be refactored to pull metrics instead of pushing them, since we can just loop over all workers and the threads assigned to them.

@withinboredom
Copy link
Collaborator

This is possibly a merge-conflict resolution error on my part, but at a glance, it appears to be working as designed.

It is stopping workers, then it calls initWorkers, which should eventually call startNewWorkerThread, which should call metrics.StartWorker(worker.fileName), which should increment the worker count back up.

I think something is missing here.

this could maybe also be refactored to pull metrics instead of pushing them

I don't know how I would feel about a God System reaching into things just to extract metrics.

@withinboredom
Copy link
Collaborator

withinboredom commented Nov 15, 2024

I think something is missing here.

Aha!

frankenphp_worker_php_ready_worker, per the documentation:

The number of workers that have called frankenphp_handle_request at least once.

This should be a static number once started. It doesn't (usually) increase. It is indicative of a successful startup, not part of request handling itself.

@withinboredom
Copy link
Collaborator

ah, yeah. The metric changed meaning during the merge conflict. I'll fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants