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

Add throttling logic for createDoc, getDeltas, and connectDoc to provide per-cluster rate-limiting at the HTTP route level #13896

Merged
Merged
Show file tree
Hide file tree
Changes from 11 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
8 changes: 5 additions & 3 deletions server/BREAKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export class AlfredResources implements core.IResources {
public webSocketLibrary: string,
public orderManager: core.IOrdererManager,
public tenantManager: core.ITenantManager,
public restThrottler: core.IThrottler,
public restTenantThrottler: core.IThrottler,
public restClusterThrottlers: Map<string, core.IThrottler>,
public socketConnectThrottler: core.IThrottler,
public socketSubmitOpThrottler: core.IThrottler,
public socketSubmitSignalThrottler: core.IThrottler,
Expand All @@ -35,7 +36,7 @@ export class AlfredResources implements core.IResources {
public metricClientConfig: any,
public documentsCollection: core.ICollection<core.IDocument>,
public throttleAndUsageStorageManager?: core.IThrottleAndUsageStorageManager,
)
)
....

export class AlfredResourcesFactory implements core.IResourcesFactory<AlfredResources> {
Expand All @@ -49,7 +50,8 @@ export class AlfredResourcesFactory implements core.IResourcesFactory<AlfredReso
webSocketLibrary,
orderManager,
tenantManager,
restThrottler,
restTenantThrottler,
restClusterThrottler,
socketConnectThrottler,
socketSubmitOpThrottler,
socketSubmitSignalThrottler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,50 @@ data:
"numberOfMessagesPerTrace": {{ .Values.alfred.numberOfMessagesPerTrace }},
"sessionStickinessDurationMs": {{ .Values.alfred.sessionStickinessDurationMs }},
"throttling": {
"restCalls": {
"maxPerMs": {{ .Values.alfred.throttling.restCalls.maxPerMs }},
"maxBurst": {{ .Values.alfred.throttling.restCalls.maxBurst }},
"minCooldownIntervalInMs": {{ .Values.alfred.throttling.restCalls.minCooldownIntervalInMs }},
"minThrottleIntervalInMs": {{ .Values.alfred.throttling.restCalls.minThrottleIntervalInMs }},
"maxInMemoryCacheSize": {{ .Values.alfred.throttling.restCalls.maxInMemoryCacheSize }},
"maxInMemoryCacheAgeInMs": {{ .Values.alfred.throttling.restCalls.maxInMemoryCacheAgeInMs }},
"enableEnhancedTelemetry": {{ .Values.alfred.throttling.restCalls.enableEnhancedTelemetry }}
"restCallsPerTenant": {
"maxPerMs": {{ .Values.alfred.throttling.restCallsPerTenant.maxPerMs }},
"maxBurst": {{ .Values.alfred.throttling.restCallsPerTenant.maxBurst }},
"minCooldownIntervalInMs": {{ .Values.alfred.throttling.restCallsPerTenant.minCooldownIntervalInMs }},
"minThrottleIntervalInMs": {{ .Values.alfred.throttling.restCallsPerTenant.minThrottleIntervalInMs }},
"maxInMemoryCacheSize": {{ .Values.alfred.throttling.restCallsPerTenant.maxInMemoryCacheSize }},
"maxInMemoryCacheAgeInMs": {{ .Values.alfred.throttling.restCallsPerTenant.maxInMemoryCacheAgeInMs }},
"enableEnhancedTelemetry": {{ .Values.alfred.throttling.restCallsPerTenant.enableEnhancedTelemetry }}
},
"socketConnections": {
"maxPerMs": {{ .Values.alfred.throttling.socketConnections.maxPerMs }},
"maxBurst": {{ .Values.alfred.throttling.socketConnections.maxBurst }},
"minCooldownIntervalInMs": {{ .Values.alfred.throttling.socketConnections.minCooldownIntervalInMs }},
"minThrottleIntervalInMs": {{ .Values.alfred.throttling.socketConnections.minThrottleIntervalInMs }},
"maxInMemoryCacheSize": {{ .Values.alfred.throttling.socketConnections.maxInMemoryCacheSize }},
"maxInMemoryCacheAgeInMs": {{ .Values.alfred.throttling.socketConnections.maxInMemoryCacheAgeInMs }},
"enableEnhancedTelemetry": {{ .Values.alfred.throttling.socketConnections.enableEnhancedTelemetry }}
"restCallsCreateDoc": {
"maxPerMs": {{ .Values.alfred.throttling.restCallsCreateDoc.maxPerMs }},
"maxBurst": {{ .Values.alfred.throttling.restCallsCreateDoc.maxBurst }},
"minCooldownIntervalInMs": {{ .Values.alfred.throttling.restCallsCreateDoc.minCooldownIntervalInMs }},
"minThrottleIntervalInMs": {{ .Values.alfred.throttling.restCallsCreateDoc.minThrottleIntervalInMs }},
"maxInMemoryCacheSize": {{ .Values.alfred.throttling.restCallsCreateDoc.maxInMemoryCacheSize }},
"maxInMemoryCacheAgeInMs": {{ .Values.alfred.throttling.restCallsCreateDoc.maxInMemoryCacheAgeInMs }},
"enableEnhancedTelemetry": {{ .Values.alfred.throttling.restCallsCreateDoc.enableEnhancedTelemetry }}
},
"restCallsGetDeltas": {
"maxPerMs": {{ .Values.alfred.throttling.restCallsGetDeltas.maxPerMs }},
"maxBurst": {{ .Values.alfred.throttling.restCallsGetDeltas.maxBurst }},
"minCooldownIntervalInMs": {{ .Values.alfred.throttling.restCallsGetDeltas.minCooldownIntervalInMs }},
"minThrottleIntervalInMs": {{ .Values.alfred.throttling.restCallsGetDeltas.minThrottleIntervalInMs }},
"maxInMemoryCacheSize": {{ .Values.alfred.throttling.restCallsGetDeltas.maxInMemoryCacheSize }},
"maxInMemoryCacheAgeInMs": {{ .Values.alfred.throttling.restCallsGetDeltas.maxInMemoryCacheAgeInMs }},
"enableEnhancedTelemetry": {{ .Values.alfred.throttling.restCallsGetDeltas.enableEnhancedTelemetry }}
},
"socketConnectionsPerTenant": {
"maxPerMs": {{ .Values.alfred.throttling.socketConnectionsPerTenant.maxPerMs }},
"maxBurst": {{ .Values.alfred.throttling.socketConnectionsPerTenant.maxBurst }},
"minCooldownIntervalInMs": {{ .Values.alfred.throttling.socketConnectionsPerTenant.minCooldownIntervalInMs }},
"minThrottleIntervalInMs": {{ .Values.alfred.throttling.socketConnectionsPerTenant.minThrottleIntervalInMs }},
"maxInMemoryCacheSize": {{ .Values.alfred.throttling.socketConnectionsPerTenant.maxInMemoryCacheSize }},
"maxInMemoryCacheAgeInMs": {{ .Values.alfred.throttling.socketConnectionsPerTenant.maxInMemoryCacheAgeInMs }},
"enableEnhancedTelemetry": {{ .Values.alfred.throttling.socketConnectionsPerTenant.enableEnhancedTelemetry }}
},
"socketConnectionsPerCluster": {
"maxPerMs": {{ .Values.alfred.throttling.socketConnectionsPerCluster.maxPerMs }},
"maxBurst": {{ .Values.alfred.throttling.socketConnectionsPerCluster.maxBurst }},
"minCooldownIntervalInMs": {{ .Values.alfred.throttling.socketConnectionsPerCluster.minCooldownIntervalInMs }},
"minThrottleIntervalInMs": {{ .Values.alfred.throttling.socketConnectionsPerCluster.minThrottleIntervalInMs }},
"maxInMemoryCacheSize": {{ .Values.alfred.throttling.socketConnectionsPerCluster.maxInMemoryCacheSize }},
"maxInMemoryCacheAgeInMs": {{ .Values.alfred.throttling.socketConnectionsPerCluster.maxInMemoryCacheAgeInMs }},
"enableEnhancedTelemetry": {{ .Values.alfred.throttling.socketConnectionsPerCluster.enableEnhancedTelemetry }}
},
"submitOps": {
"maxPerMs": {{ .Values.alfred.throttling.submitOps.maxPerMs }},
Expand Down
28 changes: 26 additions & 2 deletions server/routerlicious/kubernetes/routerlicious/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,39 @@ alfred:
numberOfMessagesPerTrace: 100
sessionStickinessDurationMs: 3600000
throttling:
restCalls:
restCallsPerTenant:
maxPerMs: 1000000
maxBurst: 1000000
minCooldownIntervalInMs: 1000000
minThrottleIntervalInMs: 1000000
maxInMemoryCacheSize: 1000
maxInMemoryCacheAgeInMs: 60000
enableEnhancedTelemetry: false
socketConnections:
restCallsCreateDoc:
tianzhu007 marked this conversation as resolved.
Show resolved Hide resolved
maxPerMs: 1000000
maxBurst: 1000000
minCooldownIntervalInMs: 1000000
minThrottleIntervalInMs: 1000000
maxInMemoryCacheSize: 1000
maxInMemoryCacheAgeInMs: 60000
enableEnhancedTelemetry: false
restCallsGetDeltas:
maxPerMs: 1000000
maxBurst: 1000000
minCooldownIntervalInMs: 1000000
minThrottleIntervalInMs: 1000000
maxInMemoryCacheSize: 1000
maxInMemoryCacheAgeInMs: 60000
enableEnhancedTelemetry: false
socketConnectionsPerTenant:
maxPerMs: 1000000
maxBurst: 1000000
minCooldownIntervalInMs: 1000000
minThrottleIntervalInMs: 1000000
maxInMemoryCacheSize: 1000
maxInMemoryCacheAgeInMs: 60000
enableEnhancedTelemetry: false
socketConnectionsPerCluster:
maxPerMs: 1000000
maxBurst: 1000000
minCooldownIntervalInMs: 1000000
Expand Down
Loading