views:

1041

answers:

7

I created a Hello World website in Google App Engine. It is using Django 1.1 without any patch.

Even though it is just a very simple web page, it takes long time and often it times out.

Any suggestions to solve this?

Note: It is responding fast after the first call.

+2  A: 

If it's responding quickly after the first request, it's probably just a case of getting the relevant process up and running. Admittedly it's slightly surprising that it takes so long that it times out. Is this after you've updated the application and verified that the AppEngine dashboard shows it as being ready?

"First hit slowness" is quite common in many web frameworks. It's a bit of a pain during development, but not a problem for production.

Jon Skeet
I can confirm that this happened to me too. It seems that AppEngine puts your application to sleep if it's not accessed, and goes about a laborious process to first wake it up. I have experienced timeouts on an otherwise functional app. Once Dondon has his first million users, this won't be a problem any more :)
Carl Smotricz
+7  A: 

This is a horrible suggestion but I'll make it anyway:

Build a little client application or just use wget with cron to periodically access your app, maybe once every 5 minutes or so. That should keep Google from putting it into a dormant state.

I say this is a horrible suggestion because it's a waste of resources and an abuse of Google's free service. I'd expect you to do this only during a short testing/startup phase.

Carl Smotricz
+4  A: 

The solution Carl proposes is actually not that horrible at all, there is even a script for it on google's official appengine cookbook

Koen Bok
Be aware that being on the Cookbook doesn't mean that the solution is endorsed by Google.
Roberto Bonvallet
+2  A: 

I encounteres the same with pylons based app. I have the initial page server as static, and have a dummy ajax call in it to bring the app up, before the user types in credentials. It is usually enough to avoid a lengthy response... Just an idea that you might use before you actually have a million users ;).

Bartosz Radaczyński
+4  A: 

One more tip which might increase the response time.

Enabling billing does increase the quotas, and, to my personal experience, increase the overall response of an application as well. Probably because of the higher priority for billing-enabled applications google has. For instance, an app with billing disabled, can send up to 5-10 emails/request, an app with billing enabled easily copes with 200 emails/request.

Just be sure to set low billing levels - you never know when Slashdot, Digg or HackerNews notices your site :)

toinbis
+1  A: 

To summarize this thread so far:

  • Cold starts take a long time
  • Google discourages pinging apps to keep them warm, but people do not know the alternative
  • There is an issue filed to pay for a warm instance (of the Java)
  • There is an issue filed for Python. Among other things, .py files are not precompiled.
  • Some apps are disproportionately affected (can't find Google Groups ref or issue)
  • March 2009 thread about Python says <1s (!)

I see less talk about Python on this issue.

dfrankow
It's a common complaint with python when Django is involved. The huge amount of stuff that's imported doesn't work well with a system where instances are unloaded so frequently.
Wooble
A: 

i used pingdom for obvious reasons - no cold starts is a bonus. Of course the customers will soon come floking and it will be a none issue

danmux