I have an application that makes numerous calls to REST web services I have written. I have noticed in general that when I added SSL the web calls went from <1 sec to ~3sec to execute. Is that normal when adding SSL? I have measured the times using the Droid, HTC Thunderbolt, and Samsung Tablet (all on Verizon).
What is really CRAZY is: whenever using a phone on the TMobile netw开发者_运维技巧ork (Comet and Nexus) those same calls (over HTTPs) take 30-40 seconds each. If I remove SSL those same calls take <1s just like the other devices. Any clue as to why SSL on the TMobile devices is having this issues? I am stumped?
Code:
String url = BASE_URL + path;
HttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter("http.socket.timeout", new Integer(30000));
httpclient.getParams().setParameter("setSocketBufferSize", 8192);
HttpPost httppost = new HttpPost(url);
httppost.addHeader("Content-Type", "text/json");
InputStream istream = null;
try {
httppost.setEntity(new StringEntity(request.toString()));
HttpResponse response = httpclient.execute(httppost);
istream = response.getEntity().getContent();
String result = IOUtils.toString(istream);
...
精彩评论