Skip to content

Commit

Permalink
add generic load test for L4 LB
Browse files Browse the repository at this point in the history
  • Loading branch information
freehan committed Apr 21, 2021
1 parent a397740 commit 94cdd57
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 0 deletions.
95 changes: 95 additions & 0 deletions clusterloader2/testing/l4lb/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# LOAD_BALANCER_BACKEND_SIZE specifies the number of backend pods behind each LB
{{$LOAD_BALANCER_BACKEND_SIZE := DefaultParam .CL2_LOAD_BALANCER_BACKEND_SIZE 5}}
# LOAD_BALANCER_REPLICAS specifies the number of Load balancer type service
{{$LOAD_BALANCER_REPLICAS := DefaultParam .CL2_LOAD_BALANCER_REPLICAS 3}}
# LOAD_BALANCER_TYPE specifies the type of L4 LB created. Valid values are "INTERNAL" and "EXTERNAL"
{{$LOAD_BALANCER_TYPE := DefaultParam .CL2_LOAD_BALANCER_TYPE "EXTERNAL"}}
# $EXTERNAL_TRAFFIC_POLICY specifies the externalTrafficPolicy on LB type service. Valid values are "Cluster" and "Local"
{{$EXTERNAL_TRAFFIC_POLICY := DefaultParam .CL2_EXTERNAL_TRAFFIC_POLICY "Cluster"}}
# $NODE_SYNC_TIMEOUT specifies the timeout to wait for nodesync to complete
{{$NODE_SYNC_TIMEOUT := DefaultParam .CL2_NODE_SYNC_TIMEOUT "30m"}}
# adding a fixed value for first version of the test, rate of pod creation not a concern yet.
{{$lbQPS := 20}}
{{$namespaces := 1}}

name: l4lbload
namespace:
number: {{$namespaces}}
tuningSets:
- name: LBConstantQPS
qpsLoad:
qps: {{$lbQPS}}
steps:
- name: Initialize Measurements
measurements:
- Identifier: LBServiceCreationLatency
Method: ServiceCreationLatency
Params:
action: start
labelSelector: test = l4lb-load
- Identifier: WaitForRunningDeployments
Method: WaitForControlledPodsRunning
Params:
action: start
apiVersion: apps/v1
kind: Deployment
labelSelector: test = l4lb-load
operationTimeout: 15m
- name: Creating LBs
phases:
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$LOAD_BALANCER_REPLICAS}}
tuningSet: LBConstantQPS
objectBundle:
- basename: lb-service
objectTemplatePath: service.yaml
templateFillMap:
DeploymentBaseName: lb-dep
ExternalTrafficPolicy: {{$EXTERNAL_TRAFFIC_POLICY}}
LoadBalancerType: {{$LOAD_BALANCER_TYPE}}
- basename: lb-dep
objectTemplatePath: dep.yaml
templateFillMap:
NumReplicas: {{$LOAD_BALANCER_BACKEND_SIZE}}
- name: Wait for LBs to be ready
measurements:
- Identifier: LBServiceCreationLatency
Method: ServiceCreationLatency
Params:
action: waitForReady
- Identifier: WaitForRunningDeployments
Method: WaitForControlledPodsRunning
Params:
action: gather
- name: Measure NodeSync latency
measurements:
- Identifier: NodeSyncLatency
Method: LoadBalancerNodeSyncLatency
Params:
action: measure
labelSelector: test = l4lb-load
waitTimeout: {{$NODE_SYNC_TIMEOUT}}
- name: Deleting LBs
phases:
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 0
tuningSet: LBConstantQPS
objectBundle:
- basename: lb-service
objectTemplatePath: service.yaml
- basename: lb-dep
objectTemplatePath: dep.yaml
- name: Gather Measurements
measurements:
- Identifier: LBServiceCreationLatency
Method: ServiceCreationLatency
Params:
action: gather
- Identifier: NodeSyncLatency
Method: LoadBalancerNodeSyncLatency
Params:
action: gather
22 changes: 22 additions & 0 deletions clusterloader2/testing/l4lb/dep.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{.Name}}
labels:
test: l4lb-load
spec:
replicas: {{.NumReplicas}}
selector:
matchLabels:
name: {{.Name}}
template:
metadata:
labels:
test: l4lb-load
name: {{.Name}}
spec:
containers:
- name: {{.Name}}
image: nginx
ports:
- containerPort: 80
16 changes: 16 additions & 0 deletions clusterloader2/testing/l4lb/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{.Name}}
labels:
test: l4lb-load
annotations:
networking.gke.io/load-balancer-type: {{.LoadBalancerType}}
spec:
externalTrafficPolicy: {{.ExternalTrafficPolicy}}
type: LoadBalancer
selector:
name: {{.DeploymentBaseName}}-{{.Index}}
ports:
- port: 80
targetPort: 80

0 comments on commit 94cdd57

Please sign in to comment.