0

我在 100QPS 中使用一个简单的fasthttp示例对 5 分钟的延迟进行了采样,并在结果中发现了高延迟峰值(延迟高达 9 毫秒,但大多数时候小于 1 毫秒):

查看延迟图表

延迟峰值是正常的还是我错过了什么?

测试环境:

  • ecs.t5-c1m1.xlarge: 4 CPU , 4G 内存

fasthttp 测试示例是:

package main

import (
    "fmt"
    "github.com/valyala/fasthttp"
)

func httpHandle(ctx *fasthttp.RequestCtx) {
    fmt.Fprintf(ctx, "hello world")
}

func main() {
    if err := fasthttp.ListenAndServe("0.0.0.0:7070", httpHandle); err != nil {
        fmt.Println("start fasthttp fail:", err.Error())
    }
}

我使用vegeta对延迟报告进行采样,延迟采样命令如下:

# sampling
$ echo "GET http://localhost:7070/fasthttp/hello" | ./vegeta attack -duration=5m -rate 100 | tee results.fasthttp.bin | ./vegeta report

# generate report
$ cat results.fasthttp.bin | ./vegeta plot > plot.fasthttp.html
4

0 回答 0