REST API blocking async: Solution A, block_in_place #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?