views:

176

answers:

3

Reading the Google App Engine documentation on asynchronous URL Fetch:

The app can have up to 10 simultaneous asynchronous URL Fetch calls

What happens if an application calls more than 10 async fetch at a time?
Does Google App Engine raise an exception or simply queue the remain calls waiting to serve them?

+2  A: 

500 errors start happening. Silently.

You only find out about these when you look at your log under all requests (don't get listed as errors). It simply says "The request was aborted because you reached your simultaneous requests limit".

So when you're making lots of asynchronous calls, make sure you can handle some of them spazzing out.

Swizec Teller
Mind you the same happens for any and all requests. Like eating through a task queue or such. Apparently if your responses are very very fast (under 100ms I think) Google is willing to put up with a lot and won't throw this error.
Swizec Teller
@Swizec uhm.. this is not happening to my application (I don't see 500 errors). I'm on border case with 11-13 calls though.
systempuntoout
+6  A: 

Umm, Swizzec is incorrect. Easy enough to test:

rpc = []
for in range(1,20):
    rpc.append(urlfetch.createrpc())
    urlfetch.make_fetch_call(rpc[-1],"http://stackoverflow.com/questions/3639855/what-happens-if-i-call-more-than-10-asynchronous-url-fetch")

for r in rpc:
    response = r.get_result().status_code

This does not return any exceptions. In fact, this works just fine! Note that your results may vary for non-billable applications.

What Swizec is reporting is a different problem, related to maximum simultaneous connections INTO your application. For billable apps there is no practical limit here btw, it just scales out (subject to the 1000ms rule).

GAE has no way of knowing that your request handler will issue a blocking URL fetch, so the connection 500's he is seeing are not related to what his app is actually doing (that's an oversimplification btw, if your average request response time is > 1000ms your likelyhood of 500's increases).

Cloudbreak NZ
oops. sorry about the formatting...
Cloudbreak NZ
A: 

See if this answers your question:

http://groups.google.com/group/google-appengine/browse_thread/thread/1286139a70ef83c5?fwc=1

anand