title: I am getting too many open connections when the connection is kept alive
body: <p>I have a simple Go file with a purpose of returning a json response of a client's information. When I am benchmarking this script with apache benchmark, and the requests are kept alive</p>
  
  <pre><code>ab -t 10s -kc 1000 http://127.0.0.1:8080/clients/show/1
  </code></pre>
  
  <p>But when the requests are not kep alive, I do not suffer from this panic</p>
  
  <pre><code>ab -t 10s -c 1000 http://127.0.0.1:8080/clients/show/1
  </code></pre>
  
  <p><strong>error:</strong></p>
  
  <blockquote>
    <p>2018/10/26 03:26:42 http: panic serving 127.0.0.1:44800: Error 1040:
    Too many connections goroutine 220522 [running]:
    net/http.(*conn).serve.func1(0xc001779e00)</p>
  </blockquote>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>package main
  
  import (
      "database/sql"
      "encoding/json"
      "fmt"
      _ "github.com/go-sql-driver/mysql"
      "github.com/gorilla/mux"
      "net/http"
      "runtime"
  )
  
  type Client struct {
      ID         int    `json:"id"`
      UserID     int    `json:"user_id"`
      Name       string `json:"name"`
      Telephone  string `json:"telephone"`
      Email      string    `json:"email"`
      Category   sql.NullString `json:"string"`
      Notes      string `json:"notes"`
      Additional sql.NullString `json:"additional"`
      CreatedAt  sql.NullString `json:"created_at"`
      UpdatedAt  sql.NullString `json:"updated_at"`
      DeletedAt  sql.NullString `json:"deleted_at"`
  }
  
  func main() {
      runtime.GOMAXPROCS(runtime.NumCPU())
      r := mux.NewRouter()
  
      r.HandleFunc("/clients/show/{id}", showClient).Methods("GET")
  
      http.ListenAndServe(":8080", r)
  }
  
  func handler(w http.ResponseWriter, r *http.Request) {
      fmt.Fprintf(w, "Hello World!")
  }
  
  func showClient(w http.ResponseWriter, r *http.Request) {
  
      db, err := sql.Open("mysql", "root@tcp(127.0.0.1:3306)/crm")
  
      if err != nil {
          panic(err.Error())
      }
  
      var client Client
  
      // Execute the query
      err = db.QueryRow("SELECT * FROM clients where id = ?", 1).Scan(
          &amp;client.ID,
          &amp;client.UserID,
          &amp;client.Name,
          &amp;client.Telephone,
          &amp;client.Email,
          &amp;client.Category,
          &amp;client.Notes,
          &amp;client.Additional,
          &amp;client.CreatedAt,
          &amp;client.UpdatedAt,
          &amp;client.DeletedAt,
      )
  
      if err != nil {
          panic(err.Error())
      }
  
      db.Close()
  
      json.NewEncoder(w).Encode(client)
  }
  </code></pre>
  
  <p>Can someone please explain why this happens at such a low concurrent requests rate and what the correct way to fix this is.</p>