High latency spikes with fasthttp simple example

365 Views Asked by At

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
0

There are 0 best solutions below