title: Fastest way to send multiple HTTP requests
body: <p>I have an array of about 2000 user objects (maps) that I need to call an API to get the user detail -> process the response -> update my local DB as soon as possible. I used Go's waitgroup and goroutine to implement the concurrent request sending method, however to call 2000 requests it would take about 24 seconds on my 2014 Macbook Pro. Is there anyway to make it faster?</p>
  
  <pre><code>var wg sync.WaitGroup
  
  json.Unmarshal(responseData, &amp;users)
  wg.Add(len(users))
  
  for i:= 0; i&lt;len(users); i++ {
      go func(userid string){
          url := "https://www.example.com/user_detail/"+ userid
          response, _ := http.Get(url) 
          defer response.Body.Close()
          data, _ := ioutil.ReadAll(response.Body)
          wg.Done()
      }(users[i]["userid"])
  }
  
  wg.Wait()
  </code></pre>