Please enable Javascript to view the contents
AGFS 文件系统性能测试
1. 安装 wrk
2. localfs 性能测试
2.1 1KB 小文件测试
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| cat > put-1k.lua <<"EOF"
wrk.method = "PUT"
wrk.body = string.rep("a", 1024)
wrk.headers["Content-Type"] = "text/plain"
counter = 0
local WRAP = 500000
request = function()
counter = counter + 1
local n = ((counter - 1) % WRAP) + 1
local filename = "/local/perf-1k/test_" .. n .. ".txt"
local path = "/api/v1/files?path=" .. filename
return wrk.format(nil, path)
end
EOF
|
1
| curl -X POST "http://127.0.0.1:8080/api/v1/directories?path=/local/perf-1k"
|
1
| wrk -t4 -c40 -d30s -s put-1k.lua "http://127.0.0.1:8080"
|
1
2
3
4
5
6
7
8
| Running 30s test @ http://127.0.0.1:8080
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.12ms 3.50ms 84.69ms 93.89%
Req/Sec 3.72k 1.02k 5.72k 73.92%
443823 requests in 30.01s, 59.68MB read
Requests/sec: 14791.48
Transfer/sec: 1.99MB
|
1
2
3
4
5
6
7
8
9
10
11
12
| cat > get-1k.lua <<"EOF"
wrk.method = "GET"
counter = 0
local WRAP = 10000
request = function()
counter = counter + 1
local n = ((counter - 1) % WRAP) + 1
local filename = "/local/perf-1k/test_" .. n .. ".txt"
local path = "/api/v1/files?path=" .. filename
return wrk.format(nil, path)
end
EOF
|
1
| wrk -t4 -c40 -d30s -s get-1k.lua "http://127.0.0.1:8080"
|
1
2
3
4
5
6
7
8
| Running 30s test @ http://127.0.0.1:8080
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 738.85us 1.30ms 26.79ms 89.12%
Req/Sec 31.47k 3.02k 43.39k 68.42%
3756234 requests in 30.01s, 4.00GB read
Requests/sec: 125169.00
Transfer/sec: 136.32MB
|
1
| wrk -t4 -c40 -d30s "http://127.0.0.1:8080/api/v1/directories?path=/local/perf-1k"
|
1
2
3
4
5
6
7
8
| Running 30s test @ http://127.0.0.1:8080/api/v1/directories?path=/local/perf-1k
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 925.62ms 106.94ms 1.51s 78.75%
Req/Sec 13.39 8.78 50.00 80.42%
1275 requests in 30.04s, 21.39GB read
Requests/sec: 42.44
Transfer/sec: 729.28MB
|
2.2 4KB 小文件测试
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| cat > put-4k.lua <<"EOF"
wrk.method = "PUT"
wrk.body = string.rep("a", 4096)
wrk.headers["Content-Type"] = "text/plain"
counter = 0
local WRAP = 500000
request = function()
counter = counter + 1
local n = ((counter - 1) % WRAP) + 1
local filename = "/local/perf-4k/test_" .. n .. ".txt"
local path = "/api/v1/files?path=" .. filename
return wrk.format(nil, path)
end
EOF
|
1
| curl -X POST "http://127.0.0.1:8080/api/v1/directories?path=/local/perf-4k"
|
1
| wrk -t4 -c40 -d30s -s put-4k.lua "http://127.0.0.1:8080"
|
1
2
3
4
5
6
7
8
| Running 30s test @ http://127.0.0.1:8080
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.91ms 2.01ms 40.08ms 89.01%
Req/Sec 3.69k 695.58 5.41k 76.67%
441076 requests in 30.01s, 59.31MB read
Requests/sec: 14698.37
Transfer/sec: 1.98MB
|
1
2
3
4
5
6
7
8
9
10
11
12
| cat > get-4k.lua <<"EOF"
wrk.method = "GET"
counter = 0
local WRAP = 10000
request = function()
counter = counter + 1
local n = ((counter - 1) % WRAP) + 1
local filename = "/local/perf-4k/test_" .. n .. ".txt"
local path = "/api/v1/files?path=" .. filename
return wrk.format(nil, path)
end
EOF
|
1
| wrk -t4 -c40 -d30s -s get-4k.lua "http://127.0.0.1:8080"
|
1
2
3
4
5
6
7
8
| Running 30s test @ http://127.0.0.1:8080
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 636.01us 0.94ms 21.45ms 87.28%
Req/Sec 23.76k 2.11k 29.46k 70.33%
2836971 requests in 30.02s, 11.18GB read
Requests/sec: 94511.49
Transfer/sec: 381.53MB
|
1
| wrk -t4 -c40 -d30s "http://127.0.0.1:8080/api/v1/directories?path=/local/perf-4k"
|
1
2
3
4
5
6
7
8
| Running 30s test @ http://127.0.0.1:8080/api/v1/directories?path=/local/perf-4k
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 942.52ms 101.78ms 1.39s 76.91%
Req/Sec 13.16 9.05 70.00 80.40%
1256 requests in 30.06s, 20.91GB read
Requests/sec: 41.79
Transfer/sec: 712.24MB
|
2.3 512KB 大文件测试
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| cat > put-512k.lua <<"EOF"
wrk.method = "PUT"
wrk.body = string.rep("a", 512 * 1024)
wrk.headers["Content-Type"] = "text/plain"
counter = 0
local WRAP = 500000
request = function()
counter = counter + 1
local n = ((counter - 1) % WRAP) + 1
local filename = "/local/perf-512k/test_" .. n .. ".txt"
local path = "/api/v1/files?path=" .. filename
return wrk.format(nil, path)
end
EOF
|
1
| curl -X POST "http://127.0.0.1:8080/api/v1/directories?path=/local/perf-512k"
|
1
| wrk -t4 -c40 -d30s -s put-512k.lua "http://127.0.0.1:8080"
|
1
2
3
4
5
6
7
8
| Running 30s test @ http://127.0.0.1:8080
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 24.56ms 4.42ms 61.28ms 78.08%
Req/Sec 402.50 38.55 525.00 68.42%
48111 requests in 30.02s, 6.56MB read
Requests/sec: 1602.42
Transfer/sec: 223.78KB
|
1
2
3
4
5
6
7
8
9
10
11
12
| cat > get-512k.lua <<"EOF"
wrk.method = "GET"
counter = 0
local WRAP = 10000
request = function()
counter = counter + 1
local n = ((counter - 1) % WRAP) + 1
local filename = "/local/perf-512k/test_" .. n .. ".txt"
local path = "/api/v1/files?path=" .. filename
return wrk.format(nil, path)
end
EOF
|
1
| wrk -t4 -c40 -d30s -s get-512k.lua "http://127.0.0.1:8080"
|
1
2
3
4
5
6
7
8
| Running 30s test @ http://127.0.0.1:8080
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.33ms 1.33ms 23.09ms 78.83%
Req/Sec 3.37k 231.83 3.95k 70.50%
403535 requests in 30.08s, 197.09GB read
Requests/sec: 13415.50
Transfer/sec: 6.55GB
|
1
| wrk -t4 -c40 -d30s "http://127.0.0.1:8080/api/v1/directories?path=/local/perf-512k"
|
1
2
3
4
5
6
7
8
| Running 30s test @ http://127.0.0.1:8080/api/v1/directories?path=/local/perf-512k
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 93.34ms 11.21ms 143.77ms 68.84%
Req/Sec 107.37 13.03 151.00 75.81%
12837 requests in 30.03s, 23.49GB read
Requests/sec: 427.46
Transfer/sec: 800.87MB
|
3. 总结
40 并发、4 线程、持续 30 秒测试
| 插件 | 场景 | Requests/sec | 平均延迟 | 传输速率 | 非 2xx 比例 |
|---|
| localfs | 写文件 | 14791.48 | 3.12ms | 1.99MB | 0% |
| localfs | 读文件 | 125169.00 | 738.85us | 136.32MB | 0% |
| localfs | 列目录 | 42.44 | 925.62ms | 729.28MB | 0% |
| 插件 | 场景 | Requests/sec | 平均延迟 | 传输速率 | 非 2xx 比例 |
|---|
| localfs | 写文件 | 14698.37 | 2.91ms | 1.98MB | 0% |
| localfs | 读文件 | 94511.49 | 636.01us | 381.53MB | 0% |
| localfs | 列目录 | 41.79 | 942.52ms | 712.24MB | 0% |
| 插件 | 场景 | Requests/sec | 平均延迟 | 传输速率 | 非 2xx 比例 |
|---|
| localfs | 写文件 | 1602.42 | 24.56ms | 223.78KB | 0% |
| localfs | 读文件 | 13415.50 | 2.33ms | 6.55GB | 0% |
| localfs | 列目录 | 427.46 | 93.34ms | 800.87MB | 0% |
512KB 下列目录的文件数量少,因此性能更好。
整体来看,localfs 的性能还是不错的。
4. 参考