Varnish backend timeout doesn't work with keep alive backend
Dridi Boukelmoune
dridi at varni.sh
Wed Dec 28 13:54:42 CET 2016
On Wed, Dec 28, 2016 at 11:45 AM, JackDrogon <jack.xsuperman at gmail.com> wrote:
> OK.
> I run a go server, such as:
>
> func handler(res http.ResponseWriter, req *http.Request) {
> atomic.AddUint32(×, 1)
> number := rand.Intn(100)
> fmt.Printf("Random number: %d.\n", number)
> t := atomic.LoadUint32(×)
> if t%4 == 1 {
> time.Sleep(7 * time.Second)
> }
> fmt.Fprintf(res, "Random number: %d.\n", number)
> fmt.Println("=========================")
> }
>
>
> I use this as varnish backend, and setting hash_always_miss
> so I curl 127.0.0.1:8000 for 5 times.
>
> curl 127.0.0.1:8000 0.00s user 0.00s system 0% cpu 2 total
> curl 127.0.0.1:8000 0.00s user 0.00s system 77% cpu 0.005 total
> curl 127.0.0.1:8000 0.00s user 0.00s system 66% cpu 0.005 total
> curl 127.0.0.1:8000 0.00s user 0.00s system 68% cpu 0.004 total
> curl 127.0.0.1:8000 0.00s user 0.00s system 0% cpu 7.005 total
>
> I think the fifth requet's time usage is 2s, but It's 7s. How can I set
> varnish to make it be 2s
I thought this bug had been fixed, but apparently not. A workaround
would be to disable keep-alive by forcefully closing backend
connections. With the obvious performance implication of having to
reconnect for every single request.
I'll try to remember to discuss this during next Monday's bugwash.
Dridi
More information about the varnish-misc
mailing list