|
| 1 | +# Benchmark |
| 2 | +We use [spring-petclinic applications](https://github.com/spring-petclinic/spring-petclinic-microservices) as the benchmark application because it is relatively close to the real user scenario. |
| 3 | + |
| 4 | +We use three AWS EC2 machines in a subnet for the benchmark test: |
| 5 | + |
| 6 | +- Gateway EC2: deploy `api-gateway`, `config-service`, and `discovery-server` on this node. |
| 7 | +- Service EC2: deploy `customers-service`, `vets-service`, and `visits-service` on this node. |
| 8 | +- Tester EC2: we initiate testing requests and collect testing metric data on this node. |
| 9 | + |
| 10 | +All three AWS EC2 machines have the exact same configuration, and in a subnet: |
| 11 | +``` |
| 12 | +EC2 Instance Type: t3-large, cn-northwest-1c |
| 13 | +
|
| 14 | +CPU: 2 cores, Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz |
| 15 | +MEM: 7850092 kB |
| 16 | +SSD: XFS 100G |
| 17 | +
|
| 18 | +OS: CentOS Linux release 8.5.2111 |
| 19 | +Docker version 20.10.14, build a224086 |
| 20 | +docker-compose version 1.27.4, build 40524192 |
| 21 | +``` |
| 22 | + |
| 23 | +On Gateway EC2 node: |
| 24 | +``` |
| 25 | +# lunch up without EaseAgent |
| 26 | +env COMPOSER=gateway-compose EASEAGENT="" ./benchmark.sh start |
| 27 | +
|
| 28 | +# lunch up with EaseAgent |
| 29 | +env COMPOSER=gateway-compose EASEAGENT="true" ./benchmark.sh start |
| 30 | +
|
| 31 | +``` |
| 32 | + |
| 33 | +On Service EC2 node: |
| 34 | +``` |
| 35 | +# lunch up without EaseAgent |
| 36 | +env COMPOSER=service-compose EASEAGENT="" ./benchmark.sh start |
| 37 | +
|
| 38 | +# lunch up with EaseAgent |
| 39 | +env COMPOSER=service-compose EASEAGENT="true" ./benchmark.sh start |
| 40 | +
|
| 41 | +``` |
| 42 | + |
| 43 | +On Tester EC2 node, we start Grafana/Prometheus: |
| 44 | +``` |
| 45 | +env COMPOSER=benchmark-tester-compose EASEAGENT="" PROMETHEUS_CONFIG_FILE=prometheus_benchmark_2.yaml ./benchmark.sh start |
| 46 | +``` |
| 47 | + |
| 48 | +We run `k6` on `Tester` node to start stress test, and collect the metric data. |
| 49 | +``` |
| 50 | +k6 run vets.js |
| 51 | +``` |
| 52 | + |
| 53 | +Environment details of the test, reference to the document in [Easeagent-spring-petclinic](https://github.com/megaease/easeagent-spring-petclinic/blob/main/doc/benchmark.md). |
| 54 | + |
| 55 | +## Test Result |
| 56 | + |
| 57 | +We access the URI: `/api/vet/vets` of the application, it will generate 10-Spans in total, and distributed in two serivces: |
| 58 | +- jmx-api-gateway: 1 span; |
| 59 | +- jmx-vets: 9spans. |
| 60 | + |
| 61 | +By comparing the results of the two services, the impact of the number of SPANs can be observed. |
| 62 | + |
| 63 | +For each value pair in the table, the former is the baseline value and the latter is the agent value (baseline / agent / difference value). |
| 64 | + |
| 65 | +### 320 virtual users |
| 66 | + |
| 67 | +| URI-Label | CPU (baseline/agent/diff) | Heap Memory | P90 Latency | Throughput (15s) | |
| 68 | +|-------------------------|:-----------------------|:------------------|:----------------------------|-----------------------| |
| 69 | +| jmx-api-gateway: 1spans | 33.2% / 44.4% / 21.2% | 208M / 253M / 45M | | | |
| 70 | +| jmx-vets: 9spans | 40.2% / 65.2% / 25.0% | 236M / 284M / 48M | 28.94 ms / 189.39 ms / 553% | 1164 / 1057 / -9.2% | |
| 71 | + |
| 72 | +#### CPU |
| 73 | + |
| 74 | +| Label | jmx-api-gateway | jmx-vets | |
| 75 | +|-----------|:------------------|:----------------------| |
| 76 | +| Baseline | 33.2% | 40.2% | |
| 77 | +| Agent | 44.4% | 65.2% | |
| 78 | +| Diff | 21.2% | 25.0% | |
| 79 | + |
| 80 | +- Baseline: |
| 81 | + |
| 82 | + |
| 83 | +- Agent: |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +#### Heap |
| 88 | +- Baseline: |
| 89 | + |
| 90 | +- Agent: |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +#### Latency & Throuthput |
| 95 | + |
| 96 | +| Label | P90 Latency (ms) | Throughput (reqs/s) | |
| 97 | +|-----------|:------------------|:----------------------| |
| 98 | +| Baseline | 28.94 | 1164 | |
| 99 | +| Agent | 189.39 | 1057 | |
| 100 | + |
| 101 | +- Baseline |
| 102 | + |
| 103 | +``` |
| 104 | +running (11m40.4s), 000/320 VUs, 203885 complete and 0 interrupted iterations |
| 105 | +default ✓ [======================================] 000/320 VUs 11m40s |
| 106 | +
|
| 107 | + data_received..................: 637 MB 910 kB/s |
| 108 | + data_sent......................: 78 MB 111 kB/s |
| 109 | + http_req_blocked...............: avg=3.98µs min=687ns med=1.84µs max=13.63ms p(90)=3.44µs p(95)=4.86µs |
| 110 | + http_req_connecting............: avg=741ns min=0s med=0s max=13.58ms p(90)=0s p(95)=0s |
| 111 | +
|
| 112 | + http_req_duration..............: avg=14.2ms min=1.1ms med=7.83ms max=475.17ms p(90)=28.94ms p(95)=45.38ms |
| 113 | + { expected_response:true }...: avg=14.2ms min=1.1ms med=7.83ms max=475.17ms p(90)=28.94ms p(95)=45.38ms |
| 114 | +
|
| 115 | + http_req_failed................: 0.00% ✓ 0 ✗ 815540 |
| 116 | + http_req_receiving.............: avg=285.63µs min=8.6µs med=73.14µs max=89.64ms p(90)=462.23µs p(95)=889.81µs |
| 117 | + http_req_sending...............: avg=18.85µs min=3.83µs med=8.29µs max=54.16ms p(90)=16.14µs p(95)=22.15µs |
| 118 | + http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s |
| 119 | + http_req_waiting...............: avg=13.9ms min=1.04ms med=7.57ms max=475.02ms p(90)=28.36ms p(95)=44.63ms |
| 120 | +
|
| 121 | + http_reqs......................: 815540 1164.420944/s |
| 122 | +
|
| 123 | + iteration_duration.............: avg=1.02s min=1s med=1.01s max=1.47s p(90)=1.04s p(95)=1.06s |
| 124 | + iterations.....................: 203885 291.105236/s |
| 125 | + vus............................: 5 min=5 max=320 |
| 126 | + vus_max........................: 320 min=320 max=320 |
| 127 | +
|
| 128 | +``` |
| 129 | +- Agent |
| 130 | +``` |
| 131 | +running (11m40.8s), 000/320 VUs, 185219 complete and 0 interrupted iterations |
| 132 | +default ↓ [======================================] 005/320 VUs 11m40s |
| 133 | +
|
| 134 | + data_received..................: 579 MB 827 kB/s |
| 135 | + data_sent......................: 70 MB 100 kB/s |
| 136 | + http_req_blocked...............: avg=4.45µs min=700ns med=1.9µs max=71.05ms p(90)=3.47µs p(95)=4.51µs |
| 137 | + http_req_connecting............: avg=1.39µs min=0s med=0s max=70.99ms p(90)=0s p(95)=0s |
| 138 | +
|
| 139 | + http_req_duration..............: avg=75.71ms min=1.52ms med=38.65ms max=1.18s p(90)=189.39ms p(95)=275.46ms |
| 140 | + { expected_response:true }...: avg=75.71ms min=1.52ms med=38.65ms max=1.18s p(90)=189.39ms p(95)=275.46ms |
| 141 | +
|
| 142 | + http_req_failed................: 0.00% ✓ 0 ✗ 740876 |
| 143 | + http_req_receiving.............: avg=1.37ms min=9.07µs med=54.95µs max=333.25ms p(90)=1.44ms p(95)=6.48ms |
| 144 | + http_req_sending...............: avg=49.77µs min=3.85µs med=8.36µs max=228.08ms p(90)=16.97µs p(95)=23.34µs |
| 145 | + http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s |
| 146 | + http_req_waiting...............: avg=74.29ms min=1.47ms med=37.3ms max=1.18s p(90)=186.62ms p(95)=273.55ms |
| 147 | +
|
| 148 | + http_reqs......................: 740876 1057.248498/s |
| 149 | +
|
| 150 | + iteration_duration.............: avg=1.12s min=1s med=1.07s max=2.18s p(90)=1.3s p(95)=1.39s |
| 151 | + iterations.....................: 185219 264.312124/s |
| 152 | + vus............................: 5 min=5 max=320 |
| 153 | + vus_max........................: 320 min=320 max=320 |
| 154 | +
|
| 155 | +``` |
| 156 | + |
| 157 | +### 700 virtual users |
| 158 | + |
| 159 | +| URI-Label | CPU (baseline/agent/diff) | Heap Memory | P90 Latency | Throughput (15s) | |
| 160 | +|----------------------|:--------------------------|:-------------------|:----------------------------------|-----------------------| |
| 161 | +| jmx-api-gateway: 1spans | 57.5% / 61.1% / 3.6% | 385M / 583M / 200M | | | |
| 162 | +| jmx-vets: 9spans | 69.0% / 81.2% / 12.2% | 303M / 464M / 151M | 564.69 ms / 737.55 ms / 30% | 1800 / 1526 / -15.2% | |
| 163 | + |
| 164 | + |
| 165 | +- Process CPU Load: 3.6% - more than 10%, requiring optimisation, the number of span has a significant impact on CPU performance. |
| 166 | +- Heap Memory: requiring optimisation. |
| 167 | +- Latency & Throughput: Easeagent has an excessive impact on latency and throughput and is positively correlated with the number of Spans. |
| 168 | + |
| 169 | +CPU, Process CPU Load, collected through JMX:java_lang_OperatingSystem_ProcessCpuLoad. |
| 170 | + |
| 171 | +#### CPU |
| 172 | +| Label | jmx-api-gateway | jmx-vets | |
| 173 | +|-----------|:------------------|:----------------------| |
| 174 | +| Baseline | 57.5% | 69.0% | |
| 175 | +| Agent | 61.1% | 81.2% | |
| 176 | +| Diff | 3.60% | 12.2% | |
| 177 | + |
| 178 | +- Baseline: |
| 179 | + |
| 180 | + |
| 181 | +- Agent: |
| 182 | + |
| 183 | + |
| 184 | +#### Heap |
| 185 | + |
| 186 | +- Baseline: |
| 187 | + |
| 188 | +- Agent: |
| 189 | + |
| 190 | + |
| 191 | +#### Latency & Throuthput |
| 192 | +| Label | P90 Latency (ms) | Throughput (reqs/s) | |
| 193 | +|-----------|:------------------|:----------------------| |
| 194 | +| Baseline | 564.69 | 1800 | |
| 195 | +| Agent | 737.55 | 1526 | |
| 196 | + |
| 197 | +- Baseline: |
| 198 | +``` |
| 199 | +running (13m20.6s), 000/700 VUs, 360354 complete and 0 interrupted iterations |
| 200 | +default ↓ [======================================] 009/700 VUs 13m20s |
| 201 | +
|
| 202 | + data_received..................: 1.1 GB 1.4 MB/s |
| 203 | + data_sent......................: 137 MB 171 kB/s |
| 204 | + http_req_blocked...............: avg=6.6µs min=704ns med=1.88µs max=269.76ms p(90)=3.35µs p(95)=5.16µs |
| 205 | + http_req_connecting............: avg=3.22µs min=0s med=0s max=254.77ms p(90)=0s p(95)=0s |
| 206 | +
|
| 207 | + http_req_duration..............: avg=262.62ms min=1.19ms med=219.42ms max=1.58s p(90)=564.69ms p(95)=669.43ms |
| 208 | +
|
| 209 | + { expected_response:true }...: avg=262.62ms min=1.19ms med=219.42ms max=1.58s p(90)=564.69ms p(95)=669.43ms |
| 210 | + http_req_failed................: 0.00% ✓ 0 ✗ 1441416 |
| 211 | + http_req_receiving.............: avg=7.48ms min=8.94µs med=517.01µs max=480.89ms p(90)=17.64ms p(95)=38.22ms |
| 212 | + http_req_sending...............: avg=105.42µs min=3.72µs med=8.55µs max=236.91ms p(90)=20.64µs p(95)=37.64µs |
| 213 | + http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s |
| 214 | + http_req_waiting...............: avg=255.03ms min=1.12ms med=208.8ms max=1.58s p(90)=554.48ms p(95)=661.33ms |
| 215 | +
|
| 216 | + http_reqs......................: 1441416 1800.434166/s |
| 217 | +
|
| 218 | + iteration_duration.............: avg=1.37s min=1s med=1.36s max=2.69s p(90)=1.74s p(95)=1.86s |
| 219 | + iterations.....................: 360354 450.108541/s |
| 220 | + vus............................: 9 min=5 max=700 |
| 221 | + vus_max........................: 700 min=700 max=700 |
| 222 | +
|
| 223 | +``` |
| 224 | + |
| 225 | +- Agent |
| 226 | +``` |
| 227 | +running (13m20.9s), 000/700 VUs, 305670 complete and 0 interrupted iterations |
| 228 | +default ✓ [======================================] 000/700 VUs 13m20s |
| 229 | +
|
| 230 | + data_received..................: 956 MB 1.2 MB/s |
| 231 | + data_sent......................: 116 MB 145 kB/s |
| 232 | + http_req_blocked...............: avg=11.59µs min=688ns med=1.94µs max=399.48ms p(90)=3.48µs p(95)=4.62µs |
| 233 | + http_req_connecting............: avg=6.21µs min=0s med=0s max=217.13ms p(90)=0s p(95)=0s |
| 234 | +
|
| 235 | + http_req_duration..............: avg=360.83ms min=1.45ms med=252.27ms max=7.99s p(90)=737.55ms p(95)=1.04s |
| 236 | +
|
| 237 | + { expected_response:true }...: avg=360.83ms min=1.45ms med=252.27ms max=7.99s p(90)=737.55ms p(95)=1.04s |
| 238 | + http_req_failed................: 0.00% ✓ 0 ✗ 1222680 |
| 239 | + http_req_receiving.............: avg=4.88ms min=9.14µs med=51.6µs max=887.76ms p(90)=10.7ms p(95)=28.04ms |
| 240 | + http_req_sending...............: avg=193.63µs min=3.72µs med=8.54µs max=756.82ms p(90)=19.57µs p(95)=44.94µs |
| 241 | + http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s |
| 242 | + http_req_waiting...............: avg=355.75ms min=1.36ms med=248.41ms max=7.99s p(90)=727.94ms p(95)=1.03s |
| 243 | +
|
| 244 | + http_reqs......................: 1222680 1526.574647/s |
| 245 | +
|
| 246 | + iteration_duration.............: avg=1.62s min=1s med=1.41s max=8.99s p(90)=2.36s p(95)=2.76s |
| 247 | + iterations.....................: 305670 381.643662/s |
| 248 | + vus............................: 6 min=5 max=700 |
| 249 | + vus_max........................: 700 min=700 max=700 |
| 250 | +``` |
| 251 | + |
| 252 | + |
| 253 | + |
| 254 | +## Conclusion |
| 255 | + |
| 256 | +**Optimization is required in terms of CPU efficiency/memory usage and latency throughput.** |
| 257 | + |
0 commit comments