Surprise! Google has released a new service aimed at developing Web apps. Google App Engine is a framework to develop web applications that can run in Google infraestructure. This means that the applications can easily scale.
The service is based in a shared nothing architecture. You write functions that process requests. You cannot create threads or processes. You cannot share nothing between requests. You cannot write or read files from a filesystem.
A relaxed but scalable database is available. This database is similar to Amazon SimpleDB and Microsoft SSDS.
The request processors are written in Python. A hello word example:
import wsgiref.handlersAn example of use of the database:
from google.appengine.ext import webapp
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
def main():
application = webapp.WSGIApplication(
[('/', MainPage)],
debug=True)
wsgiref.handlers.CGIHandler().run(application)
if __name__ == "__main__":
main()
from google.appengine.ext import dbApp Engine is going to be useful for web app developers that need high scalability but do not have complex processes in their backend. As an example, I believe that it would be easy to develop Twitter using App Engine. Developers of Facebook apps could find useful the service, too.
from google.appengine.api import users
class Pet(db.Model):
name = db.StringProperty(required=True)
type = db.StringProperty(required=True, choices=set("cat", "dog", "bird"))
birthdate = db.DateProperty()
weight_in_pounds = db.IntegerProperty()
spayed_or_neutered = db.BooleanProperty()
owner = db.UserProperty()
pet = Pet(name="Fluffy",
type="cat",
owner=users.get_current_user())
pet.weight_in_pounds = 24
pet.put()
Example of get, modify, save:
if users.get_current_user():
user_pets = db.GqlQuery("SELECT * FROM Pet WHERE pet.owner = :1",
users.get_current_user())
for pet in user_pets:
pet.spayed_or_neutered = True
db.put(user_pets)
Google is going to compete with Amazon Web Services. I find these two services different. Google's one is simpler and easier therefore its target is developers of simple but scalable web apps. Amazon Web Services provides with more control, so companies that have complex systems (like vertical search engines) would preferer it.
0 comments:
Post a Comment