-
Notifications
You must be signed in to change notification settings - Fork 2
397 lines (348 loc) · 32.1 KB
/
benchmark.yml
File metadata and controls
397 lines (348 loc) · 32.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
name: 性能测试
on:
# 允许手动触发
workflow_dispatch:
# 在推送代码到主分支时触发
push:
branches: [ master ]
# 在创建 pull request 时触发
pull_request:
branches: [ master ]
jobs:
benchmark:
runs-on: ubuntu-latest
services:
# 启动 Redis 服务
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# 检出代码
- name: 检出代码
uses: actions/checkout@v4
# 设置 Java 环境
- name: 设置 Java 环境
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'
# 编译项目
- name: 编译项目
run: mvn compile
# 运行 Redisun、Redisson、Jedis 和 Lettuce 性能测试 (1 client)
- name: 运行性能测试 (1 client)
run: |
echo "Running Redisun vs Redisson vs Jedis vs Lettuce benchmark tests with 1 client..."
echo "Running Redisun benchmark with 1 client..."
mvn test -Dtest=RedisunBenchmark -Dclient.count=1 > redisun_1.log 2>&1 || true
echo "Running Redisson benchmark with 1 client..."
mvn test -Dtest=RedissonBenchmark -Dclient.count=1 > redisson_1.log 2>&1 || true
echo "Running Jedis benchmark with 1 client..."
mvn test -Dtest=JedisBenchmark -Dclient.count=1 > jedis_1.log 2>&1 || true
echo "Running Lettuce benchmark with 1 client..."
mvn test -Dtest=LettuceBenchmark -Dclient.count=1 > lettuce_1.log 2>&1 || true
# 运行 Redisun、Redisson、Jedis 和 Lettuce 性能测试 (8 clients)
- name: 运行性能测试 (8 clients)
run: |
echo "Running Redisun vs Redisson vs Jedis vs Lettuce benchmark tests with 8 clients..."
echo "Running Redisun benchmark with 8 clients..."
mvn test -Dtest=RedisunBenchmark -Dclient.count=8 > redisun_8.log 2>&1 || true
echo "Running Redisson benchmark with 8 clients..."
mvn test -Dtest=RedissonBenchmark -Dclient.count=8 > redisson_8.log 2>&1 || true
echo "Running Jedis benchmark with 8 clients..."
mvn test -Dtest=JedisBenchmark -Dclient.count=8 > jedis_8.log 2>&1 || true
echo "Running Lettuce benchmark with 8 clients..."
mvn test -Dtest=LettuceBenchmark -Dclient.count=8 > lettuce_8.log 2>&1 || true
# 运行 Redisun、Redisson、Jedis 和 Lettuce 性能测试 (128 clients)
- name: 运行性能测试 (128 clients)
run: |
echo "Running Redisun vs Redisson vs Jedis vs Lettuce benchmark tests with 128 clients..."
echo "Running Redisun benchmark with 128 clients..."
mvn test -Dtest=RedisunBenchmark -Dclient.count=128 > redisun_128.log 2>&1 || true
echo "Running Redisson benchmark with 128 clients..."
mvn test -Dtest=RedissonBenchmark -Dclient.count=128 > redisson_128.log 2>&1 || true
echo "Running Jedis benchmark with 128 clients..."
mvn test -Dtest=JedisBenchmark -Dclient.count=128 > jedis_128.log 2>&1 || true
echo "Running Lettuce benchmark with 128 clients..."
mvn test -Dtest=LettuceBenchmark -Dclient.count=128 > lettuce_128.log 2>&1 || true
# 运行 Redisun、Redisson、Jedis 和 Lettuce 性能测试 (1024 clients)
- name: 运行性能测试 (1024 clients)
run: |
echo "Running Redisun vs Redisson vs Jedis vs Lettuce benchmark tests with 1024 clients..."
echo "Running Redisun benchmark with 1024 clients..."
mvn test -Dtest=RedisunBenchmark -Dclient.count=1024 > redisun_1024.log 2>&1 || true
echo "Running Redisson benchmark with 1024 clients..."
mvn test -Dtest=RedissonBenchmark -Dclient.count=1024 > redisson_1024.log 2>&1 || true
echo "Running Jedis benchmark with 1024 clients..."
mvn test -Dtest=JedisBenchmark -Dclient.count=1024 > jedis_1024.log 2>&1 || true
echo "Running Lettuce benchmark with 1024 clients..."
mvn test -Dtest=LettuceBenchmark -Dclient.count=1024 > lettuce_1024.log 2>&1 || true
# 提取测试结果
- name: 提取测试结果
run: |
echo "# Redisun vs Redisson vs Jedis vs Lettuce 性能测试报告" > benchmark-report.md
echo "测试时间: $(date)" >> benchmark-report.md
echo "" >> benchmark-report.md
echo "## 测试环境" >> benchmark-report.md
echo "- 操作系统: Ubuntu 20.04" >> benchmark-report.md
echo "- Java 版本: JDK 8" >> benchmark-report.md
echo "- Redis 版本: latest" >> benchmark-report.md
echo "- 测试键数量: 50000" >> benchmark-report.md
echo "" >> benchmark-report.md
echo "## 同步SET性能对比" >> benchmark-report.md
echo "| 客户端数量 | Redisun耗时 | Redisson耗时 | Jedis耗时 | Lettuce耗时 | Redisun OPS | Redisson OPS | Jedis OPS | Lettuce OPS |" >> benchmark-report.md
echo "|------------|-------------|--------------|-----------|-------------|-------------|--------------|-----------|-------------|" >> benchmark-report.md
# 1 client 同步SET
if grep -q "\[CONCURRENT SET\] redisun cost:" redisun_1.log && grep -q "\[CONCURRENT SET\] redisson cost:" redisson_1.log && grep -q "\[CONCURRENT SET\] jedis cost:" jedis_1.log && grep -q "\[CONCURRENT SET\] lettuce cost:" lettuce_1.log; then
redisun_concurrent_set_time_1=$(grep "\[CONCURRENT SET\] redisun cost:" redisun_1.log | awk '{print $5}')
redisun_concurrent_set_ops_1=$(grep "\[CONCURRENT SET\] redisun ops/s:" redisun_1.log | awk '{print $5}')
redisson_concurrent_set_time_1=$(grep "\[CONCURRENT SET\] redisson cost:" redisson_1.log | awk '{print $5}')
redisson_concurrent_set_ops_1=$(grep "\[CONCURRENT SET\] redisson ops/s:" redisson_1.log | awk '{print $5}')
jedis_concurrent_set_time_1=$(grep "\[CONCURRENT SET\] jedis cost:" jedis_1.log | awk '{print $5}')
jedis_concurrent_set_ops_1=$(grep "\[CONCURRENT SET\] jedis ops/s:" jedis_1.log | awk '{print $5}')
lettuce_concurrent_set_time_1=$(grep "\[CONCURRENT SET\] lettuce cost:" lettuce_1.log | awk '{print $5}')
lettuce_concurrent_set_ops_1=$(grep "\[CONCURRENT SET\] lettuce ops/s:" lettuce_1.log | awk '{print $5}')
echo "| 1 | ${redisun_concurrent_set_time_1} | ${redisson_concurrent_set_time_1} | ${jedis_concurrent_set_time_1} | ${lettuce_concurrent_set_time_1} | ${redisun_concurrent_set_ops_1} | ${redisson_concurrent_set_ops_1} | ${jedis_concurrent_set_ops_1} | ${lettuce_concurrent_set_ops_1} |" >> benchmark-report.md
else
echo "| 1 | 测试失败 | 测试失败 | 测试失败 | 测试失败 | N/A | N/A | N/A | N/A |" >> benchmark-report.md
fi
# 8 clients 同步SET
if grep -q "\[CONCURRENT SET\] redisun cost:" redisun_8.log && grep -q "\[CONCURRENT SET\] redisson cost:" redisson_8.log && grep -q "\[CONCURRENT SET\] jedis cost:" jedis_8.log && grep -q "\[CONCURRENT SET\] lettuce cost:" lettuce_8.log; then
redisun_concurrent_set_time_8=$(grep "\[CONCURRENT SET\] redisun cost:" redisun_8.log | awk '{print $5}')
redisun_concurrent_set_ops_8=$(grep "\[CONCURRENT SET\] redisun ops/s:" redisun_8.log | awk '{print $5}')
redisson_concurrent_set_time_8=$(grep "\[CONCURRENT SET\] redisson cost:" redisson_8.log | awk '{print $5}')
redisson_concurrent_set_ops_8=$(grep "\[CONCURRENT SET\] redisson ops/s:" redisson_8.log | awk '{print $5}')
jedis_concurrent_set_time_8=$(grep "\[CONCURRENT SET\] jedis cost:" jedis_8.log | awk '{print $5}')
jedis_concurrent_set_ops_8=$(grep "\[CONCURRENT SET\] jedis ops/s:" jedis_8.log | awk '{print $5}')
lettuce_concurrent_set_time_8=$(grep "\[CONCURRENT SET\] lettuce cost:" lettuce_8.log | awk '{print $5}')
lettuce_concurrent_set_ops_8=$(grep "\[CONCURRENT SET\] lettuce ops/s:" lettuce_8.log | awk '{print $5}')
echo "| 8 | ${redisun_concurrent_set_time_8} | ${redisson_concurrent_set_time_8} | ${jedis_concurrent_set_time_8} | ${lettuce_concurrent_set_time_8} | ${redisun_concurrent_set_ops_8} | ${redisson_concurrent_set_ops_8} | ${jedis_concurrent_set_ops_8} | ${lettuce_concurrent_set_ops_8} |" >> benchmark-report.md
else
echo "| 8 | 测试失败 | 测试失败 | 测试失败 | 测试失败 | N/A | N/A | N/A | N/A |" >> benchmark-report.md
fi
# 128 clients 同步SET
if grep -q "\[CONCURRENT SET\] redisun cost:" redisun_128.log && grep -q "\[CONCURRENT SET\] redisson cost:" redisson_128.log && grep -q "\[CONCURRENT SET\] jedis cost:" jedis_128.log && grep -q "\[CONCURRENT SET\] lettuce cost:" lettuce_128.log; then
redisun_concurrent_set_time_128=$(grep "\[CONCURRENT SET\] redisun cost:" redisun_128.log | awk '{print $5}')
redisun_concurrent_set_ops_128=$(grep "\[CONCURRENT SET\] redisun ops/s:" redisun_128.log | awk '{print $5}')
redisson_concurrent_set_time_128=$(grep "\[CONCURRENT SET\] redisson cost:" redisson_128.log | awk '{print $5}')
redisson_concurrent_set_ops_128=$(grep "\[CONCURRENT SET\] redisson ops/s:" redisson_128.log | awk '{print $5}')
jedis_concurrent_set_time_128=$(grep "\[CONCURRENT SET\] jedis cost:" jedis_128.log | awk '{print $5}')
jedis_concurrent_set_ops_128=$(grep "\[CONCURRENT SET\] jedis ops/s:" jedis_128.log | awk '{print $5}')
lettuce_concurrent_set_time_128=$(grep "\[CONCURRENT SET\] lettuce cost:" lettuce_128.log | awk '{print $5}')
lettuce_concurrent_set_ops_128=$(grep "\[CONCURRENT SET\] lettuce ops/s:" lettuce_128.log | awk '{print $5}')
echo "| 128 | ${redisun_concurrent_set_time_128} | ${redisson_concurrent_set_time_128} | ${jedis_concurrent_set_time_128} | ${lettuce_concurrent_set_time_128} | ${redisun_concurrent_set_ops_128} | ${redisson_concurrent_set_ops_128} | ${jedis_concurrent_set_ops_128} | ${lettuce_concurrent_set_ops_128} |" >> benchmark-report.md
else
echo "| 128 | 测试失败 | 测试失败 | 测试失败 | 测试失败 | N/A | N/A | N/A | N/A |" >> benchmark-report.md
fi
# 1024 clients 同步SET
if grep -q "\[CONCURRENT SET\] redisun cost:" redisun_1024.log && grep -q "\[CONCURRENT SET\] redisson cost:" redisson_1024.log && grep -q "\[CONCURRENT SET\] jedis cost:" jedis_1024.log && grep -q "\[CONCURRENT SET\] lettuce cost:" lettuce_1024.log; then
redisun_concurrent_set_time_1024=$(grep "\[CONCURRENT SET\] redisun cost:" redisun_1024.log | awk '{print $5}')
redisun_concurrent_set_ops_1024=$(grep "\[CONCURRENT SET\] redisun ops/s:" redisun_1024.log | awk '{print $5}')
redisson_concurrent_set_time_1024=$(grep "\[CONCURRENT SET\] redisson cost:" redisson_1024.log | awk '{print $5}')
redisson_concurrent_set_ops_1024=$(grep "\[CONCURRENT SET\] redisson ops/s:" redisson_1024.log | awk '{print $5}')
jedis_concurrent_set_time_1024=$(grep "\[CONCURRENT SET\] jedis cost:" jedis_1024.log | awk '{print $5}')
jedis_concurrent_set_ops_1024=$(grep "\[CONCURRENT SET\] jedis ops/s:" jedis_1024.log | awk '{print $5}')
lettuce_concurrent_set_time_1024=$(grep "\[CONCURRENT SET\] lettuce cost:" lettuce_1024.log | awk '{print $5}')
lettuce_concurrent_set_ops_1024=$(grep "\[CONCURRENT SET\] lettuce ops/s:" lettuce_1024.log | awk '{print $5}')
echo "| 1024 | ${redisun_concurrent_set_time_1024} | ${redisson_concurrent_set_time_1024} | ${jedis_concurrent_set_time_1024} | ${lettuce_concurrent_set_time_1024} | ${redisun_concurrent_set_ops_1024} | ${redisson_concurrent_set_ops_1024} | ${jedis_concurrent_set_ops_1024} | ${lettuce_concurrent_set_ops_1024} |" >> benchmark-report.md
else
echo "| 1024 | 测试失败 | 测试失败 | 测试失败 | 测试失败 | N/A | N/A | N/A | N/A |" >> benchmark-report.md
fi
echo "" >> benchmark-report.md
echo "## 异步SET性能对比" >> benchmark-report.md
echo "| 客户端数量 | Redisun耗时 | Redisson耗时 | Jedis耗时 | Lettuce耗时 | Redisun OPS | Redisson OPS | Jedis OPS | Lettuce OPS |" >> benchmark-report.md
echo "|------------|-------------|--------------|-----------|-------------|-------------|--------------|-----------|-------------|" >> benchmark-report.md
# 1 client 异步SET
if grep -q "\[ASYNC SET\] redisun cost:" redisun_1.log && grep -q "\[ASYNC SET\] redisson cost:" redisson_1.log; then
redisun_async_set_time_1=$(grep "\[ASYNC SET\] redisun cost:" redisun_1.log | awk '{print $5}')
redisun_async_set_ops_1=$(grep "\[ASYNC SET\] redisun ops/s:" redisun_1.log | awk '{print $5}')
redisson_async_set_time_1=$(grep "\[ASYNC SET\] redisson cost:" redisson_1.log | awk '{print $5}')
redisson_async_set_ops_1=$(grep "\[ASYNC SET\] redisson ops/s:" redisson_1.log | awk '{print $5}')
jedis_async_set_time_1="-"
jedis_async_set_ops_1="-"
lettuce_async_set_time_1=$(grep "\[ASYNC SET\] lettuce cost:" lettuce_1.log | awk '{print $5}' 2>/dev/null || echo "-")
lettuce_async_set_ops_1=$(grep "\[ASYNC SET\] lettuce ops/s:" lettuce_1.log | awk '{print $5}' 2>/dev/null || echo "-")
echo "| 1 | ${redisun_async_set_time_1} | ${redisson_async_set_time_1} | ${jedis_async_set_time_1} | ${lettuce_async_set_time_1} | ${redisun_async_set_ops_1} | ${redisson_async_set_ops_1} | ${jedis_async_set_ops_1} | ${lettuce_async_set_ops_1} |" >> benchmark-report.md
else
echo "| 1 | 测试失败 | 测试失败 | - | 测试失败 | N/A | N/A | - | N/A |" >> benchmark-report.md
fi
# 8 clients 异步SET
if grep -q "\[ASYNC SET\] redisun cost:" redisun_8.log && grep -q "\[ASYNC SET\] redisson cost:" redisson_8.log; then
redisun_async_set_time_8=$(grep "\[ASYNC SET\] redisun cost:" redisun_8.log | awk '{print $5}')
redisun_async_set_ops_8=$(grep "\[ASYNC SET\] redisun ops/s:" redisun_8.log | awk '{print $5}')
redisson_async_set_time_8=$(grep "\[ASYNC SET\] redisson cost:" redisson_8.log | awk '{print $5}')
redisson_async_set_ops_8=$(grep "\[ASYNC SET\] redisson ops/s:" redisson_8.log | awk '{print $5}')
jedis_async_set_time_8="-"
jedis_async_set_ops_8="-"
lettuce_async_set_time_8=$(grep "\[ASYNC SET\] lettuce cost:" lettuce_8.log | awk '{print $5}' 2>/dev/null || echo "-")
lettuce_async_set_ops_8=$(grep "\[ASYNC SET\] lettuce ops/s:" lettuce_8.log | awk '{print $5}' 2>/dev/null || echo "-")
echo "| 8 | ${redisun_async_set_time_8} | ${redisson_async_set_time_8} | ${jedis_async_set_time_8} | ${lettuce_async_set_time_8} | ${redisun_async_set_ops_8} | ${redisson_async_set_ops_8} | ${jedis_async_set_ops_8} | ${lettuce_async_set_ops_8} |" >> benchmark-report.md
else
echo "| 8 | 测试失败 | 测试失败 | - | 测试失败 | N/A | N/A | - | N/A |" >> benchmark-report.md
fi
# 128 clients 异步SET
if grep -q "\[ASYNC SET\] redisun cost:" redisun_128.log && grep -q "\[ASYNC SET\] redisson cost:" redisson_128.log && grep -q "\[ASYNC SET\] lettuce cost:" lettuce_128.log; then
redisun_async_set_time_128=$(grep "\[ASYNC SET\] redisun cost:" redisun_128.log | awk '{print $5}')
redisun_async_set_ops_128=$(grep "\[ASYNC SET\] redisun ops/s:" redisun_128.log | awk '{print $5}')
redisson_async_set_time_128=$(grep "\[ASYNC SET\] redisson cost:" redisson_128.log | awk '{print $5}')
redisson_async_set_ops_128=$(grep "\[ASYNC SET\] redisson ops/s:" redisson_128.log | awk '{print $5}')
jedis_async_set_time_128="-"
jedis_async_set_ops_128="-"
lettuce_async_set_time_128=$(grep "\[ASYNC SET\] lettuce cost:" lettuce_128.log | awk '{print $5}')
lettuce_async_set_ops_128=$(grep "\[ASYNC SET\] lettuce ops/s:" lettuce_128.log | awk '{print $5}')
echo "| 128 | ${redisun_async_set_time_128} | ${redisson_async_set_time_128} | ${jedis_async_set_time_128} | ${lettuce_async_set_time_128} | ${redisun_async_set_ops_128} | ${redisson_async_set_ops_128} | ${jedis_async_set_ops_128} | ${lettuce_async_set_ops_128} |" >> benchmark-report.md
else
echo "| 128 | 测试失败 | 测试失败 | - | 测试失败 | N/A | N/A | - | N/A |" >> benchmark-report.md
fi
# 1024 clients 异步SET
if grep -q "\[ASYNC SET\] redisun cost:" redisun_1024.log && grep -q "\[ASYNC SET\] redisson cost:" redisson_1024.log && grep -q "\[ASYNC SET\] lettuce cost:" lettuce_1024.log; then
redisun_async_set_time_1024=$(grep "\[ASYNC SET\] redisun cost:" redisun_1024.log | awk '{print $5}')
redisun_async_set_ops_1024=$(grep "\[ASYNC SET\] redisun ops/s:" redisun_1024.log | awk '{print $5}')
redisson_async_set_time_1024=$(grep "\[ASYNC SET\] redisson cost:" redisson_1024.log | awk '{print $5}')
redisson_async_set_ops_1024=$(grep "\[ASYNC SET\] redisson ops/s:" redisson_1024.log | awk '{print $5}')
jedis_async_set_time_1024="-"
jedis_async_set_ops_1024="-"
lettuce_async_set_time_1024=$(grep "\[ASYNC SET\] lettuce cost:" lettuce_1024.log | awk '{print $5}')
lettuce_async_set_ops_1024=$(grep "\[ASYNC SET\] lettuce ops/s:" lettuce_1024.log | awk '{print $5}')
echo "| 1024 | ${redisun_async_set_time_1024} | ${redisson_async_set_time_1024} | ${jedis_async_set_time_1024} | ${lettuce_async_set_time_1024} | ${redisun_async_set_ops_1024} | ${redisson_async_set_ops_1024} | ${jedis_async_set_ops_1024} | ${lettuce_async_set_ops_1024} |" >> benchmark-report.md
else
echo "| 1024 | 测试失败 | 测试失败 | - | 测试失败 | N/A | N/A | - | N/A |" >> benchmark-report.md
fi
echo "" >> benchmark-report.md
echo "## 同步GET性能对比" >> benchmark-report.md
echo "| 客户端数量 | Redisun耗时 | Redisson耗时 | Jedis耗时 | Lettuce耗时 | Redisun OPS | Redisson OPS | Jedis OPS | Lettuce OPS |" >> benchmark-report.md
echo "|------------|-------------|--------------|-----------|-------------|-------------|--------------|-----------|-------------|" >> benchmark-report.md
# 1 client 同步GET
if grep -q "\[CONCURRENT GET\] redisun cost:" redisun_1.log && grep -q "\[CONCURRENT GET\] redisson cost:" redisson_1.log && grep -q "\[CONCURRENT GET\] jedis cost:" jedis_1.log && grep -q "\[CONCURRENT GET\] lettuce cost:" lettuce_1.log; then
redisun_concurrent_get_time_1=$(grep "\[CONCURRENT GET\] redisun cost:" redisun_1.log | awk '{print $5}')
redisun_concurrent_get_ops_1=$(grep "\[CONCURRENT GET\] redisun ops/s:" redisun_1.log | awk '{print $5}')
redisson_concurrent_get_time_1=$(grep "\[CONCURRENT GET\] redisson cost:" redisson_1.log | awk '{print $5}')
redisson_concurrent_get_ops_1=$(grep "\[CONCURRENT GET\] redisson ops/s:" redisson_1.log | awk '{print $5}')
jedis_concurrent_get_time_1=$(grep "\[CONCURRENT GET\] jedis cost:" jedis_1.log | awk '{print $5}')
jedis_concurrent_get_ops_1=$(grep "\[CONCURRENT GET\] jedis ops/s:" jedis_1.log | awk '{print $5}')
lettuce_concurrent_get_time_1=$(grep "\[CONCURRENT GET\] lettuce cost:" lettuce_1.log | awk '{print $5}')
lettuce_concurrent_get_ops_1=$(grep "\[CONCURRENT GET\] lettuce ops/s:" lettuce_1.log | awk '{print $5}')
echo "| 1 | ${redisun_concurrent_get_time_1} | ${redisson_concurrent_get_time_1} | ${jedis_concurrent_get_time_1} | ${lettuce_concurrent_get_time_1} | ${redisun_concurrent_get_ops_1} | ${redisson_concurrent_get_ops_1} | ${jedis_concurrent_get_ops_1} | ${lettuce_concurrent_get_ops_1} |" >> benchmark-report.md
else
echo "| 1 | 测试失败 | 测试失败 | 测试失败 | 测试失败 | N/A | N/A | N/A | N/A |" >> benchmark-report.md
fi
# 8 clients 同步GET
if grep -q "\[CONCURRENT GET\] redisun cost:" redisun_8.log && grep -q "\[CONCURRENT GET\] redisson cost:" redisson_8.log && grep -q "\[CONCURRENT GET\] jedis cost:" jedis_8.log && grep -q "\[CONCURRENT GET\] lettuce cost:" lettuce_8.log; then
redisun_concurrent_get_time_8=$(grep "\[CONCURRENT GET\] redisun cost:" redisun_8.log | awk '{print $5}')
redisun_concurrent_get_ops_8=$(grep "\[CONCURRENT GET\] redisun ops/s:" redisun_8.log | awk '{print $5}')
redisson_concurrent_get_time_8=$(grep "\[CONCURRENT GET\] redisson cost:" redisson_8.log | awk '{print $5}')
redisson_concurrent_get_ops_8=$(grep "\[CONCURRENT GET\] redisson ops/s:" redisson_8.log | awk '{print $5}')
jedis_concurrent_get_time_8=$(grep "\[CONCURRENT GET\] jedis cost:" jedis_8.log | awk '{print $5}')
jedis_concurrent_get_ops_8=$(grep "\[CONCURRENT GET\] jedis ops/s:" jedis_8.log | awk '{print $5}')
lettuce_concurrent_get_time_8=$(grep "\[CONCURRENT GET\] lettuce cost:" lettuce_8.log | awk '{print $5}')
lettuce_concurrent_get_ops_8=$(grep "\[CONCURRENT GET\] lettuce ops/s:" lettuce_8.log | awk '{print $5}')
echo "| 8 | ${redisun_concurrent_get_time_8} | ${redisson_concurrent_get_time_8} | ${jedis_concurrent_get_time_8} | ${lettuce_concurrent_get_time_8} | ${redisun_concurrent_get_ops_8} | ${redisson_concurrent_get_ops_8} | ${jedis_concurrent_get_ops_8} | ${lettuce_concurrent_get_ops_8} |" >> benchmark-report.md
else
echo "| 8 | 测试失败 | 测试失败 | 测试失败 | 测试失败 | N/A | N/A | N/A | N/A |" >> benchmark-report.md
fi
# 128 clients 同步GET
if grep -q "\[CONCURRENT GET\] redisun cost:" redisun_128.log && grep -q "\[CONCURRENT GET\] redisson cost:" redisson_128.log && grep -q "\[CONCURRENT GET\] jedis cost:" jedis_128.log && grep -q "\[CONCURRENT GET\] lettuce cost:" lettuce_128.log; then
redisun_concurrent_get_time_128=$(grep "\[CONCURRENT GET\] redisun cost:" redisun_128.log | awk '{print $5}')
redisun_concurrent_get_ops_128=$(grep "\[CONCURRENT GET\] redisun ops/s:" redisun_128.log | awk '{print $5}')
redisson_concurrent_get_time_128=$(grep "\[CONCURRENT GET\] redisson cost:" redisson_128.log | awk '{print $5}')
redisson_concurrent_get_ops_128=$(grep "\[CONCURRENT GET\] redisson ops/s:" redisson_128.log | awk '{print $5}')
jedis_concurrent_get_time_128=$(grep "\[CONCURRENT GET\] jedis cost:" jedis_128.log | awk '{print $5}')
jedis_concurrent_get_ops_128=$(grep "\[CONCURRENT GET\] jedis ops/s:" jedis_128.log | awk '{print $5}')
lettuce_concurrent_get_time_128=$(grep "\[CONCURRENT GET\] lettuce cost:" lettuce_128.log | awk '{print $5}')
lettuce_concurrent_get_ops_128=$(grep "\[CONCURRENT GET\] lettuce ops/s:" lettuce_128.log | awk '{print $5}')
echo "| 128 | ${redisun_concurrent_get_time_128} | ${redisson_concurrent_get_time_128} | ${jedis_concurrent_get_time_128} | ${lettuce_concurrent_get_time_128} | ${redisun_concurrent_get_ops_128} | ${redisson_concurrent_get_ops_128} | ${jedis_concurrent_get_ops_128} | ${lettuce_concurrent_get_ops_128} |" >> benchmark-report.md
else
echo "| 128 | 测试失败 | 测试失败 | 测试失败 | 测试失败 | N/A | N/A | N/A | N/A |" >> benchmark-report.md
fi
# 1024 clients 同步GET
if grep -q "\[CONCURRENT GET\] redisun cost:" redisun_1024.log && grep -q "\[CONCURRENT GET\] redisson cost:" redisson_1024.log && grep -q "\[CONCURRENT GET\] jedis cost:" jedis_1024.log && grep -q "\[CONCURRENT GET\] lettuce cost:" lettuce_1024.log; then
redisun_concurrent_get_time_1024=$(grep "\[CONCURRENT GET\] redisun cost:" redisun_1024.log | awk '{print $5}')
redisun_concurrent_get_ops_1024=$(grep "\[CONCURRENT GET\] redisun ops/s:" redisun_1024.log | awk '{print $5}')
redisson_concurrent_get_time_1024=$(grep "\[CONCURRENT GET\] redisson cost:" redisson_1024.log | awk '{print $5}')
redisson_concurrent_get_ops_1024=$(grep "\[CONCURRENT GET\] redisson ops/s:" redisson_1024.log | awk '{print $5}')
jedis_concurrent_get_time_1024=$(grep "\[CONCURRENT GET\] jedis cost:" jedis_1024.log | awk '{print $5}')
jedis_concurrent_get_ops_1024=$(grep "\[CONCURRENT GET\] jedis ops/s:" jedis_1024.log | awk '{print $5}')
lettuce_concurrent_get_time_1024=$(grep "\[CONCURRENT GET\] lettuce cost:" lettuce_1024.log | awk '{print $5}')
lettuce_concurrent_get_ops_1024=$(grep "\[CONCURRENT GET\] lettuce ops/s:" lettuce_1024.log | awk '{print $5}')
echo "| 1024 | ${redisun_concurrent_get_time_1024} | ${redisson_concurrent_get_time_1024} | ${jedis_concurrent_get_time_1024} | ${lettuce_concurrent_get_time_1024} | ${redisun_concurrent_get_ops_1024} | ${redisson_concurrent_get_ops_1024} | ${jedis_concurrent_get_ops_1024} | ${lettuce_concurrent_get_ops_1024} |" >> benchmark-report.md
else
echo "| 1024 | 测试失败 | 测试失败 | 测试失败 | 测试失败 | N/A | N/A | N/A | N/A |" >> benchmark-report.md
fi
echo "" >> benchmark-report.md
echo "## 异步GET性能对比" >> benchmark-report.md
echo "| 客户端数量 | Redisun耗时 | Redisson耗时 | Jedis耗时 | Lettuce耗时 | Redisun OPS | Redisson OPS | Jedis OPS | Lettuce OPS |" >> benchmark-report.md
echo "|------------|-------------|--------------|-----------|-------------|-------------|--------------|-----------|-------------|" >> benchmark-report.md
# 1 client 异步GET
if grep -q "\[ASYNC GET\] redisun cost:" redisun_1.log && grep -q "\[ASYNC GET\] redisson cost:" redisson_1.log && grep -q "\[ASYNC GET\] lettuce cost:" lettuce_1.log; then
redisun_async_get_time_1=$(grep "\[ASYNC GET\] redisun cost:" redisun_1.log | awk '{print $5}')
redisun_async_get_ops_1=$(grep "\[ASYNC GET\] redisun ops/s:" redisun_1.log | awk '{print $5}')
redisson_async_get_time_1=$(grep "\[ASYNC GET\] redisson cost:" redisson_1.log | awk '{print $5}')
redisson_async_get_ops_1=$(grep "\[ASYNC GET\] redisson ops/s:" redisson_1.log | awk '{print $5}')
jedis_async_get_time_1="-"
jedis_async_get_ops_1="-"
lettuce_async_get_time_1=$(grep "\[ASYNC GET\] lettuce cost:" lettuce_1.log | awk '{print $5}')
lettuce_async_get_ops_1=$(grep "\[ASYNC GET\] lettuce ops/s:" lettuce_1.log | awk '{print $5}')
echo "| 1 | ${redisun_async_get_time_1} | ${redisson_async_get_time_1} | ${jedis_async_get_time_1} | ${lettuce_async_get_time_1} | ${redisun_async_get_ops_1} | ${redisson_async_get_ops_1} | ${jedis_async_get_ops_1} | ${lettuce_async_get_ops_1} |" >> benchmark-report.md
else
echo "| 1 | 测试失败 | 测试失败 | - | 测试失败 | N/A | N/A | - | N/A |" >> benchmark-report.md
fi
# 8 clients 异步GET
if grep -q "\[ASYNC GET\] redisun cost:" redisun_8.log && grep -q "\[ASYNC GET\] redisson cost:" redisson_8.log && grep -q "\[ASYNC GET\] lettuce cost:" lettuce_8.log; then
redisun_async_get_time_8=$(grep "\[ASYNC GET\] redisun cost:" redisun_8.log | awk '{print $5}')
redisun_async_get_ops_8=$(grep "\[ASYNC GET\] redisun ops/s:" redisun_8.log | awk '{print $5}')
redisson_async_get_time_8=$(grep "\[ASYNC GET\] redisson cost:" redisson_8.log | awk '{print $5}')
redisson_async_get_ops_8=$(grep "\[ASYNC GET\] redisson ops/s:" redisson_8.log | awk '{print $5}')
jedis_async_get_time_8="-"
jedis_async_get_ops_8="-"
lettuce_async_get_time_8=$(grep "\[ASYNC GET\] lettuce cost:" lettuce_8.log | awk '{print $5}')
lettuce_async_get_ops_8=$(grep "\[ASYNC GET\] lettuce ops/s:" lettuce_8.log | awk '{print $5}')
echo "| 8 | ${redisun_async_get_time_8} | ${redisson_async_get_time_8} | ${jedis_async_get_time_8} | ${lettuce_async_get_time_8} | ${redisun_async_get_ops_8} | ${redisson_async_get_ops_8} | ${jedis_async_get_ops_8} | ${lettuce_async_get_ops_8} |" >> benchmark-report.md
else
echo "| 8 | 测试失败 | 测试失败 | - | 测试失败 | N/A | N/A | - | N/A |" >> benchmark-report.md
fi
# 128 clients 异步GET
if grep -q "\[ASYNC GET\] redisun cost:" redisun_128.log && grep -q "\[ASYNC GET\] redisson cost:" redisson_128.log && grep -q "\[ASYNC GET\] lettuce cost:" lettuce_128.log; then
redisun_async_get_time_128=$(grep "\[ASYNC GET\] redisun cost:" redisun_128.log | awk '{print $5}')
redisun_async_get_ops_128=$(grep "\[ASYNC GET\] redisun ops/s:" redisun_128.log | awk '{print $5}')
redisson_async_get_time_128=$(grep "\[ASYNC GET\] redisson cost:" redisson_128.log | awk '{print $5}')
redisson_async_get_ops_128=$(grep "\[ASYNC GET\] redisson ops/s:" redisson_128.log | awk '{print $5}')
jedis_async_get_time_128="-"
jedis_async_get_ops_128="-"
lettuce_async_get_time_128=$(grep "\[ASYNC GET\] lettuce cost:" lettuce_128.log | awk '{print $5}')
lettuce_async_get_ops_128=$(grep "\[ASYNC GET\] lettuce ops/s:" lettuce_128.log | awk '{print $5}')
echo "| 128 | ${redisun_async_get_time_128} | ${redisson_async_get_time_128} | ${jedis_async_get_time_128} | ${lettuce_async_get_time_128} | ${redisun_async_get_ops_128} | ${redisson_async_get_ops_128} | ${jedis_async_get_ops_128} | ${lettuce_async_get_ops_128} |" >> benchmark-report.md
else
echo "| 128 | 测试失败 | 测试失败 | - | 测试失败 | N/A | N/A | - | N/A |" >> benchmark-report.md
fi
# 1024 clients 异步GET
if grep -q "\[ASYNC GET\] redisun cost:" redisun_1024.log && grep -q "\[ASYNC GET\] redisson cost:" redisson_1024.log && grep -q "\[ASYNC GET\] lettuce cost:" lettuce_1024.log; then
redisun_async_get_time_1024=$(grep "\[ASYNC GET\] redisun cost:" redisun_1024.log | awk '{print $5}')
redisun_async_get_ops_1024=$(grep "\[ASYNC GET\] redisun ops/s:" redisun_1024.log | awk '{print $5}')
redisson_async_get_time_1024=$(grep "\[ASYNC GET\] redisson cost:" redisson_1024.log | awk '{print $5}')
redisson_async_get_ops_1024=$(grep "\[ASYNC GET\] redisson ops/s:" redisson_1024.log | awk '{print $5}')
jedis_async_get_time_1024="-"
jedis_async_get_ops_1024="-"
lettuce_async_get_time_1024=$(grep "\[ASYNC GET\] lettuce cost:" lettuce_1024.log | awk '{print $5}')
lettuce_async_get_ops_1024=$(grep "\[ASYNC GET\] lettuce ops/s:" lettuce_1024.log | awk '{print $5}')
echo "| 1024 | ${redisun_async_get_time_1024} | ${redisson_async_get_time_1024} | ${jedis_async_get_time_1024} | ${lettuce_async_get_time_1024} | ${redisun_async_get_ops_1024} | ${redisson_async_get_ops_1024} | ${jedis_async_get_ops_1024} | ${lettuce_async_get_ops_1024} |" >> benchmark-report.md
else
echo "| 1024 | 测试失败 | 测试失败 | - | 测试失败 | N/A | N/A | - | N/A |" >> benchmark-report.md
fi
echo "" >> benchmark-report.md
echo "> 注意:由于 GitHub Actions 环境限制,测试结果可能不如本地环境准确。Jedis 不支持原生异步操作,因此标记为 -。" >> benchmark-report.md
echo "" >> benchmark-report.md
# 显示报告内容
cat benchmark-report.md
# 上传测试报告作为工件
- name: 上传测试报告
uses: actions/upload-artifact@v4
with:
name: benchmark-report
path: benchmark-report.md