tikv / yatp

Yet another thread pool in rust for both callbacks or futures.
Apache License 2.0
135 stars 32 forks source link

Support dynamically scaling workers of the pool #60

Closed ethercflow closed 2 years ago

ethercflow commented 2 years ago

Feature Request

Describe the feature you'd like:

I want to adjust the number of workers online, Actual scenarios such as scaling read pool (controlled by unified.max-thread-count) of TiKV without restart. Expect to reduce performance jitter as much as possible during the adjustment process.

Technical proposal

Pros

  1. The adjustment of the number of threads is very lightweight, and there are no thread creation and destruction operations and lock operations
  2. Without scale, judging whether it is runnable is just comparing two atomic variables

Cons

  1. During build, max_thread_count thread objects will be created at once, there will be a little more CPU overhead and memory overhead

Process