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

ref(server): Move all heavy actors into dedicated arbiters #1378

Merged
merged 3 commits into from
Aug 4, 2022

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented Aug 4, 2022

Each actix arbiter spawns a thread with its own single-threaded event loop. This
allows to create isolation between actors that may cause CPU spikes when
backlogged, and makes fair scheduling in actix easier.

While some of our actors, notably the OutcomeProducer and (metrics)
Aggregator had been spawned into a dedicated arbiter, most of the other actors
were still running on the main arbiter. The EnvelopeManager is known to cause
an increase in CPU consumption due to how it spawns futures internally. This
slows down the project cache and healthcheck, which in turn blocks incoming HTTP
requests.

Since there's a global slowdown of the main arbiter, it becomes hard to separate
cause from effect when investigating slow response times. It is not clear
whether the project cache causes increased queue sizes or whether increased
queue sizes delay project fetching.

To create clear separation, this PR introduces a dedicated arbiter for every
heavy actor.

@jan-auer jan-auer requested a review from a team August 4, 2022 11:38
@@ -135,6 +135,9 @@ impl ServiceState {
let outcome_producer = Arbiter::start(|_| outcome_producer);
registry.set(outcome_producer.clone());

let outcome_aggregator = OutcomeAggregator::new(&config, outcome_producer.recipient());
registry.set(outcome_aggregator.start());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  1. Out of curiosity, why did you move this up here?
  2. Why does the outcome aggregator not get its own thread?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That probably wouldn't have been necessary, and I'm happy to revert that. I merely moved it up so that it's next to the outcome producer.

It doesn't have its own thread since it looks like it does relatively cheap stuff internally. I'm not yet convinced that we should have one thread for each actor/service, so I'm mostly going by what we know causes issues.

* master:
  fix(metrics): Light normalize before extracting metrics (#1366)
@jan-auer jan-auer merged commit b0df53e into master Aug 4, 2022
@jan-auer jan-auer deleted the ref/separate-arbiters branch August 4, 2022 13:43
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.

3 participants