2
votes

A friend and I are currently working on a turn-based game with chat with both desktop browser and Android clients, with Google App Engine as the server.

We're using the Java API for GAE and using HTTP for communication with the server. We've implemented simple chat functionality, and we're getting undesirable latencies 1-3 seconds from both the browser and Android clients while just posting simple one-word chat messages.

My friend thought it would be best to use XMPP instead of HTTP, but we want to use a Google Accounts cookie for authentication from the Android client, and according to the GAE documentation, XMPP clients cannot use a Google Accounts cookie and must use the user's password.

Does anyone have any suggestions as to where the latency might be coming from, how to troubleshoot it, and/or what to do about it?

Also, is anyone aware of any opensource implementations of chat (or something similar) on GAE done in Java? Can't seem to find any.

2
How are you doing for the server comunicating with clients? I mean. When A writes a message to B, how client B knows there's a message? Polling? If it's the case latency will be high anyway so I'd suggest researching about "comet". A way to implement "server-push": it is, the server writing the client the exact time it needs. The way to do it is over HTTP. The client connects to the server and waits the response but the server must be prepared. Having 1.000 clients connected simultaneously (and waiting for a maybe-distant response) is not acceptable with normal HTTPrequest. Thats a job 4comet.helios
helios, any hints on how to do comet on app engine? I was under the impression it is impossible.Peter Recore
i would be interested in finding a way to do this as well. It appears that there is no way to do it with Comet currently. Please post if you have had any luckHortinstein

2 Answers

0
votes

One way to analyze the situation would be to use Wireshark to look at the network traffic during the delays.

0
votes

You don't say how your chat messages are getting from one JVM to the other. If you're using the datastore, maybe try memcache?

Also, startup time is often an issue; app engine starts and stops JVMs all the time, particularly for a low-traffic app. A way to diagnose this is to reload the page a bunch of times (send more messages) and see if it gets faster after a while. It should be pretty easy to tell the difference in the admin console logs.