在具有 10 个核心的 MBP M1 上运行。运行 1 个线程客户端 (wrk) 和 1 个线程服务器 (java)。系统上还运行着 YouTube。平均负载为 2 分(满分 10 分)。除了 GC,以下哪些可能是造成延迟差异巨大的原因?
"percentile": 0,
"latency_in_microseconds": 10
},
{
"percentile": 50,
"latency_in_microseconds": 16
},
{
"percentile": 99,
"latency_in_microseconds": 51
},
{
"percentile": 99.9,
"latency_in_microseconds": 1500
},
{
"percentile": 99.99,
"latency_in_microseconds": 9598
},
{
"percentile": 99.999,
"latency_in_microseconds": 15021
}
使用 nginx 或 Rust Web 服务器时也会发生同样的变化。在 M1、Linux docker 或 Linux EC2 机器上也是如此。是什么导致了从 10 微秒到 15 毫秒如此巨大的变化?谢谢
答案1
实际上,如果我每 5 毫秒执行一次 epoll/select,上限就会变得更低一些。
wrk -d2134 -t2 -c10 http://127.0.0.1:8089 -s script.lua took 17s at 10:14:19
Running 36m test @ http://127.0.0.1:8089
2 threads and 10 connections
^C Thread Stats Avg Stdev Max +/- Stdev
Latency 40.98us 18.24us 3.62ms 80.67%
Req/Sec 109.03k 3.86k 115.50k 68.43%
24368820 requests in 1.87m, 1.72GB read
Requests/sec: 216998.38
Transfer/sec: 15.73MB
JSON Output:
{
"requests": 24368820,
"duration_in_microseconds": 112299548.00,
"bytes": 1852030320,
"requests_per_sec": 216998.38,
"bytes_transfer_per_sec": 16491876.89,
"latency_distribution": [
{
"percentile": 0,
"latency_in_microseconds": 10
},
{
"percentile": 90,
"latency_in_microseconds": 61
},
{
"percentile": 99,
"latency_in_microseconds": 88
},
{
"percentile": 99.5,
"latency_in_microseconds": 95
},
{
"percentile": 99.9,
"latency_in_microseconds": 117
},
{
"percentile": 99.95,
"latency_in_microseconds": 128
},
{
"percentile": 99.99,
"latency_in_microseconds": 230
},
{
"percentile": 99.999,
"latency_in_microseconds": 1803
},
]
}