-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: reduce async runtime blocking (#1336)
This PR aims to optimize request latency by reducing async runtime blocking * all functions of graphql objects are blocking, and many trigger file i/o. However, graphql requests were being executed via an async function. Use sync version of graphql execution and use tokio::spawn_blocking * use tokio::spawn_blocking for operations involving file i/o * reduce sync mutex lock regions where possible ### Performance * std::sync::Mutex should be very efficient when there's no contention, and none is expected in graphql routines * I've benchmarked the overhead of tokio::spawn_blocking, since it's used more now: on my computer (core i5 macbook) I can spawn and .await around 90k tasks per second, which is at least two orders of magnitude away from the number of requests Josh can currently handle per second. commit-id:bd8098e1
- Loading branch information
1 parent
7e755c0
commit 3768e10
Showing
1 changed file
with
162 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters