性能测试

服务器硬件配置是 2 核 2 GB 内存,对 Redis Get 命令进行基准测试的 RPS 是 7w+,而应用程序接口会将数据缓存到 Redis,即使每次都命中缓存 RPS 却只有 1k+。

1
2
3
4
5
6
7
8
9
$ lscpu
Architecture: x86_64
CPU(s): 2
CPU MHz: 2499.998

$ free -h
total used free shared buff/cache available
Mem: 1.8Gi 1.3Gi 140Mi 1.0Mi 551Mi 545Mi
Swap: 0B 0B 0B
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ redis-benchmark -t get -c 50 -n 100000 -d 8 -P 1
====== GET ======
100000 requests completed in 1.41 seconds
50 parallel clients
8 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no

Summary:
throughput summary: 70972.32 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.478 0.144 0.407 0.863 1.183 10.327
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ wrk -t4 -c100 -d30s --latency http://127.0.0.1:8080/predict/biweekly-contest-152/1/25
Running 30s test @ http://127.0.0.1:8080/predict/biweekly-contest-152/1/25
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 75.57ms 32.14ms 490.57ms 85.10%
Req/Sec 337.43 69.15 530.00 76.79%
Latency Distribution
50% 71.32ms
75% 85.89ms
90% 103.88ms
99% 201.92ms
40414 requests in 30.11s, 269.38MB read
Requests/sec: 1342.26
Transfer/sec: 8.95MB
作者

Ligh0x74

发布于

2025-03-21

更新于

2025-03-21

许可协议

评论