]> git.proxmox.com Git - ceph.git/blame - ceph/doc/dev/osd_internals/osd_throttles.rst
update sources to v12.1.1
[ceph.git] / ceph / doc / dev / osd_internals / osd_throttles.rst
CommitLineData
7c673cae
FG
1=============
2OSD Throttles
3=============
4
5There are three significant throttles in the filestore: wbthrottle,
6op_queue_throttle, and a throttle based on journal usage.
7
8WBThrottle
9----------
10The WBThrottle is defined in src/os/filestore/WBThrottle.[h,cc] and
11included in FileStore as FileStore::wbthrottle. The intention is to
12bound the amount of outstanding IO we need to do to flush the journal.
13At the same time, we don't want to necessarily do it inline in case we
14might be able to combine several IOs on the same object close together
15in time. Thus, in FileStore::_write, we queue the fd for asyncronous
16flushing and block in FileStore::_do_op if we have exceeded any hard
17limits until the background flusher catches up.
18
19The relevant config options are filestore_wbthrottle*. There are
224ce89b 20different defaults for xfs and btrfs. Each set has hard and soft
7c673cae
FG
21limits on bytes (total dirty bytes), ios (total dirty ios), and
22inodes (total dirty fds). The WBThrottle will begin flushing
23when any of these hits the soft limit and will block in throttle()
24while any has exceeded the hard limit.
25
26Tighter soft limits will cause writeback to happen more quickly,
27but may cause the OSD to miss oportunities for write coalescing.
28Tighter hard limits may cause a reduction in latency variance by
29reducing time spent flushing the journal, but may reduce writeback
30parallelism.
31
32op_queue_throttle
33-----------------
34The op queue throttle is intended to bound the amount of queued but
35uncompleted work in the filestore by delaying threads calling
36queue_transactions more and more based on how many ops and bytes are
37currently queued. The throttle is taken in queue_transactions and
38released when the op is applied to the filesystem. This period
39includes time spent in the journal queue, time spent writing to the
40journal, time spent in the actual op queue, time spent waiting for the
41wbthrottle to open up (thus, the wbthrottle can push back indirectly
42on the queue_transactions caller), and time spent actually applying
43the op to the filesystem. A BackoffThrottle is used to gradually
44delay the queueing thread after each throttle becomes more than
45filestore_queue_low_threshhold full (a ratio of
46filestore_queue_max_(bytes|ops)). The throttles will block once the
47max value is reached (filestore_queue_max_(bytes|ops)).
48
49The significant config options are:
50filestore_queue_low_threshhold
51filestore_queue_high_threshhold
52filestore_expected_throughput_ops
53filestore_expected_throughput_bytes
54filestore_queue_high_delay_multiple
55filestore_queue_max_delay_multiple
56
57While each throttle is at less than low_threshhold of the max,
58no delay happens. Between low and high, the throttle will
59inject a per-op delay (per op or byte) ramping from 0 at low to
60high_delay_multiple/expected_throughput at high. From high to
611, the delay will ramp from high_delay_multiple/expected_throughput
62to max_delay_multiple/expected_throughput.
63
64filestore_queue_high_delay_multiple and
65filestore_queue_max_delay_multiple probably do not need to be
66changed.
67
68Setting these properly should help to smooth out op latencies by
69mostly avoiding the hard limit.
70
71See FileStore::throttle_ops and FileSTore::thottle_bytes.
72
73journal usage throttle
74----------------------
75See src/os/filestore/JournalThrottle.h/cc
76
77The intention of the journal usage throttle is to gradually slow
78down queue_transactions callers as the journal fills up in order
79to smooth out hiccup during filestore syncs. JournalThrottle
80wraps a BackoffThrottle and tracks journaled but not flushed
81journal entries so that the throttle can be released when the
82journal is flushed. The configs work very similarly to the
83op_queue_throttle.
84
85The significant config options are:
86journal_throttle_low_threshhold
87journal_throttle_high_threshhold
88filestore_expected_throughput_ops
89filestore_expected_throughput_bytes
90journal_throttle_high_multiple
91journal_throttle_max_multiple
92
93.. literalinclude:: osd_throttles.txt