title: Response time when sending post to Http GCM server is very high
body: <p>I am developing an application server to send GCM messages. My application server is sending post requests to GCM connection servers with HTTP protocol. The average response time of a request is acceptable (around 100 milliseconds), but sometimes I'm getting responses with times greater than 1 second. More occasionally I've got some response times of 2, 4 seconds or even more.
  I'm using this library <a href="https://github.com/google/gcm" rel="nofollow">gcm-server</a> to send my requests to GCM servers. I believe it's owned by Google. 
  In order to despite the problem, I've made some analysis in the gcm-server library code but can't found any clue or answer. Ultimately, I decide to send some curl's with valid posts to GCM server. The results are the same. I'm sure this is not the expected behavior, maybe I'm doing something wrong, but can't find or understand what it is. </p>
  
  <p>Below is the script I'm running to test this. I'm sending 1000 post requests to GCM, without any definition of Keep-Alive (by default cURL uses Keep-Alive enabled).</p>
  
  <pre><code>#!/bin/bash
  
  for i in {1..1000}; do
  
      curl -s -w "%{http_code} - %{time_total}\n" -o /dev/null -X POST -H "Content-Type: application/json" -H "Authorization: key={putHereOneGCMValidToken}}" -H "Cache-Control: no-cache" -d '{
        "collapse_key": "92667ba1-c8e9-4018-bf14-156417065641",
        "delay_while_idle": false,
        "data": {
          "field1": "value1",
          "field2": "value2"
        },
        "time_to_live": 0,
        "registration_ids": [
          "REGISTRATION_ID_1",
          "REGISTRATION_ID_2",
          "BAD_REGISTRATION_ID"
        ]
      }' "https://gcm-http.googleapis.com/gcm/send";
      sleep 0.2;
  
  done
  </code></pre>
  
  <p>Reference: </p>
  
  <ul>
  <li><a href="https://developers.google.com/cloud-messaging/http-server-ref" rel="nofollow">GCM http server documentation</a> </li>
  </ul>