1

I am using a modified version of the TaskCloud example to try and read/write my own data.

While testing on a a deployed version, I've noticed that the round-trip response time is slow.

From my Android device, I have a 100ms ping response to appspot.com. I have changed the AppEngine application to do nothing (The Google Dashboard shows insignificant Average Latency.

The problem is that the time it takes for HttpClient client .execute(post) is about 3 seconds. (This is the time when an instance is already loaded)

Any suggestions would be greatly appreciated.

EDIT: I've watched the video of Google I/O showing the CloudTasks Android-AppEngine app, and you can see that refreshing the list (a single call to AppEngine) takes about 3 seconds as well. The guy is saying something about performance which I didn't fully get (debuggers are running at both ends?)

The video: http://www.youtube.com/watch?v=M7SxNNC429U&feature=related Time location: 0:46:45

I'll keep investigating... Thanks for your help so far.

EDIT 2: Back to this issue...

I've used shark packet sniffer to find out what is happening. Some of the time is spent negotiating a SSL connection for each server call. Using http (and ACSID) is faster than https (and SACSID).

new DefaultHttpClient() and new HttpPost() are used for each server call.

EDIT 3:

Looking at the sniffer logs again, there is an almost 2 seconds delay before the actual POST.

I have also found out that the issue exists with Android 2.2 (all versions) but is resolved with Android 2.3

EDIT 4: It's been resolved. Please see my answer below.

OferR
  • 1,634
  • 19
  • 21
  • You say the wallclock time on your Android app is 3 seconds. What does it show as in the Admin Console logs on App Engine? Any difference between the two is down to round-trip time between your device and the app, and the time taken to download the response over the network. Bear in mind that an HTTP transaction involves multiple roundtrips, and that the frontend doesn't serve the app - the app is physically elsewhere. – Nick Johnson Jun 08 '11 at 01:11
  • Thanks Nick. I removed all functionality from the app, so the AppEngine Admin Console log shows an average of less than 100ms. I am located outside of the US, but 3 seconds is a way too much. (In comparison, it takes 900ms to programmatically write a line in Google Documents Excel sheet) Nick, what does your wallclock time say for an AppEngine access? TIA – OferR Jun 08 '11 at 04:00
  • In that case, almost all of the delay is down to the actual roudntrip time to your app, and to delays in the cellular network, not due to App Engine itself (or your app). – Nick Johnson Jun 08 '11 at 05:43
  • @Nick, I have added an EDIT to my question. – OferR Jun 08 '11 at 20:55
  • @Nick, I have added an EDIT2 to my question. You were right to say that it is down to the network (wifi), but there is some hope still (see EDIT2). Your help is very much appreciated. Thanks.. – OferR Oct 15 '11 at 00:04

3 Answers3

1

It's difficult to answer your question since no detail about your app is provided. Anyway you can try to use appstats tool provided by Google to analyze the bottleneck.

shuaiyuancn
  • 2,744
  • 3
  • 24
  • 32
  • Thanks Shuai. I'll have a look at the tools. I also wanted to know whether the 3 seconds response time is or isn't the norm with AppEngine. What type of response time do you get? And I mean response time for the client (Google shows <100ms average latency on the dashboard) – OferR Jun 07 '11 at 15:18
  • @OferR Well it really depends on your task. Would you please give more detail on your app logic? The latency on the dashboard is the response time for new requests, i.e the time to wait before starting to execute(post), rather than the time consumed by execute(post). You can consider your app on GAE automatically multi-threaded as when a new request comes in it will be handled as long as enough resource exists. – shuaiyuancn Jun 07 '11 at 17:52
  • As part of trying to figure it out, I have stripped all app logic out. It does nothing. Request is served by the SDK's com.google.web.bindery.requestfactory.server.RequestFactoryServlet, which calls my app. BTW, I tested the unmodified Google I/O example CloudTasks, and I am getting the same 3 seconds response time running it from either my android device or from the PC's browser. (http://cloudtasksio.appspot.com/). My question is at this point in time: Does anyone get a better than 3 seconds client response time from an AppEngine app? – OferR Jun 07 '11 at 18:20
  • @OferR Haven't tried on mobile devices. But surely it's in a flash: `resp.write("Hello World");` – shuaiyuancn Jun 08 '11 at 14:07
  • @Shuai, I have added an EDIT to my question. – OferR Jun 08 '11 at 20:56
  • @OferR I suggest you do a test like in [this post](http://stackoverflow.com/q/4276127/671072) – shuaiyuancn Jun 09 '11 at 13:06
1

After using the Shark sniffer, I was able to understand the exact issue and I've found the answer in this question.

I have used Liudvikas Bukys's comment and solved the problem using the suggested line:

post.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
Community
  • 1
  • 1
OferR
  • 1,634
  • 19
  • 21
0

Often the first call to your GAE app will take longer than subsequent calls. You should make yourself familiar with loading and warm-up requests and how GAE handles instances of your app: http://code.google.com/intl/de-DE/appengine/docs/adminconsole/instances.html

Some things you could also try:

Stefan
  • 736
  • 4
  • 18
  • Thanks Stefan. As I said, 3 seconds is the time when the instance is loaded already (subsequent calls). Are you experiencing 3 seconds response time for subsequent calls? – OferR Jun 07 '11 at 11:45