title: Http request slow for the first time and when waiting too long
body: <p>I'm using the Apache DefaultHttpClient in an Android app to make a get request to a webserver (URL doesn't matter, the phenomenon is seen for different servers/websites). The first request using the HTC Desire with the 3G network takes several seconds (>4s), subsequent ones roughly only 0.5s. If I wait more than ~15 seconds before making the next request, this next request again needs several seconds. 
  The request is using HTTP1.1, the server time is not the problem. DNS lookup is also not the problem, as I tried using the IP as well.</p>
  
  <p>For me it looks like either some connection timeout setting in the Apache framework or my HTC device putting the network interface to sleep (if it does this at all).</p>
  
  <p>The coding is pretty simple, it looks like this:</p>
  
  <pre><code>HttpGet get = new HttpGet(uri);
  long startTimeMillisRequest = System.currentTimeMillis();
  HttpResponse response = client.execute(get);
  long endTimeMillisRequest = System.currentTimeMillis();
  </code></pre>
  
  <p>Does anyone have a clue for the reason or experience the same thing?
  I already put this into an AsyncTask, but still I'd like to know why it is this slow.</p>
  
  <p>Thanks,
  Martin</p>