Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat(throttle): support size-based write throttling #298

Merged
merged 11 commits into from
Sep 18, 2019

Conversation

neverchanje
Copy link
Contributor

@neverchanje neverchanje commented Aug 21, 2019

In this PR we introduce size-based (aka throughput) throttling strategy to handle the complex workloads that are hard to throttle using simple QPS-based strategy.

For example, a user will produce 3 sub-jobs in one Hadoop pipeline that writes totally different data size into Pegasus. Job1 is 200byte avg, Job2 is 1KB avg, Job3 is 20KB avg. But all of them are mostly in 10K QPS. For a multi-tenant deployment with 100MB/sec capacity, it's hard to give a proper limitation of QPS that satisfy all the workloads.

  1. 5000*delay*100: (100% utilization for Job3, with 5000 QPS in delay-queue, but only 5% utilization for Job2)
  2. 10000*delay*100 (200% utilization for Job3, this may lead to unhealthy cluster state).

If we are able to throttle in throughput, the util of Job2 can be increased from 5% to 10%. Most importantly, the user won't blame us for unnecessary slow-down.

USAGE:

> use test
> set_app_envs replica.write_throttling_by_size 100M*delay*100

This PR also simplifies the usage of QPS throttling, for 50000*delay*100, you can write 50K*delay*100.

@neverchanje neverchanje changed the title throttle: support size-based write throttling feat(throttle): support size-based write throttling Aug 22, 2019
src/dist/replication/common/replication_common.cpp Outdated Show resolved Hide resolved
src/dist/replication/common/replication_common.h Outdated Show resolved Hide resolved
src/dist/replication/lib/replica.h Outdated Show resolved Hide resolved
src/dist/replication/lib/replica.h Outdated Show resolved Hide resolved
src/dist/replication/lib/replica_2pc.cpp Show resolved Hide resolved
src/dist/replication/lib/throttling_controller.cpp Outdated Show resolved Hide resolved
src/dist/replication/lib/throttling_controller.h Outdated Show resolved Hide resolved
@@ -418,7 +419,7 @@ class replica : public serverlet<replica>, public ref_counter, public replica_ba
bool _inactive_is_transient; // upgrade to P/S is allowed only iff true
bool _is_initializing; // when initializing, switching to primary need to update ballot
bool _deny_client_write; // if deny all write requests
throttling_controller _write_reqs_throttling_controller; // throttling by requests-per-second
throttling_controller _write_qps_throttling_controller; // throttling by requests-per-second
throttling_controller _write_size_throttling_controller; // throttling by KB-per-second
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throttling by KB-per-second => throttling by bytes-per-second

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component/throttle Related to rate throttling of Pegasus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants