If we use Rocksdb inside tokio app , rocksdb do blocking Tokio scheduler or not?

first we tried to use (WAL) with tokio-uring for persistent data.
then we heard about Rocksdb.

do Rocksdb create seperate thread for itself ??

if we call Rocksdb API in Tokio task,
do it blocking Tokio scheduler or not ??

1 Like

You can typically tell whether you are blocking by looking for the .await keyword. See this article for more.

Beyond that, if you use tokio-console, then it will tell you whether your tasks are blocking the thread.

I think tokio-console can help .

My mean is, Rocksdb use disk IO operation internally, it dont use something like async operation, then actually it block thread when calling api .

My question is here .

Is Rocksdb operation block tokio scheduler
Or it use seperate thread pool internally ??!

If you do not have an ".await" on the call you're making into the database, it will potentially block the current thread from executing any other tasks scheduled on it. From looking at one of the crates, I don't think it offers an async aware API.

You don't necessarily need to have your own thread pool. spawn_blocking() uses its own threadpool under the hood, and depending on your situation and needs that might be performant enough.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.