로컬 호스트의 http 대기 시간은 크게 다릅니다.

로컬 호스트의 http 대기 시간은 크게 다릅니다.

10개의 코어가 있는 MBP M1에서 실행됩니다. 1개의 스레드 클라이언트(wrk)와 1개의 스레드 서버(java)를 실행합니다. YouTube도 시스템에서 실행 중입니다. 로드 평균은 10점 만점에 2점입니다. 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 웹 서버를 사용할 때도 동일한 변경 사항이 발생합니다. 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
        },
    ]
}

관련 정보