feat(benchmark): 扩展性能测试以包括 Jedis 和 Lettuce #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 async SET test with 1 client..." | |
| mvn test -Dtest=RedisunBenchmark#asyncSet -Dclient.count=1 > redisun_async_set_1.log 2>&1 || true | |
| echo "Running Redisson async SET test with 1 client..." | |
| mvn test -Dtest=RedissonBenchmark#asyncSet -Dclient.count=1 > redisson_async_set_1.log 2>&1 || true | |
| echo "Running Jedis concurrent SET test with 1 client..." | |
| mvn test -Dtest=JedisBenchmark#concurrentSet -Dclient.count=1 > jedis_concurrent_set_1.log 2>&1 || true | |
| echo "Running Lettuce concurrent SET test with 1 client..." | |
| mvn test -Dtest=LettuceBenchmark#concurrentSet -Dclient.count=1 > lettuce_concurrent_set_1.log 2>&1 || true | |
| echo "Running Redisun async GET test with 1 client..." | |
| mvn test -Dtest=RedisunBenchmark#asyncGet -Dclient.count=1 > redisun_async_get_1.log 2>&1 || true | |
| echo "Running Redisson async GET test with 1 client..." | |
| mvn test -Dtest=RedissonBenchmark#asyncGet -Dclient.count=1 > redisson_async_get_1.log 2>&1 || true | |
| echo "Running Jedis concurrent GET test with 1 client..." | |
| mvn test -Dtest=JedisBenchmark#concurrentGet -Dclient.count=1 > jedis_concurrent_get_1.log 2>&1 || true | |
| echo "Running Lettuce concurrent GET test with 1 client..." | |
| mvn test -Dtest=LettuceBenchmark#concurrentGet -Dclient.count=1 > lettuce_concurrent_get_1.log 2>&1 || true | |
| echo "Running Redisun concurrent SET test with 1 client..." | |
| mvn test -Dtest=RedisunBenchmark#concurrentSet -Dclient.count=1 > redisun_concurrent_set_1.log 2>&1 || true | |
| echo "Running Redisson concurrent SET test with 1 client..." | |
| mvn test -Dtest=RedissonBenchmark#concurrentSet -Dclient.count=1 > redisson_concurrent_set_1.log 2>&1 || true | |
| echo "Running Redisun concurrent GET test with 1 client..." | |
| mvn test -Dtest=RedisunBenchmark#concurrentGet -Dclient.count=1 > redisun_concurrent_get_1.log 2>&1 || true | |
| echo "Running Redisson concurrent GET test with 1 client..." | |
| mvn test -Dtest=RedissonBenchmark#concurrentGet -Dclient.count=1 > redisson_concurrent_get_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 async SET test..." | |
| mvn test -Dtest=RedisunBenchmark#asyncSet -Dclient.count=8 > redisun_async_set_8.log 2>&1 || true | |
| echo "Running Redisson async SET test..." | |
| mvn test -Dtest=RedissonBenchmark#asyncSet -Dclient.count=8 > redisson_async_set_8.log 2>&1 || true | |
| echo "Running Jedis concurrent SET test with 8 clients..." | |
| mvn test -Dtest=JedisBenchmark#concurrentSet -Dclient.count=8 > jedis_concurrent_set_8.log 2>&1 || true | |
| echo "Running Lettuce concurrent SET test with 8 clients..." | |
| mvn test -Dtest=LettuceBenchmark#concurrentSet -Dclient.count=8 > lettuce_concurrent_set_8.log 2>&1 || true | |
| echo "Running Redisun async GET test..." | |
| mvn test -Dtest=RedisunBenchmark#asyncGet -Dclient.count=8 > redisun_async_get_8.log 2>&1 || true | |
| echo "Running Redisson async GET test..." | |
| mvn test -Dtest=RedissonBenchmark#asyncGet -Dclient.count=8 > redisson_async_get_8.log 2>&1 || true | |
| echo "Running Jedis concurrent GET test with 8 clients..." | |
| mvn test -Dtest=JedisBenchmark#concurrentGet -Dclient.count=8 > jedis_concurrent_get_8.log 2>&1 || true | |
| echo "Running Lettuce concurrent GET test with 8 clients..." | |
| mvn test -Dtest=LettuceBenchmark#concurrentGet -Dclient.count=8 > lettuce_concurrent_get_8.log 2>&1 || true | |
| echo "Running Redisun concurrent SET test with 8 clients..." | |
| mvn test -Dtest=RedisunBenchmark#concurrentSet -Dclient.count=8 > redisun_concurrent_set_8.log 2>&1 || true | |
| echo "Running Redisson concurrent SET test with 8 clients..." | |
| mvn test -Dtest=RedissonBenchmark#concurrentSet -Dclient.count=8 > redisson_concurrent_set_8.log 2>&1 || true | |
| echo "Running Redisun concurrent GET test with 8 clients..." | |
| mvn test -Dtest=RedisunBenchmark#concurrentGet -Dclient.count=8 > redisun_concurrent_get_8.log 2>&1 || true | |
| echo "Running Redisson concurrent GET test with 8 clients..." | |
| mvn test -Dtest=RedissonBenchmark#concurrentGet -Dclient.count=8 > redisson_concurrent_get_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 concurrent SET test with 128 clients..." | |
| mvn test -Dtest=RedisunBenchmark#concurrentSet -Dclient.count=128 > redisun_concurrent_set_128.log 2>&1 || true | |
| echo "Running Redisson concurrent SET test with 128 clients..." | |
| mvn test -Dtest=RedissonBenchmark#concurrentSet -Dclient.count=128 > redisson_concurrent_set_128.log 2>&1 || true | |
| echo "Running Jedis concurrent SET test with 128 clients..." | |
| mvn test -Dtest=JedisBenchmark#concurrentSet -Dclient.count=128 > jedis_concurrent_set_128.log 2>&1 || true | |
| echo "Running Lettuce concurrent SET test with 128 clients..." | |
| mvn test -Dtest=LettuceBenchmark#concurrentSet -Dclient.count=128 > lettuce_concurrent_set_128.log 2>&1 || true | |
| echo "Running Redisun async SET test with 128 clients..." | |
| mvn test -Dtest=RedisunBenchmark#asyncSet -Dclient.count=128 > redisun_async_set_128.log 2>&1 || true | |
| echo "Running Redisson async SET test with 128 clients..." | |
| mvn test -Dtest=RedissonBenchmark#asyncSet -Dclient.count=128 > redisson_async_set_128.log 2>&1 || true | |
| echo "Running Jedis async SET test with 128 clients..." | |
| mvn test -Dtest=JedisBenchmark#asyncSet -Dclient.count=128 > jedis_async_set_128.log 2>&1 || true | |
| echo "Running Lettuce async SET test with 128 clients..." | |
| mvn test -Dtest=LettuceBenchmark#asyncSet -Dclient.count=128 > lettuce_async_set_128.log 2>&1 || true | |
| echo "Running Redisun async GET test with 128 clients..." | |
| mvn test -Dtest=RedisunBenchmark#asyncGet -Dclient.count=128 > redisun_async_get_128.log 2>&1 || true | |
| echo "Running Redisson async GET test with 128 clients..." | |
| mvn test -Dtest=RedissonBenchmark#asyncGet -Dclient.count=128 > redisson_async_get_128.log 2>&1 || true | |
| echo "Running Jedis async GET test with 128 clients..." | |
| mvn test -Dtest=JedisBenchmark#asyncGet -Dclient.count=128 > jedis_async_get_128.log 2>&1 || true | |
| echo "Running Lettuce async GET test with 128 clients..." | |
| mvn test -Dtest=LettuceBenchmark#asyncGet -Dclient.count=128 > lettuce_async_get_128.log 2>&1 || true | |
| echo "Running Redisun concurrent GET test with 128 clients..." | |
| mvn test -Dtest=RedisunBenchmark#concurrentGet -Dclient.count=128 > redisun_concurrent_get_128.log 2>&1 || true | |
| echo "Running Redisson concurrent GET test with 128 clients..." | |
| mvn test -Dtest=RedissonBenchmark#concurrentGet -Dclient.count=128 > redisson_concurrent_get_128.log 2>&1 || true | |
| echo "Running Jedis concurrent GET test with 128 clients..." | |
| mvn test -Dtest=JedisBenchmark#concurrentGet -Dclient.count=128 > jedis_concurrent_get_128.log 2>&1 || true | |
| echo "Running Lettuce concurrent GET test with 128 clients..." | |
| mvn test -Dtest=LettuceBenchmark#concurrentGet -Dclient.count=128 > lettuce_concurrent_get_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 concurrent SET test with 1024 clients..." | |
| mvn test -Dtest=RedisunBenchmark#concurrentSet -Dclient.count=1024 > redisun_concurrent_set_1024.log 2>&1 || true | |
| echo "Running Redisson concurrent SET test with 1024 clients..." | |
| mvn test -Dtest=RedissonBenchmark#concurrentSet -Dclient.count=1024 > redisson_concurrent_set_1024.log 2>&1 || true | |
| echo "Running Jedis concurrent SET test with 1024 clients..." | |
| mvn test -Dtest=JedisBenchmark#concurrentSet -Dclient.count=1024 > jedis_concurrent_set_1024.log 2>&1 || true | |
| echo "Running Lettuce concurrent SET test with 1024 clients..." | |
| mvn test -Dtest=LettuceBenchmark#concurrentSet -Dclient.count=1024 > lettuce_concurrent_set_1024.log 2>&1 || true | |
| echo "Running Redisun async SET test with 1024 clients..." | |
| mvn test -Dtest=RedisunBenchmark#asyncSet -Dclient.count=1024 > redisun_async_set_1024.log 2>&1 || true | |
| echo "Running Redisson async SET test with 1024 clients..." | |
| mvn test -Dtest=RedissonBenchmark#asyncSet -Dclient.count=1024 > redisson_async_set_1024.log 2>&1 || true | |
| echo "Running Jedis async SET test with 1024 clients..." | |
| mvn test -Dtest=JedisBenchmark#asyncSet -Dclient.count=1024 > jedis_async_set_1024.log 2>&1 || true | |
| echo "Running Lettuce async SET test with 1024 clients..." | |
| mvn test -Dtest=LettuceBenchmark#asyncSet -Dclient.count=1024 > lettuce_async_set_1024.log 2>&1 || true | |
| echo "Running Redisun async GET test with 1024 clients..." | |
| mvn test -Dtest=RedisunBenchmark#asyncGet -Dclient.count=1024 > redisun_async_get_1024.log 2>&1 || true | |
| echo "Running Redisson async GET test with 1024 clients..." | |
| mvn test -Dtest=RedissonBenchmark#asyncGet -Dclient.count=1024 > redisson_async_get_1024.log 2>&1 || true | |
| echo "Running Jedis async GET test with 1024 clients..." | |
| mvn test -Dtest=JedisBenchmark#asyncGet -Dclient.count=1024 > jedis_async_get_1024.log 2>&1 || true | |
| echo "Running Lettuce async GET test with 1024 clients..." | |
| mvn test -Dtest=LettuceBenchmark#asyncGet -Dclient.count=1024 > lettuce_async_get_1024.log 2>&1 || true | |
| echo "Running Redisun concurrent GET test with 1024 clients..." | |
| mvn test -Dtest=RedisunBenchmark#concurrentGet -Dclient.count=1024 > redisun_concurrent_get_1024.log 2>&1 || true | |
| echo "Running Redisson concurrent GET test with 1024 clients..." | |
| mvn test -Dtest=RedissonBenchmark#concurrentGet -Dclient.count=1024 > redisson_concurrent_get_1024.log 2>&1 || true | |
| echo "Running Jedis concurrent GET test with 1024 clients..." | |
| mvn test -Dtest=JedisBenchmark#concurrentGet -Dclient.count=1024 > jedis_concurrent_get_1024.log 2>&1 || true | |
| echo "Running Lettuce concurrent GET test with 1024 clients..." | |
| mvn test -Dtest=LettuceBenchmark#concurrentGet -Dclient.count=1024 > lettuce_concurrent_get_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耗时 | Redisun OPS | Redisson耗时 | Redisson OPS | Jedis耗时 | Jedis OPS | Lettuce耗时 | Lettuce OPS |" >> benchmark-report.md | |
| echo "|------------|-------------|-------------|--------------|--------------|-----------|-----------|-------------|-------------|" >> benchmark-report.md | |
| # 1 client 同步SET | |
| if grep -q "redisun cost:" redisun_concurrent_set_1.log && grep -q "redisson cost:" redisson_concurrent_set_1.log && grep -q "jedis cost:" jedis_concurrent_set_1.log && grep -q "lettuce cost:" lettuce_concurrent_set_1.log; then | |
| redisun_concurrent_set_time_1=$(grep "redisun cost:" redisun_concurrent_set_1.log | awk '{print $5}') | |
| redisun_concurrent_set_ops_1=$(grep "redisun ops/s:" redisun_concurrent_set_1.log | awk '{print $5}') | |
| redisson_concurrent_set_time_1=$(grep "redisson cost:" redisson_concurrent_set_1.log | awk '{print $5}') | |
| redisson_concurrent_set_ops_1=$(grep "redisson ops/s:" redisson_concurrent_set_1.log | awk '{print $5}') | |
| jedis_concurrent_set_time_1=$(grep "jedis cost:" jedis_concurrent_set_1.log | awk '{print $5}') | |
| jedis_concurrent_set_ops_1=$(grep "jedis ops/s:" jedis_concurrent_set_1.log | awk '{print $5}') | |
| lettuce_concurrent_set_time_1=$(grep "lettuce cost:" lettuce_concurrent_set_1.log | awk '{print $5}') | |
| lettuce_concurrent_set_ops_1=$(grep "lettuce ops/s:" lettuce_concurrent_set_1.log | awk '{print $5}') | |
| echo "| 1 | ${redisun_concurrent_set_time_1} | ${redisun_concurrent_set_ops_1} | ${redisson_concurrent_set_time_1} | ${redisson_concurrent_set_ops_1} | ${jedis_concurrent_set_time_1} | ${jedis_concurrent_set_ops_1} | ${lettuce_concurrent_set_time_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 "redisun cost:" redisun_concurrent_set_8.log && grep -q "redisson cost:" redisson_concurrent_set_8.log && grep -q "jedis cost:" jedis_concurrent_set_8.log && grep -q "lettuce cost:" lettuce_concurrent_set_8.log; then | |
| redisun_concurrent_set_time_8=$(grep "redisun cost:" redisun_concurrent_set_8.log | awk '{print $5}') | |
| redisun_concurrent_set_ops_8=$(grep "redisun ops/s:" redisun_concurrent_set_8.log | awk '{print $5}') | |
| redisson_concurrent_set_time_8=$(grep "redisson cost:" redisson_concurrent_set_8.log | awk '{print $5}') | |
| redisson_concurrent_set_ops_8=$(grep "redisson ops/s:" redisson_concurrent_set_8.log | awk '{print $5}') | |
| jedis_concurrent_set_time_8=$(grep "jedis cost:" jedis_concurrent_set_8.log | awk '{print $5}') | |
| jedis_concurrent_set_ops_8=$(grep "jedis ops/s:" jedis_concurrent_set_8.log | awk '{print $5}') | |
| lettuce_concurrent_set_time_8=$(grep "lettuce cost:" lettuce_concurrent_set_8.log | awk '{print $5}') | |
| lettuce_concurrent_set_ops_8=$(grep "lettuce ops/s:" lettuce_concurrent_set_8.log | awk '{print $5}') | |
| echo "| 8 | ${redisun_concurrent_set_time_8} | ${redisun_concurrent_set_ops_8} | ${redisson_concurrent_set_time_8} | ${redisson_concurrent_set_ops_8} | ${jedis_concurrent_set_time_8} | ${jedis_concurrent_set_ops_8} | ${lettuce_concurrent_set_time_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 "redisun cost:" redisun_concurrent_set_128.log && grep -q "redisson cost:" redisson_concurrent_set_128.log && grep -q "jedis cost:" jedis_concurrent_set_128.log && grep -q "lettuce cost:" lettuce_concurrent_set_128.log; then | |
| redisun_concurrent_set_time_128=$(grep "redisun cost:" redisun_concurrent_set_128.log | awk '{print $5}') | |
| redisun_concurrent_set_ops_128=$(grep "redisun ops/s:" redisun_concurrent_set_128.log | awk '{print $5}') | |
| redisson_concurrent_set_time_128=$(grep "redisson cost:" redisson_concurrent_set_128.log | awk '{print $5}') | |
| redisson_concurrent_set_ops_128=$(grep "redisson ops/s:" redisson_concurrent_set_128.log | awk '{print $5}') | |
| jedis_concurrent_set_time_128=$(grep "jedis cost:" jedis_concurrent_set_128.log | awk '{print $5}') | |
| jedis_concurrent_set_ops_128=$(grep "jedis ops/s:" jedis_concurrent_set_128.log | awk '{print $5}') | |
| lettuce_concurrent_set_time_128=$(grep "lettuce cost:" lettuce_concurrent_set_128.log | awk '{print $5}') | |
| lettuce_concurrent_set_ops_128=$(grep "lettuce ops/s:" lettuce_concurrent_set_128.log | awk '{print $5}') | |
| echo "| 128 | ${redisun_concurrent_set_time_128} | ${redisun_concurrent_set_ops_128} | ${redisson_concurrent_set_time_128} | ${redisson_concurrent_set_ops_128} | ${jedis_concurrent_set_time_128} | ${jedis_concurrent_set_ops_128} | ${lettuce_concurrent_set_time_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 "redisun cost:" redisun_concurrent_set_1024.log && grep -q "redisson cost:" redisson_concurrent_set_1024.log && grep -q "jedis cost:" jedis_concurrent_set_1024.log && grep -q "lettuce cost:" lettuce_concurrent_set_1024.log; then | |
| redisun_concurrent_set_time_1024=$(grep "redisun cost:" redisun_concurrent_set_1024.log | awk '{print $5}') | |
| redisun_concurrent_set_ops_1024=$(grep "redisun ops/s:" redisun_concurrent_set_1024.log | awk '{print $5}') | |
| redisson_concurrent_set_time_1024=$(grep "redisson cost:" redisson_concurrent_set_1024.log | awk '{print $5}') | |
| redisson_concurrent_set_ops_1024=$(grep "redisson ops/s:" redisson_concurrent_set_1024.log | awk '{print $5}') | |
| jedis_concurrent_set_time_1024=$(grep "jedis cost:" jedis_concurrent_set_1024.log | awk '{print $5}') | |
| jedis_concurrent_set_ops_1024=$(grep "jedis ops/s:" jedis_concurrent_set_1024.log | awk '{print $5}') | |
| lettuce_concurrent_set_time_1024=$(grep "lettuce cost:" lettuce_concurrent_set_1024.log | awk '{print $5}') | |
| lettuce_concurrent_set_ops_1024=$(grep "lettuce ops/s:" lettuce_concurrent_set_1024.log | awk '{print $5}') | |
| echo "| 1024 | ${redisun_concurrent_set_time_1024} | ${redisun_concurrent_set_ops_1024} | ${redisson_concurrent_set_time_1024} | ${redisson_concurrent_set_ops_1024} | ${jedis_concurrent_set_time_1024} | ${jedis_concurrent_set_ops_1024} | ${lettuce_concurrent_set_time_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耗时 | Redisun OPS | Redisson耗时 | Redisson OPS | Jedis耗时 | Jedis OPS | Lettuce耗时 | Lettuce OPS |" >> benchmark-report.md | |
| echo "|------------|-------------|-------------|--------------|--------------|-----------|-----------|-------------|-------------|" >> benchmark-report.md | |
| # 1 client 异步SET | |
| if grep -q "redisun cost:" redisun_async_set_1.log && grep -q "redisson cost:" redisson_async_set_1.log; then | |
| redisun_async_set_time_1=$(grep "redisun cost:" redisun_async_set_1.log | awk '{print $5}') | |
| redisun_async_set_ops_1=$(grep "redisun ops/s:" redisun_async_set_1.log | awk '{print $5}') | |
| redisson_async_set_time_1=$(grep "redisson cost:" redisson_async_set_1.log | awk '{print $5}') | |
| redisson_async_set_ops_1=$(grep "redisson ops/s:" redisson_async_set_1.log | awk '{print $5}') | |
| jedis_async_set_time_1="-" | |
| jedis_async_set_ops_1="-" | |
| lettuce_async_set_time_1=$(grep "lettuce cost:" lettuce_async_set_1.log | awk '{print $5}' 2>/dev/null || echo "-") | |
| lettuce_async_set_ops_1=$(grep "lettuce ops/s:" lettuce_async_set_1.log | awk '{print $5}' 2>/dev/null || echo "-") | |
| echo "| 1 | ${redisun_async_set_time_1} | ${redisun_async_set_ops_1} | ${redisson_async_set_time_1} | ${redisson_async_set_ops_1} | ${jedis_async_set_time_1} | ${jedis_async_set_ops_1} | ${lettuce_async_set_time_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 "redisun cost:" redisun_async_set_8.log && grep -q "redisson cost:" redisson_async_set_8.log; then | |
| redisun_async_set_time_8=$(grep "redisun cost:" redisun_async_set_8.log | awk '{print $5}') | |
| redisun_async_set_ops_8=$(grep "redisun ops/s:" redisun_async_set_8.log | awk '{print $5}') | |
| redisson_async_set_time_8=$(grep "redisson cost:" redisson_async_set_8.log | awk '{print $5}') | |
| redisson_async_set_ops_8=$(grep "redisson ops/s:" redisson_async_set_8.log | awk '{print $5}') | |
| jedis_async_set_time_8="-" | |
| jedis_async_set_ops_8="-" | |
| lettuce_async_set_time_8=$(grep "lettuce cost:" lettuce_async_set_8.log | awk '{print $5}' 2>/dev/null || echo "-") | |
| lettuce_async_set_ops_8=$(grep "lettuce ops/s:" lettuce_async_set_8.log | awk '{print $5}' 2>/dev/null || echo "-") | |
| echo "| 8 | ${redisun_async_set_time_8} | ${redisun_async_set_ops_8} | ${redisson_async_set_time_8} | ${redisson_async_set_ops_8} | ${jedis_async_set_time_8} | ${jedis_async_set_ops_8} | ${lettuce_async_set_time_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 "redisun cost:" redisun_async_set_128.log && grep -q "redisson cost:" redisson_async_set_128.log && grep -q "lettuce cost:" lettuce_async_set_128.log; then | |
| redisun_async_set_time_128=$(grep "redisun cost:" redisun_async_set_128.log | awk '{print $5}') | |
| redisun_async_set_ops_128=$(grep "redisun ops/s:" redisun_async_set_128.log | awk '{print $5}') | |
| redisson_async_set_time_128=$(grep "redisson cost:" redisson_async_set_128.log | awk '{print $5}') | |
| redisson_async_set_ops_128=$(grep "redisson ops/s:" redisson_async_set_128.log | awk '{print $5}') | |
| jedis_async_set_time_128="-" | |
| jedis_async_set_ops_128="-" | |
| lettuce_async_set_time_128=$(grep "lettuce cost:" lettuce_async_set_128.log | awk '{print $5}') | |
| lettuce_async_set_ops_128=$(grep "lettuce ops/s:" lettuce_async_set_128.log | awk '{print $5}') | |
| echo "| 128 | ${redisun_async_set_time_128} | ${redisun_async_set_ops_128} | ${redisson_async_set_time_128} | ${redisson_async_set_ops_128} | ${jedis_async_set_time_128} | ${jedis_async_set_ops_128} | ${lettuce_async_set_time_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 "redisun cost:" redisun_async_set_1024.log && grep -q "redisson cost:" redisson_async_set_1024.log && grep -q "lettuce cost:" lettuce_async_set_1024.log; then | |
| redisun_async_set_time_1024=$(grep "redisun cost:" redisun_async_set_1024.log | awk '{print $5}') | |
| redisun_async_set_ops_1024=$(grep "redisun ops/s:" redisun_async_set_1024.log | awk '{print $5}') | |
| redisson_async_set_time_1024=$(grep "redisson cost:" redisson_async_set_1024.log | awk '{print $5}') | |
| redisson_async_set_ops_1024=$(grep "redisson ops/s:" redisson_async_set_1024.log | awk '{print $5}') | |
| jedis_async_set_time_1024="-" | |
| jedis_async_set_ops_1024="-" | |
| lettuce_async_set_time_1024=$(grep "lettuce cost:" lettuce_async_set_1024.log | awk '{print $5}') | |
| lettuce_async_set_ops_1024=$(grep "lettuce ops/s:" lettuce_async_set_1024.log | awk '{print $5}') | |
| echo "| 1024 | ${redisun_async_set_time_1024} | ${redisun_async_set_ops_1024} | ${redisson_async_set_time_1024} | ${redisson_async_set_ops_1024} | ${jedis_async_set_time_1024} | ${jedis_async_set_ops_1024} | ${lettuce_async_set_time_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耗时 | Redisun OPS | Redisson耗时 | Redisson OPS | Jedis耗时 | Jedis OPS | Lettuce耗时 | Lettuce OPS |" >> benchmark-report.md | |
| echo "|------------|-------------|-------------|--------------|--------------|-----------|-----------|-------------|-------------|" >> benchmark-report.md | |
| # 1 client 同步GET | |
| if grep -q "redisun cost:" redisun_concurrent_get_1.log && grep -q "redisson cost:" redisson_concurrent_get_1.log && grep -q "jedis cost:" jedis_concurrent_get_1.log && grep -q "lettuce cost:" lettuce_concurrent_get_1.log; then | |
| redisun_concurrent_get_time_1=$(grep "redisun cost:" redisun_concurrent_get_1.log | awk '{print $5}') | |
| redisun_concurrent_get_ops_1=$(grep "redisun ops/s:" redisun_concurrent_get_1.log | awk '{print $5}') | |
| redisson_concurrent_get_time_1=$(grep "redisson cost:" redisson_concurrent_get_1.log | awk '{print $5}') | |
| redisson_concurrent_get_ops_1=$(grep "redisson ops/s:" redisson_concurrent_get_1.log | awk '{print $5}') | |
| jedis_concurrent_get_time_1=$(grep "jedis cost:" jedis_concurrent_get_1.log | awk '{print $5}') | |
| jedis_concurrent_get_ops_1=$(grep "jedis ops/s:" jedis_concurrent_get_1.log | awk '{print $5}') | |
| lettuce_concurrent_get_time_1=$(grep "lettuce cost:" lettuce_concurrent_get_1.log | awk '{print $5}') | |
| lettuce_concurrent_get_ops_1=$(grep "lettuce ops/s:" lettuce_concurrent_get_1.log | awk '{print $5}') | |
| echo "| 1 | ${redisun_concurrent_get_time_1} | ${redisun_concurrent_get_ops_1} | ${redisson_concurrent_get_time_1} | ${redisson_concurrent_get_ops_1} | ${jedis_concurrent_get_time_1} | ${jedis_concurrent_get_ops_1} | ${lettuce_concurrent_get_time_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 "redisun cost:" redisun_concurrent_get_8.log && grep -q "redisson cost:" redisson_concurrent_get_8.log && grep -q "jedis cost:" jedis_concurrent_get_8.log && grep -q "lettuce cost:" lettuce_concurrent_get_8.log; then | |
| redisun_concurrent_get_time_8=$(grep "redisun cost:" redisun_concurrent_get_8.log | awk '{print $5}') | |
| redisun_concurrent_get_ops_8=$(grep "redisun ops/s:" redisun_concurrent_get_8.log | awk '{print $5}') | |
| redisson_concurrent_get_time_8=$(grep "redisson cost:" redisson_concurrent_get_8.log | awk '{print $5}') | |
| redisson_concurrent_get_ops_8=$(grep "redisson ops/s:" redisson_concurrent_get_8.log | awk '{print $5}') | |
| jedis_concurrent_get_time_8=$(grep "jedis cost:" jedis_concurrent_get_8.log | awk '{print $5}') | |
| jedis_concurrent_get_ops_8=$(grep "jedis ops/s:" jedis_concurrent_get_8.log | awk '{print $5}') | |
| lettuce_concurrent_get_time_8=$(grep "lettuce cost:" lettuce_concurrent_get_8.log | awk '{print $5}') | |
| lettuce_concurrent_get_ops_8=$(grep "lettuce ops/s:" lettuce_concurrent_get_8.log | awk '{print $5}') | |
| echo "| 8 | ${redisun_concurrent_get_time_8} | ${redisun_concurrent_get_ops_8} | ${redisson_concurrent_get_time_8} | ${redisson_concurrent_get_ops_8} | ${jedis_concurrent_get_time_8} | ${jedis_concurrent_get_ops_8} | ${lettuce_concurrent_get_time_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 "redisun cost:" redisun_concurrent_get_128.log && grep -q "redisson cost:" redisson_concurrent_get_128.log && grep -q "jedis cost:" jedis_concurrent_get_128.log && grep -q "lettuce cost:" lettuce_concurrent_get_128.log; then | |
| redisun_concurrent_get_time_128=$(grep "redisun cost:" redisun_concurrent_get_128.log | awk '{print $5}') | |
| redisun_concurrent_get_ops_128=$(grep "redisun ops/s:" redisun_concurrent_get_128.log | awk '{print $5}') | |
| redisson_concurrent_get_time_128=$(grep "redisson cost:" redisson_concurrent_get_128.log | awk '{print $5}') | |
| redisson_concurrent_get_ops_128=$(grep "redisson ops/s:" redisson_concurrent_get_128.log | awk '{print $5}') | |
| jedis_concurrent_get_time_128=$(grep "jedis cost:" jedis_concurrent_get_128.log | awk '{print $5}') | |
| jedis_concurrent_get_ops_128=$(grep "jedis ops/s:" jedis_concurrent_get_128.log | awk '{print $5}') | |
| lettuce_concurrent_get_time_128=$(grep "lettuce cost:" lettuce_concurrent_get_128.log | awk '{print $5}') | |
| lettuce_concurrent_get_ops_128=$(grep "lettuce ops/s:" lettuce_concurrent_get_128.log | awk '{print $5}') | |
| echo "| 128 | ${redisun_concurrent_get_time_128} | ${redisun_concurrent_get_ops_128} | ${redisson_concurrent_get_time_128} | ${redisson_concurrent_get_ops_128} | ${jedis_concurrent_get_time_128} | ${jedis_concurrent_get_ops_128} | ${lettuce_concurrent_get_time_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 "redisun cost:" redisun_concurrent_get_1024.log && grep -q "redisson cost:" redisson_concurrent_get_1024.log && grep -q "jedis cost:" jedis_concurrent_get_1024.log && grep -q "lettuce cost:" lettuce_concurrent_get_1024.log; then | |
| redisun_concurrent_get_time_1024=$(grep "redisun cost:" redisun_concurrent_get_1024.log | awk '{print $5}') | |
| redisun_concurrent_get_ops_1024=$(grep "redisun ops/s:" redisun_concurrent_get_1024.log | awk '{print $5}') | |
| redisson_concurrent_get_time_1024=$(grep "redisson cost:" redisson_concurrent_get_1024.log | awk '{print $5}') | |
| redisson_concurrent_get_ops_1024=$(grep "redisson ops/s:" redisson_concurrent_get_1024.log | awk '{print $5}') | |
| jedis_concurrent_get_time_1024=$(grep "jedis cost:" jedis_concurrent_get_1024.log | awk '{print $5}') | |
| jedis_concurrent_get_ops_1024=$(grep "jedis ops/s:" jedis_concurrent_get_1024.log | awk '{print $5}') | |
| lettuce_concurrent_get_time_1024=$(grep "lettuce cost:" lettuce_concurrent_get_1024.log | awk '{print $5}') | |
| lettuce_concurrent_get_ops_1024=$(grep "lettuce ops/s:" lettuce_concurrent_get_1024.log | awk '{print $5}') | |
| echo "| 1024 | ${redisun_concurrent_get_time_1024} | ${redisun_concurrent_get_ops_1024} | ${redisson_concurrent_get_time_1024} | ${redisson_concurrent_get_ops_1024} | ${jedis_concurrent_get_time_1024} | ${jedis_concurrent_get_ops_1024} | ${lettuce_concurrent_get_time_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耗时 | Redisun OPS | Redisson耗时 | Redisson OPS | Jedis耗时 | Jedis OPS | Lettuce耗时 | Lettuce OPS |" >> benchmark-report.md | |
| echo "|------------|-------------|-------------|--------------|--------------|-----------|-----------|-------------|-------------|" >> benchmark-report.md | |
| # 1 client 异步GET | |
| if grep -q "redisun cost:" redisun_async_get_1.log && grep -q "redisson cost:" redisson_async_get_1.log && grep -q "lettuce cost:" lettuce_async_get_1.log; then | |
| redisun_async_get_time_1=$(grep "redisun cost:" redisun_async_get_1.log | awk '{print $5}') | |
| redisun_async_get_ops_1=$(grep "redisun ops/s:" redisun_async_get_1.log | awk '{print $5}') | |
| redisson_async_get_time_1=$(grep "redisson cost:" redisson_async_get_1.log | awk '{print $5}') | |
| redisson_async_get_ops_1=$(grep "redisson ops/s:" redisson_async_get_1.log | awk '{print $5}') | |
| jedis_async_get_time_1="-" | |
| jedis_async_get_ops_1="-" | |
| lettuce_async_get_time_1=$(grep "lettuce cost:" lettuce_async_get_1.log | awk '{print $5}') | |
| lettuce_async_get_ops_1=$(grep "lettuce ops/s:" lettuce_async_get_1.log | awk '{print $5}') | |
| echo "| 1 | ${redisun_async_get_time_1} | ${redisun_async_get_ops_1} | ${redisson_async_get_time_1} | ${redisson_async_get_ops_1} | ${jedis_async_get_time_1} | ${jedis_async_get_ops_1} | ${lettuce_async_get_time_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 "redisun cost:" redisun_async_get_8.log && grep -q "redisson cost:" redisson_async_get_8.log && grep -q "lettuce cost:" lettuce_async_get_8.log; then | |
| redisun_async_get_time_8=$(grep "redisun cost:" redisun_async_get_8.log | awk '{print $5}') | |
| redisun_async_get_ops_8=$(grep "redisun ops/s:" redisun_async_get_8.log | awk '{print $5}') | |
| redisson_async_get_time_8=$(grep "redisson cost:" redisson_async_get_8.log | awk '{print $5}') | |
| redisson_async_get_ops_8=$(grep "redisson ops/s:" redisson_async_get_8.log | awk '{print $5}') | |
| jedis_async_get_time_8="-" | |
| jedis_async_get_ops_8="-" | |
| lettuce_async_get_time_8=$(grep "lettuce cost:" lettuce_async_get_8.log | awk '{print $5}') | |
| lettuce_async_get_ops_8=$(grep "lettuce ops/s:" lettuce_async_get_8.log | awk '{print $5}') | |
| echo "| 8 | ${redisun_async_get_time_8} | ${redisun_async_get_ops_8} | ${redisson_async_get_time_8} | ${redisson_async_get_ops_8} | ${jedis_async_get_time_8} | ${jedis_async_get_ops_8} | ${lettuce_async_get_time_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 "redisun cost:" redisun_async_get_128.log && grep -q "redisson cost:" redisson_async_get_128.log && grep -q "lettuce cost:" lettuce_async_get_128.log; then | |
| redisun_async_get_time_128=$(grep "redisun cost:" redisun_async_get_128.log | awk '{print $5}') | |
| redisun_async_get_ops_128=$(grep "redisun ops/s:" redisun_async_get_128.log | awk '{print $5}') | |
| redisson_async_get_time_128=$(grep "redisson cost:" redisson_async_get_128.log | awk '{print $5}') | |
| redisson_async_get_ops_128=$(grep "redisson ops/s:" redisson_async_get_128.log | awk '{print $5}') | |
| jedis_async_get_time_128="-" | |
| jedis_async_get_ops_128="-" | |
| lettuce_async_get_time_128=$(grep "lettuce cost:" lettuce_async_get_128.log | awk '{print $5}') | |
| lettuce_async_get_ops_128=$(grep "lettuce ops/s:" lettuce_async_get_128.log | awk '{print $5}') | |
| echo "| 128 | ${redisun_async_get_time_128} | ${redisun_async_get_ops_128} | ${redisson_async_get_time_128} | ${redisson_async_get_ops_128} | ${jedis_async_get_time_128} | ${jedis_async_get_ops_128} | ${lettuce_async_get_time_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 "redisun cost:" redisun_async_get_1024.log && grep -q "redisson cost:" redisson_async_get_1024.log && grep -q "lettuce cost:" lettuce_async_get_1024.log; then | |
| redisun_async_get_time_1024=$(grep "redisun cost:" redisun_async_get_1024.log | awk '{print $5}') | |
| redisun_async_get_ops_1024=$(grep "redisun ops/s:" redisun_async_get_1024.log | awk '{print $5}') | |
| redisson_async_get_time_1024=$(grep "redisson cost:" redisson_async_get_1024.log | awk '{print $5}') | |
| redisson_async_get_ops_1024=$(grep "redisson ops/s:" redisson_async_get_1024.log | awk '{print $5}') | |
| jedis_async_get_time_1024="-" | |
| jedis_async_get_ops_1024="-" | |
| lettuce_async_get_time_1024=$(grep "lettuce cost:" lettuce_async_get_1024.log | awk '{print $5}') | |
| lettuce_async_get_ops_1024=$(grep "lettuce ops/s:" lettuce_async_get_1024.log | awk '{print $5}') | |
| echo "| 1024 | ${redisun_async_get_time_1024} | ${redisun_async_get_ops_1024} | ${redisson_async_get_time_1024} | ${redisson_async_get_ops_1024} | ${jedis_async_get_time_1024} | ${jedis_async_get_ops_1024} | ${lettuce_async_get_time_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 |