-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Move slow db interactions to tokio blocking pool #905
Comments
What we should do is change the store to move actual work to the blocking pool itself by having some internal function Once we do that, we should also remove the semaphore introduced in #1522 |
We have |
Actually we have way too much |
cc @mangas because we discussed this during yesterday's standup. |
All database interactions going through Diesel are synchronous, even though most of them happen within tokio's cooperative multitasking framework. That means that long-running db interactions will block the tokio worker they are running on; if enough workers (by default, one per CPU core) block, the whole system grinds to a halt. At that point, no work can be done, including work that doesn't even involve the database, but simply gets scheduled on the tokio runtime.
Upstream Diesel is not going to add async database interactions anytime soon so we need to come up with our own approach. One possible way to address this is with tokio's
tokio_threadpool::blocking
where slow work gets pushed to a separate pool of slow tasks, freeing up the main workers.Open questions around this:
Store
functions returnFuture
?)blocking
pool)The text was updated successfully, but these errors were encountered: