Skip to content

Commit 0581420

Browse files
author
Mazhar Islam
committed
Added few more details in readme. Made result analyzer more flexible
1 parent 512b1ac commit 0581420

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

walkthroughs/howto-k8s-appmesh-load-test/README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,27 @@ export VPC_ID=<VPC ID of the cluster, can be found using: aws eks describe-clus
3535
## Step 3: Configuring the Load Test
3636
All parameters of the mesh, load tests, metrics can be specified in `config.json`
3737

38-
`backends_map` -: The mapping from each Virtual Node to its backend Virtual Services. For each unique node name in `backends_map`,
39-
a VirtualNode, Deployment, Service and VirtualService (with its VirtualNode as its target) are created at runtime.
40-
41-
`load_tests` -: Array of different test configurations that need to be run on the mesh. `url` is the service endpoint that Fortio (load generator) should hit.
42-
43-
`metrics` -: Map of metric_name to the corresponding metric PromQL logic
38+
* `backends_map` -: The mapping from each Virtual Node to its backend Virtual Services. For each unique node name in `backends_map`,
39+
a VirtualNode, Deployment, Service and VirtualService (with its VirtualNode as its target) are created at runtime. An example `backends_map` is following:
40+
```
41+
"backends_map": {
42+
"0": ["1", "2"],
43+
"1": ["3"],
44+
"2": ["4"]
45+
},
46+
```
47+
where the node names are `"0"`, `"1"`, `"2"`, `"3"` and `"4"`.
48+
49+
* `load_tests` -: Array of different test configurations that need to be run on the mesh.
50+
* `url`: is the service endpoint that Fortio (load generator) should hit. The `url` format is: `http://service-<virtual-node-name>.tls-e2e.svc.cluster.local:9080/`.
51+
For example, based on the above `backends_map`, if we want to send the load traffic to the first virtual node `"0"`, then the `ulr` will look like:
52+
`http://service-0.tls-e2e.svc.cluster.local:9080/`.
53+
* `qps`: Total Queries Per Seconds fortio sends to the endpoints.
54+
* `t`: How long the test will run.
55+
* `c`: Number of parallel simultaneous connections to the endpoints fortio hits.
56+
* Optionally, you can add more load generation parameter by following the [Forito documentation](https://github.com/fortio/fortio).
57+
58+
* `metrics` -: Map of metric_name to the corresponding metric [PromQL logic](https://prometheus.io/docs/prometheus/latest/querying/operators/).
4459

4560
## Step 4: Running the Load Test
4661
Run the driver script using the below command -:

walkthroughs/howto-k8s-appmesh-load-test/scripts/analyze_load_test_data.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
1515
DATA_PATH = os.path.join(DIR_PATH, 'data')
1616

17+
NODE_NAME = "0"
18+
1719

1820
def get_s3_data():
1921
res = subprocess.run(["aws sts get-caller-identity"], shell=True, stdout=subprocess.PIPE,
@@ -29,14 +31,14 @@ def get_s3_data():
2931

3032

3133
def plot_graph(actual_QPS_list, node_0_mem_list):
32-
Y = [x for _, x in sorted(zip(actual_QPS_list, node_0_mem_list))]
33-
X = sorted(actual_QPS_list)
34+
x_y_tuple = [(x, y) for x, y in sorted(zip(actual_QPS_list, node_0_mem_list))]
35+
X, Y = zip(*x_y_tuple)
3436
xpoints = np.array(X)
3537
ypoints = np.array(Y)
3638

3739
plt.figure(figsize=(10, 5))
3840
plt.bar(xpoints, ypoints, width=20)
39-
plt.ylabel('Node-0 (MiB)')
41+
plt.ylabel('Node-{} (MiB)'.format(NODE_NAME))
4042
plt.xlabel('Actual QPS')
4143
print("Plotting graph...")
4244
plt.show()
@@ -67,9 +69,13 @@ def read_load_test_data():
6769
with open(f) as csv_f:
6870
c = csv.reader(csv_f, delimiter=',', skipinitialspace=True)
6971
node_0_mem = []
72+
node_found = False
7073
for line in c:
71-
if "node-0" in line[0]:
74+
if "node-" + NODE_NAME in line[0]:
7275
node_0_mem.append(float(line[2]))
76+
node_found = True
77+
if not node_found:
78+
raise Exception("Node not found: {} in experiment file: {}".format(NODE_NAME, f))
7379
max_mem = max(node_0_mem)
7480
node_0_mem_list.append(max_mem)
7581
attrb["max_mem"] = max_mem
@@ -80,7 +86,7 @@ def read_load_test_data():
8086
sorted_experiment_results = OrderedDict()
8187
for k, v in sorted(experiment_results.items(), key=lambda item: item[1]['max_mem']):
8288
sorted_experiment_results[k] = v
83-
print("Experiment results sorted:\n")
89+
print("Experiment results sorted:")
8490
pprint(sorted_experiment_results)
8591

8692
return actual_qps_list, node_0_mem_list
@@ -93,5 +99,8 @@ def plot_qps_vs_container_mem():
9399

94100

95101
if __name__ == '__main__':
102+
node_name = input('Enter the node name (or press enter for default node "0"): ')
103+
if node_name != "":
104+
NODE_NAME = node_name
96105
get_s3_data()
97106
plot_qps_vs_container_mem()

walkthroughs/howto-k8s-appmesh-load-test/scripts/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
PROMETHEUS_QUERY_ENDPOINT = 'http://localhost:9090/api/v1/query_range'
88

99
# give your s3 bucket a unique name
10-
S3_BUCKET = "<username-appmeshloadtester"
10+
S3_BUCKET = "<username>-appmeshloadtester"

0 commit comments

Comments
 (0)