DuckDB secretly does synchronous work in it’s library implementation, that means there’s less threads available in the threadpool for Orleans. That conflicts with Orleans it’s usage of the threadpool and affects throughput for grains.1

Takeway

Make sure any slow process that needs to be asynchronous actually is async e.g. network calls, database calls, or in the case of DuckDB an embedded in-process database.

Ledjon Behluli explains how to solve this problem with a implementation of a Sync Worker pool.

Footnotes

  1. Source: https://www.youtube.com/watch?v=VvT5mRpsLdA