I've been using a threadpool to download a set of independent files. I use 
an ExecutorService and call execute() on a singleton HttpClient similar to 
AndroidHttpClient. All is going fairly well. 

However, I see one behavior that is fairly consistent on my Galaxy Tab 10.1 
with Android 3.1. 
First, I leave the device unatttended for five minutes. 
Next I trigger a new screenfull of downloads by scrolling or zooming. 
The first five or six calls to client.execute(request) will fail with a 
SocketTimeoutException. Seems related to the size of the threadpool (6). It 
takes them 20 seconds to fail under current settings. This is compared to 
the sixty milliseconds it would take them for a successful request.  
Subsequent requests succeed, but the thread pool is held up for a while by 
the first failures. 

The stale connection check is disabled in AndroidHttpClient. I've done the 
same to be consistent.   However, turning it on doesn't make much 
difference. I get three failures instead of six, so it might have caught 
some that were stale, at a cost that Android engineers deemed too high. I'm 
not sure if stale checking involves a round trip to the server or what the 
performance penalty is. 

    // Turn off stale checking.  Our connections break all the time anyway,
    // and it's not worth it to pay the penalty of checking every time.
    HttpConnectionParams.setStaleCheckingEnabled(params, false);

Now, there is no shortage of other parameters to tweak, keepalive strategy, 
shorter timeouts, retry handler, telling the connectionmanager to expire 
connections. The cross product of all of these with the number of devices 
and possible web addresses, though, is large. Are there suggestions people 
can give me of a sane way to go about this? I'm sure some of you are old 
hands at this. 

Thanks for any tips.   

Nathan 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to