]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Support lowering CPU priority of background threads
authorGabriel Wicke <gwicke@fb.com>
Tue, 24 Apr 2018 15:38:01 +0000 (08:38 -0700)
committerAndrew Kryczka <andrewkr@fb.com>
Wed, 25 Apr 2018 01:18:32 +0000 (18:18 -0700)
commitf5ee207c64de55fdefc51750cdf291f59a72dccb
treea019d922609ef2be8e3a4f4058700f76d5084184
parentf2fd21fa6f5b7d59a08013ca877a687ec8a2e97f
Support lowering CPU priority of background threads

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
HISTORY.md
env/env_posix.cc
include/rocksdb/env.h
tools/db_bench_tool.cc
util/threadpool_imp.cc
util/threadpool_imp.h