-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WriteBufferManager: allow slowing down writes based on total memory usage #114
Comments
@Guyme The ticket as was actually completed but abandoned. |
@erez-speedb , plz make sure theres no degradation with branch - dirty-mem-connect-wbm-to-global-delay. |
Perf test passed, same performance and memory consumption as 2.4.1 |
comparing main branch (e7e2de7) vs this branch (ba6a3de) quantitative - almost 50% improvement in stability: same Ops/sec (mean) platform |
Currently the
WriteBufferManager
(WBM) does not allow slowing down writes in response to memory usage getting close to the prescribed limit. The only mechanism for letting flushes catch up is stopping writes completely by passing true for theallow_stall
parameter of the WBM constructor. This can lead to oscillation between full write rate and complete stop, which is undesirable as it affects the latency of user writes.Allow slowing down writes based on memory consumption by having the WBM signal the
WriteController
(WC) (there can be more than one) of the delay requirement. The delay requirement is stored in the WC as part of the Global Delay feature (#346). The same way a CF signals the WC that it has a delay requirement.To enable this feature:
allow_delays_and_stalls = true
. in the ctor of WriteBufferManager (previously this flag was namedallow_stalls
)use_dynamic_delay = true
.The way the delay requirements are calculated is as follows:
The WBM reports a delay once its memory consumption passes a certain threshold from the quota. That threshold can be controlled by passing
start_delay_percent
to the ctor of the WBM. The default value is 70. Which means that the WBM will start issuing delay requests once the memory consumption of the WBM reaches 70% of its quota.The delay is linear throughout the range from threshold to the max quota. The range from start of delay to the quota is divided into 99 steps of delay. (
kMaxDelayedWriteFactor
- 1). E.g. in the 1st step, the delay requirement will be 99/100 * max_delayed_write_rate() and the last step (when the memory almost reached the quota) will result in a delay requirement of 1/100 * max_delayed_write_rate(). max_delayed_write_rate() is the rate the user passed todelayed_write_rate
(DBOptions) which can also be dynamically changed.note:
The stall logic in the WBM is redundant since the WC already includes logic for stopping writes which can be reused.
For the first phase, #423 , keep using the stall logic in the WBM (ShouldStall() and WBMStallWrites()) and only add the mechanism for slowing down writes.
The text was updated successfully, but these errors were encountered: