Skip to content
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

Merging to release-5.3.0: [TT-11371] Move leaky-bucket behind the dev build flag (5.3.0) (#6073) #6076

Merged
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
9 changes: 0 additions & 9 deletions cli/linter/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,15 +405,6 @@
"jsvm_timeout": {
"type": "integer"
},
"enable_leaky_bucket_rate_limiter": {
"type": "boolean"
},
"enable_rate_limiter_storage": {
"type": "boolean"
},
"rate_limiter_storage": {
"$ref": "#/definitions/StorageOptions"
},
"enable_non_transactional_rate_limiter": {
"type": "boolean"
},
Expand Down
9 changes: 9 additions & 0 deletions config/development.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ package config

// DevelopmentConfig extends Config for development builds.
type DevelopmentConfig struct {
// EnableLeakyBucketRateLimiter enables leaky bucket rate limiting.
//
// LeakyBucket will delay requests so they are processed in a FIFO
// style queue, ensuring a constant request rate and smoothing out
// traffic spikes. This comes at some cost to gateway instances, as
// the connections would be held for a longer time, instead of
// blocking the requests when they go over the defined rate limits.
EnableLeakyBucketRateLimiter bool `json:"enable_leaky_bucket_rate_limiter"`

// EnableTokenBucket enables token bucket rate limiting.
EnableTokenBucketRateLimiter bool `json:"enable_token_bucket_rate_limiter"`

Expand Down
13 changes: 0 additions & 13 deletions config/rate_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ import (
// RateLimit contains flags and configuration for controlling rate limiting behaviour.
// It is embedded in the main config structure.
type RateLimit struct {
// EnableLeakyBucketRateLimiter enables leaky bucket rate limiting.
//
// LeakyBucket will delay requests so they are processed in a FIFO
// style queue, ensuring a constant request rate and smoothing out
// traffic spikes. This comes at some cost to gateway instances, as
// the connections would be held for a longer time, instead of
// blocking the requests when they go over the defined rate limits.
EnableLeakyBucketRateLimiter bool `json:"enable_leaky_bucket_rate_limiter"`

// Redis based rate limiter with fixed window. Provides 100% rate limiting accuracy, but require two additional Redis roundtrip for each request.
EnableRedisRollingLimiter bool `json:"enable_redis_rolling_limiter"`

Expand Down Expand Up @@ -48,10 +39,6 @@ func (r *RateLimit) String() string {
info = "using pipeline"
}

if r.EnableLeakyBucketRateLimiter {
return "Leaky Bucket Rate Limiter enabled"
}

if r.EnableRedisRollingLimiter {
return fmt.Sprintf("Redis Rate Limiter enabled (%s)", info)
}
Expand Down
6 changes: 0 additions & 6 deletions gateway/mw_rate_limiting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ func providerCustomRatelimitKey(t *testing.T, limiter string) {
globalConf.RateLimit.DRLEnableSentinelRateLimiter = true
case "NonTransactional":
globalConf.RateLimit.EnableNonTransactionalRateLimiter = true
case "LeakyBucket":
globalConf.RateLimit.EnableLeakyBucketRateLimiter = true
default:
t.Fatal("There is no such a rate limiter:", limiter)
}
Expand Down Expand Up @@ -396,7 +394,3 @@ func TestMwRateLimiting_CustomRatelimitKeyDRL(t *testing.T) {
func TestMwRateLimiting_CustomRatelimitKeyNonTransactional(t *testing.T) {
providerCustomRatelimitKey(t, "NonTransactional")
}

func TestMwRateLimiting_CustomRatelimitKeyEnableLeakyBucketRateLimiter(t *testing.T) {
providerCustomRatelimitKey(t, "LeakyBucket")
}
3 changes: 0 additions & 3 deletions internal/rate/rate_nodev.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ import (
// LimiterKind returns the kind of rate limiter enabled by config.
// This function is used for release builds.
func LimiterKind(c *config.Config) (string, bool) {
if c.EnableLeakyBucketRateLimiter {
return LimitLeakyBucket, true
}
return "", false
}
Loading