Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions examples/terraform/envoy-ratelimiter/ratelimit.tf
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ resource "kubernetes_deployment" "ratelimit" {
name = "STATSD_PORT"
value = "9125"
}
env {
name = "GRPC_MAX_CONNECTION_AGE"
value = var.ratelimit_grpc_max_connection_age
}
env {
name = "GRPC_MAX_CONNECTION_AGE_GRACE"
value = var.ratelimit_grpc_max_connection_age_grace
}

resources {
requests = var.ratelimit_resources.requests
Expand All @@ -214,6 +222,17 @@ resource "kubernetes_deployment" "ratelimit" {
container_port = 9125
protocol = "UDP"
}
# statsd-exporter does not use much resources, so setting resources to the minimum
resources {
requests = {
cpu = "50m"
memory = "64Mi"
}
limits = {
cpu = "100m"
memory = "128Mi"
}
}
}

volume {
Expand Down
23 changes: 18 additions & 5 deletions examples/terraform/envoy-ratelimiter/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ variable "min_replicas" {
variable "max_replicas" {
description = "Maximum number of replicas for rate limit deployment"
type = number
default = 5
default = 100
}

variable "hpa_cpu_target_percentage" {
Expand Down Expand Up @@ -128,6 +128,19 @@ variable "ratelimit_log_level" {
default = "debug"
}

variable "ratelimit_grpc_max_connection_age" {
description = "Duration a connection may exist before it will be closed by sending a GoAway"
type = string
default = "5m"
}

variable "ratelimit_grpc_max_connection_age_grace" {
description = "Period after MaxConnectionAge after which the connection will be forcibly closed"
type = string
default = "1m"
}


variable "redis_resources" {
description = "Compute resources for Redis container"
type = object({
Expand All @@ -136,11 +149,11 @@ variable "redis_resources" {
})
default = {
requests = {
cpu = "100m"
cpu = "250m"
memory = "128Mi"
}
limits = {
cpu = "500m"
cpu = "1000m"
memory = "512Mi"
}
}
Expand All @@ -154,8 +167,8 @@ variable "ratelimit_resources" {
})
default = {
requests = {
cpu = "250m"
memory = "256Mi"
cpu = "150m"
memory = "128Mi"
}
limits = {
cpu = "500m"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
/** A {@link RateLimiterFactory} for Envoy Rate Limit Service. */
public class EnvoyRateLimiterFactory implements RateLimiterFactory {
private static final Logger LOG = LoggerFactory.getLogger(EnvoyRateLimiterFactory.class);
private static final int RPC_RETRY_COUNT = 5;
private static final long RPC_RETRY_DELAY_MILLIS = 1000;
// Retry up to 1 min rather than failing fast and asking runner to retry full bundle.
private static final int RPC_RETRY_COUNT = 10;
private static final long RPC_RETRY_DELAY_MILLIS = 6000;

private final RateLimiterOptions options;

Expand Down
Loading