Skip to content

Limit ring hash max size to 4K #9709

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

Merged
merged 14 commits into from
Nov 29, 2022
Prev Previous commit
review feedback
  • Loading branch information
apolcyn committed Nov 29, 2022
commit dd4aa34965449004e31bcf69521dff8928aaea3d
11 changes: 6 additions & 5 deletions xds/src/main/java/io/grpc/xds/RingHashOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ public final class RingHashOptions {
// Limits ring hash sizes to restrict client memory usage.
private static volatile long ringSizeCap = DEFAULT_RING_SIZE_CAP;

private RingHashOptions() {} // Prevent instantiation

/**
* Set the global limit for min and max ring hash sizes. Note that
* this limit is clamped between 1 and 8M, and attempts to set
* the limit lower or higher than that range will be silently
* moved to the nearest number within that range. Defaults initially
* to 4K.
* Set the global limit for the min and max number of ring hash entries per ring.
* Note that this limit is clamped between 1 entry and 8,388,608 entries, and new
* limits lying outside that range will be silently moved to the nearest number within
* that range. Defaults initially to 4096 entries.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/9718")
public static void setRingSizeCap(long ringSizeCap) {
Expand Down