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

REST API blocking async: Solution B, spawn_blocking #57

Closed
wants to merge 3 commits into from

Conversation

junderw
Copy link
Member

@junderw junderw commented Oct 2, 2023

I found something in electrs that could greatly increase the stability of the REST API response times. It's an extremely simple fix.

However, there are 2 ways to fix the problem, and they both have tradeoffs and it depends on the number of threads, the number of incoming requests per threads, etc. as to which of the solutions is better for performance.

Knowing how many threads prod uses, and how many requests / second on average it processes will change which solution is best.

If we have N threads waiting to accept requests, and at any given time there are less than N requests being processed, solution A is better.
If we have 5 x N or 10 x N requests waiting to be processed at any given time, solution B is better.
However, anything in between would need to A/B test to figure out which one is better.
There's also a possibility (if the number of requests being processed at any given time never reaches anywhere near N requests ( like 10% of N etc.) that this change won't increase performance a lot.
So I was wondering if at some point we could try an A/B/C test with the A: Solution A, B: Solution B, and C: No changes... and see if latency changes at all.

Out of curiosity, have you felt like the REST API's response time latency is unstable with a lot of variance?

@junderw junderw force-pushed the junderw/use-blocking-spawn-b branch from 5420161 to cb85da7 Compare October 3, 2023 04:50
Copy link
Contributor

@mononaut mononaut left a comment

Choose a reason for hiding this comment

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

Tested ACK @ 2845fec

@wiz
Copy link
Member

wiz commented Mar 5, 2024

Two-Buttons

@wiz
Copy link
Member

wiz commented Mar 6, 2024

Went with Solution A

@wiz wiz closed this Mar 6, 2024
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