0

I sampled 5 minutes latency with an simple fasthttp example in 100QPS, and found high latency spikes (up to 9ms latency but less than 1ms most of the time) in the result:

see the latency chart

Is the latency spikes normal or I missing something?

Test environment:

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

the fasthttp test example is:

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())
    }
}

And I used vegeta to sample the latency report, latency sampling commands like this:

# 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
xiaowenxia
  • 17
  • 2
  • It could be the garbage collector. You can use the `GODEBUG=gctrace=1` to get continuous output, which is documented in the [runtime](https://golang.org/pkg/runtime/) package ([SO link](https://stackoverflow.com/a/34072767/13906951)). – Clark McCauley Jun 29 '21 at 03:14
  • @ClarkMcCauley Thank you for your answer. But I disabled garbage collector by `GOGC=off` and I got the same result... – xiaowenxia Jun 29 '21 at 04:01
  • Ask the author of fasthttp. – Volker Jun 29 '21 at 04:31

0 Answers0