Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Volley: http requests slow

If I make two HTTP requests to the same URL, one with only HttpClient and the other with Volley, the Volley requests takes much longer.

For example, in my test environment:

  • using HttpClient directly to request google.com averages about 250ms
  • using Volley to request google.com averages about 750ms

here's a log dump of a sample Volley request:

11:44:14.766: D/Volley(863): [1] MarkerLog.finish: (773  ms) [ ] http://google.com 0xa46e044c NORMAL 1
11:44:14.766: D/Volley(863): [1] MarkerLog.finish: (+0   ) [ 1] add-to-queue
11:44:14.786: D/Volley(863): [1] MarkerLog.finish: (+0   ) [93] cache-queue-take
11:44:14.786: D/Volley(863): [1] MarkerLog.finish: (+7   ) [93] cache-hit-expired
11:44:14.796: D/Volley(863): [1] MarkerLog.finish: (+1   ) [97] network-queue-take
11:44:14.806: D/Volley(863): [1] MarkerLog.finish: (+722 ) [97] network-http-complete
11:44:14.806: D/Volley(863): [1] MarkerLog.finish: (+20  ) [97] network-parse-complete
11:44:14.816: D/Volley(863): [1] MarkerLog.finish: (+16  ) [97] network-cache-written
11:44:14.826: D/Volley(863): [1] MarkerLog.finish: (+0   ) [97] post-response
11:44:14.836: D/Volley(863): [1] MarkerLog.finish: (+7   ) [ 1] done

as you can see, the bottleneck is in the actual HTTP request. Why is it so much slower?

like image 284
Keith Avatar asked Jun 07 '13 18:06

Keith


1 Answers

Looks like Volley is caching your response. Using HttpClient directly does not cache anything.

like image 65
Paul Turchenko Avatar answered Oct 16 '22 14:10

Paul Turchenko