AppEngine ups and downs

So i recently started using appengine, it should be noted i’m VERY new to it. I come from django background so this is mostly the comparison between the two.

Let’s start with the classic argument, price! A lot of people compare EC2 and GAE (Google AppEngine) prices, they are not really comparable. EC2 provides you easily spawnable machines, as many as you need, leaving the scalability to you. It means your programmers have to worry about shredding the database, your sys admins about adding more web nodes… On the GAE side you just write code, effectively outsourcing both the hardware and sys admin to Google. The advantage EC2 has is that you can use any technology under the sun, with GAE you are forced to use their platform. Does it in pure money pay off to use GAE? No idea :) , but if you get big you can iterate faster becouse you don’t have to worry about scaling (which can be a major competitive advantage). To be honest most of the sites out there don’t need anything more than what can be easily scaled.

The schema-less development is definitely one of technical things i like about GAE. South is cool, but not having to care at all about the schema is just a major pain relief.

$ appcfg.py -e  update .
Scanning files on local disk.
Scanned 500 files.
Scanned 1000 files.
Initiating update.
Password for : 
Cloning 154 static files.
Cloned 100 files.
Cloning 224 application files.
Cloned 100 files.
Cloned 200 files.
Uploading 2 files.
Deploying new version.
Checking if new version is ready to serve.
Will check again in 1 seconds.
Checking if new version is ready to serve.
Will check again in 2 seconds.
Checking if new version is ready to serve.
Closing update: new version is ready to start serving.
Uploading index definitions.
Uploading cron entries.

Next thing i like very much is the deployment, you type a command poof it works. It has its downsides as well tho, unlike say svn, it is not capable of remembering the credentials. Next problem is that it deploys only as the app specified in config file, making it more difficult to do a test deploy first (this is just a minor annoyance).


Like you can see above, if it’s good, it’s really really good, likewise when it is bad, it is really really bad.

In [1]: from myapp.models import User
In [2]: User.all().count()
....
BadArgumentError: _app must not be empty.

Hello? I just want to do a simple ORM query? As it turns out i’m not the only one to have this problem, i copy/pasted stuff i found on the internets and execute it at the shell startup (’redduck666′ is the name of my app):

from google.appengine.api import apiproxy_stub_map, urlfetch_stub
from google.appengine.api import datastore_file_stub, mail_stub, user_service_stub
import os
os.environ['APPLICATION_ID'] = 'redduck666'
 
apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
apiproxy_stub_map.apiproxy.RegisterStub('urlfetch',
    urlfetch_stub.URLFetchServiceStub()) 
apiproxy_stub_map.apiproxy.RegisterStub('user',
    user_service_stub.UserServiceStub())
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3',
    datastore_file_stub.DatastoreFileStub('redduck666', '/dev/null', '/dev/null'))
apiproxy_stub_map.apiproxy.RegisterStub('mail', mail_stub.MailServiceStub())

As far as users go, as long as your idea of “user” == “user with google account” you are gonna be happiest person around. GAE handles for you the authentication against google account and makes sure the site is usable even in development environment. What happens if you want to add twitter connect or facebook connect? Well, SOL (Shit Outta Luck), they haven’t bothered to abstract the User model so you are left with dealing with low level stuff (like cookies). Compare that to django, where you have to authorize the user once and it does everything else for you (albeit keeping a user in SQL table).

Another reason against GAE is lack of reusable stuff out there, django has much more vibrant community creating all kinds of reusable stuff. As a matter of fact i had to port django facebook connect stuff to work under GAE.

 

About almir

Hi I'm Almir Karic, i'm studying IT and programming and this is my personal blog where I share my opinion and tips on all things code and tech. I'm also a keen traveler so you might see the odd travel post or 2!