-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[server] Make rate limiter configurable in quota enforcement handler (#…
…1160) - Add configuration to allow swapping between different rate limiter types. - Make quota enforcement interval and capacity (used in TokenBucket) configurable. - Update TokenBucket to support refreshing at millisecond intervals. - Some other cleanups to make code style consistent
- Loading branch information
1 parent
a782eee
commit d4bf2ba
Showing
30 changed files
with
625 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
clients/venice-admin-tool/src/test/java/com/linkedin/venice/TestDataRecoveryClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
internal/venice-common/src/main/java/com/linkedin/venice/acl/handler/StoreAclHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mon/src/main/java/com/linkedin/venice/helix/HelixCustomizedViewOfflinePushRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
internal/venice-common/src/main/java/com/linkedin/venice/throttle/GuavaRateLimiter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.linkedin.venice.throttle; | ||
|
||
import com.google.common.util.concurrent.RateLimiter; | ||
|
||
|
||
/** | ||
* A wrapper around Guava's RateLimiter to provide a common interface for rate limiting. | ||
*/ | ||
public class GuavaRateLimiter implements VeniceRateLimiter { | ||
private final RateLimiter rateLimiter; | ||
private long permitsPerSecond; | ||
|
||
public GuavaRateLimiter(long permitsPerSecond) { | ||
this.permitsPerSecond = permitsPerSecond; | ||
this.rateLimiter = RateLimiter.create(permitsPerSecond); | ||
} | ||
|
||
@Override | ||
public boolean tryAcquirePermit(int units) { | ||
return rateLimiter.tryAcquire(units); | ||
} | ||
|
||
@Override | ||
public void setQuota(long quota) { | ||
this.permitsPerSecond = quota; | ||
} | ||
|
||
@Override | ||
public long getQuota() { | ||
return permitsPerSecond; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "GuavaRateLimiter{" + "permitsPerSecond=" + permitsPerSecond + '}'; | ||
} | ||
} |
Oops, something went wrong.