• G
    Support lowering CPU priority of background threads · 090c78a0
    Gabriel Wicke 提交于
    Summary:
    Background activities like compaction can negatively affect
    latency of higher-priority tasks like request processing. To avoid this,
    rocksdb already lowers the IO priority of background threads on Linux
    systems. While this takes care of typical IO-bound systems, it does not
    help much when CPU (temporarily) becomes the bottleneck. This is
    especially likely when using more expensive compression settings.
    
    This patch adds an API to allow for lowering the CPU priority of
    background threads, modeled on the IO priority API. Benchmarks (see
    below) show significant latency and throughput improvements when CPU
    bound. As a result, workloads with some CPU usage bursts should benefit
    from lower latencies at a given utilization, or should be able to push
    utilization higher at a given request latency target.
    
    A useful side effect is that compaction CPU usage is now easily visible
    in common tools, allowing for an easier estimation of the contribution
    of compaction vs. request processing threads.
    
    As with IO priority, the implementation is limited to Linux, degrading
    to a no-op on other systems.
    Closes https://github.com/facebook/rocksdb/pull/3763
    
    Differential Revision: D7740096
    
    Pulled By: gwicke
    
    fbshipit-source-id: e5d32373e8dc403a7b0c2227023f9ce4f22b413c
    090c78a0
threadpool_imp.cc 13.4 KB