Optimizing Volley
Asked Answered
G

3

7

I am using Volley library in android.I run the same url in the browser and it returns in less than a second.I would like to know , how can optimize Volley? Not clear on what is the Cache Queue Take represents and why it is 3.6 seconds. or why cache queue take and network complete are added for a response time that is 6.8 seconds? How should I optimize volley for services that do not use ETags. Also what is the BasicNetwork.logSlowRequests

    07-26 09:52:31.395: D/Volley(5651): [4378] BasicNetwork.logSlowRequests: HTTP response   for request=<[ ]   http://theurl.com/path 0xd6183ced NORMAL 6> [lifetime=3172], [size=940], [rc=200],     [retryCount=0]
    07-26 09:52:31.400: D/Volley(5651): [4377] BasicNetwork.logSlowRequests: HTTP response for request=<[ ]   http://theurl.com/path 0xd6183ced NORMAL 5> [lifetime=3182], [size=940], [rc=200], [retryCount=0]
    07-26 09:52:31.445: D/Volley(5651): [1] MarkerLog.finish: (6848 ms) [ ]   http://theurl.com/path 0xd6183ced NORMAL 6
    07-26 09:52:31.445: D/Volley(5651): [1] MarkerLog.finish: (+0   ) [ 1] add-to-queue
    07-26 09:52:31.445: D/Volley(5651): [1] MarkerLog.finish: (+3622) [4376] cache-queue-take
    07-26 09:52:31.450: D/Volley(5651): [1] MarkerLog.finish: (+6   ) [4376] cache-hit-expired
    07-26 09:52:31.450: D/Volley(5651): [1] MarkerLog.finish: (+0   ) [4378] network-queue-take
    07-26 09:52:31.450: D/Volley(5651): [1] MarkerLog.finish: (+3173) [4378] network-http-complete
    07-26 09:52:31.450: D/Volley(5651): [1] MarkerLog.finish: (+36  ) [4378] network-parse-complete
    07-26 09:52:31.450: D/Volley(5651): [1] MarkerLog.finish: (+11  ) [4378] network-cache-written
    07-26 09:52:31.450: D/Volley(5651): [1] MarkerLog.finish: (+0   ) [4378] post-response
    07-26 09:52:31.455: D/Volley(5651): [1] MarkerLog.finish: (+0   ) [ 1] done
    07-26 09:52:31.455: D/
    07-26 09:52:31.525: D/Volley(5651): [1] MarkerLog.finish: (6998 ms) [ ]   http://myurl  0xd6183ced NORMAL 5
    07-26 09:52:31.525: D/Volley(5651): [1] MarkerLog.finish: (+0   ) [ 1] add-to-queue
    07-26 09:52:31.530: D/Volley(5651): [1] MarkerLog.finish: (+3683) [4376] cache-queue-take
    07-26 09:52:31.530: D/Volley(5651): [1] MarkerLog.finish: (+7   ) [4376] cache-hit-expired
    07-26 09:52:31.530: D/Volley(5651): [1] MarkerLog.finish: (+1   ) [4377] network-queue-take
    07-26 09:52:31.530: D/Volley(5651): [1] MarkerLog.finish: (+3184) [4377] network-http-complete
    07-26 09:52:31.535: D/Volley(5651): [1] MarkerLog.finish: (+39  ) [4377] network-parse-complete
    07-26 09:52:31.535: D/Volley(5651): [1] MarkerLog.finish: (+21  ) [4377] network-cache-written
    07-26 09:52:31.535: D/Volley(5651): [1] MarkerLog.finish: (+0   ) [4377] post-response
    07-26 09:52:31.535: D/Volley(5651): [1] MarkerLog.finish: (+63  ) [ 1] done
Gertie answered 26/7, 2013 at 17:11 Comment(2)
anyone listening on android-volley?Gertie
check this may be it helps you.Graniah
P
5

I just answered this here : How to optimize network-queue-take in android Volley? (Volley Google IO 2013)

logSlowRequests just logs requests that are slow (over 3000ms), nothing more complicated there. network-http-complete is how long it takes to download the request and pass it off to the parser.

Pollitt answered 16/8, 2013 at 8:42 Comment(1)
Hi Can you tell me what does lifetime means in this : BasicNetwork.logSlowRequests: HTTP response for request=<[ ] http:// 0xcb458ba0 NORMAL 1> [lifetime=7106],Evzone
E
1

Try To use this Enhanced-volley

This project is based on the Volley Networking Toolkit for Android created by Google themselves. The toolkit itself is really great and extensible, but it is missing a few features. This project aims to add those features to the Volley toolkit to make it a more complete HTTP solution.

Also you can custom libs which uses Java NIO(new IO) to improve callback/response time. using Socket.IO

Some people also trying to use volley with OKHTTP

Thanks to Mr.Vinay

Essentialism answered 23/8, 2013 at 4:4 Comment(0)
A
0

I had a similar kind of situation. I didn't notice the time delays as you did, but it was showing up in the browser and not in my app. Essentially, clearing the cache helped me out.

You can clear the cache by:

Requestqueue.getcache().clear();

If you want to disable the caching for jsonrequests, you can do that by:

jsonrequest.setshouldcache(false)

This had solved my problem of the caching.

Alderete answered 10/6, 2020 at 2:59 Comment(1)
jsonrequest.setShouldCache(false);Berny

© 2022 - 2024 — McMap. All rights reserved.