Http timeouts are not being fully enforced when load testing

I been load testing my application and I notice that at times the connections do not timeout and I have to manually cancel the process . How can I make sure that timeouts work correctly every time ? This is my code

    package main

   import (

  func main() {
	r := mux.NewRouter()



        // This only displays html page
	r.PathPrefix("/").Handler(http.StripPrefix("/", http.FileServer(http.Dir("Views/"))))


	srv := &http.Server{
		ReadTimeout: 5 * time.Second,
		WriteTimeout: 5 * time.Second,
		Handler: nil,
		Addr: ":8000",

} ```

This image below shows that the last 3 requests takes about 120 seconds when I have the Timeouts set to 5 seconds. Any suggestions would be great as I am new to Golang

Not really an answer but I found this interesting article about Go’s http timeouts that shares some insights about the topic.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.