PyCon2010 Scalable Apps Using AppEngine
PyCon2010 Scalable Apps Using AppEngine
bit.ly/scalableapps
Pranav Prakash
Agenda
● Scalabality
● Introduction to Google App Engine
● Hello World
● Cache
● Scalability Revisited
● Case Study
● Q-n-A
Scalability
● Scaling Up
● Scaling Out
Google App Engine
● Develop, Deploy web apps on Google's
Infrastructure
● Application Environment
● Sandbox Environment
● Runtime Environment
● Python
● Java
● DataStore
● Google Accounts
● Services
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
application = webapp.WSGIApplication(
[('/', MainPage)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
app.yaml
application: helloworld
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: helloworld.py
App Engine Datastore
● Scalable data storage for your applications
● Write once, read many
● Pre-Indexing
Entities and Models
● Datastore Entity = key + set(attributes)
● Models describe the kind of data an app uses
class Person(db.Model):
name = db.StringProperty(required=True)
birthdate = db.DateProperty()
height = db.IntegerProperty()
is_admin = db.BooleanProperty(default=False)
ted = Person(key_name='person_ted',
name='Ted',
birthdate=datetime.datetime(1986,12,04),
height = 185)
db.put(ted)
Entity Groups, Ancestors and Path
● Entities residing in same part of the distributed
network
● Transactions
● Query
● db.get()
specific_ted = Person.get_by_key_name('person_ted')
● Sharding
● Memcache
Case Study
● Social apps and games from Oxylabs
bit.ly/scalableapps