SlideShare a Scribd company logo
Building Scalable Apps using Google App Engine Pranav Prakash bit.ly/scalableapps PyCon India 2010
Agenda Scalabality Introduction to Google App Engine Hello World App Engine DataStore 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 Cron Jobs and Task Queues
Hello World :) from  google.appengine.ext  import  webapp from  google.appengine.ext.webapp.util  import  run_wsgi_app 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 Stores data entities with properties, organised by application defined Kinds Queries on entities of same kind Filter and sort order on property values and keys Pre-Indexing
Entities and Models Datastore Entity = key + set(attributes) Models describe the kind of data an app uses from  google.appengine.ext  import  db import  datetime 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 Parent Child relationship Path and Key uniqueness
Fetching Entities GQL GqlQuery Query db.get() all_teds = Person.gql( “ WHERE name = :1 ” ,  “ Ted ” ).fetch(100) all_teds_1 = GqlQuery( “ SELECT * FROM Person WHERE name = :1 ” ,  “ Ted ” ).fetch(100) all_teds = Person.all().filter( “ name =  “ ,  “ Ted ” ).fetch(100) specific_ted = Person.get_by_key_name(' person_ted ') specific_teds_key = db.Key(' Person ', ' person_ted ') specfic_ted_1 = db.get(specific_ted_key)
Cache Memcache App Caching
Scalability Revisited Read and Write Infrequently Keys, Key Names, ID Batch Reads and Writes Small Entity Groups Sharding Memcache
Case Study Social apps and games from Oxylabs
bit.ly/scalableapps pranny @ gmail.com

More Related Content

What's hot (8)

Incremental Type Safety in React Apollo
Incremental Type Safety in React Apollo Incremental Type Safety in React Apollo
Incremental Type Safety in React Apollo
Evans Hauser
 
Getting your data in and out of elasticsearch: let me count the ways
Getting your data in and out of elasticsearch: let me count the waysGetting your data in and out of elasticsearch: let me count the ways
Getting your data in and out of elasticsearch: let me count the ways
🥑 Jay Miller
 
ReactでGraphQLを使っている
ReactでGraphQLを使っているReactでGraphQLを使っている
ReactでGraphQLを使っている
Takahiro Kobaru
 
Example asset
Example assetExample asset
Example asset
Sun Malen
 
Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Django Introduction Osscamp Delhi September 08 09 2007 Mir NazimDjango Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Mir Nazim
 
자마린.안드로이드 기본 내장레이아웃(Built-In List Item Layouts)
자마린.안드로이드 기본 내장레이아웃(Built-In List Item Layouts)자마린.안드로이드 기본 내장레이아웃(Built-In List Item Layouts)
자마린.안드로이드 기본 내장레이아웃(Built-In List Item Layouts)
탑크리에듀(구로디지털단지역3번출구 2분거리)
 
Spark for Reactive Machine Learning: Building Intelligent Agents at Scale
Spark for Reactive Machine Learning: Building Intelligent Agents at ScaleSpark for Reactive Machine Learning: Building Intelligent Agents at Scale
Spark for Reactive Machine Learning: Building Intelligent Agents at Scale
Jeff Smith
 
Web Scraping is BS
Web Scraping is BSWeb Scraping is BS
Web Scraping is BS
John D
 
Incremental Type Safety in React Apollo
Incremental Type Safety in React Apollo Incremental Type Safety in React Apollo
Incremental Type Safety in React Apollo
Evans Hauser
 
Getting your data in and out of elasticsearch: let me count the ways
Getting your data in and out of elasticsearch: let me count the waysGetting your data in and out of elasticsearch: let me count the ways
Getting your data in and out of elasticsearch: let me count the ways
🥑 Jay Miller
 
ReactでGraphQLを使っている
ReactでGraphQLを使っているReactでGraphQLを使っている
ReactでGraphQLを使っている
Takahiro Kobaru
 
Example asset
Example assetExample asset
Example asset
Sun Malen
 
Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Django Introduction Osscamp Delhi September 08 09 2007 Mir NazimDjango Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Mir Nazim
 
Spark for Reactive Machine Learning: Building Intelligent Agents at Scale
Spark for Reactive Machine Learning: Building Intelligent Agents at ScaleSpark for Reactive Machine Learning: Building Intelligent Agents at Scale
Spark for Reactive Machine Learning: Building Intelligent Agents at Scale
Jeff Smith
 
Web Scraping is BS
Web Scraping is BSWeb Scraping is BS
Web Scraping is BS
John D
 

Similar to PyCon India 2010 Building Scalable apps using appengine (20)

PyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven DevelopmentPyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven Development
Tudor Munteanu
 
S03 hybrid app_and_gae_datastore_v1.0
S03 hybrid app_and_gae_datastore_v1.0S03 hybrid app_and_gae_datastore_v1.0
S03 hybrid app_and_gae_datastore_v1.0
Sun-Jin Jang
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
fool2nd
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
Tony Frame
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API Requests
RapidValue
 
Using Task Queues and D3.js to build an analytics product on App Engine
Using Task Queues and D3.js to build an analytics product on App EngineUsing Task Queues and D3.js to build an analytics product on App Engine
Using Task Queues and D3.js to build an analytics product on App Engine
River of Talent
 
Oleksandr Tolstykh
Oleksandr TolstykhOleksandr Tolstykh
Oleksandr Tolstykh
CodeFest
 
Java Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : DatastoreJava Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : Datastore
IMC Institute
 
The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Started
guest1af57e
 
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
jpalley
 
Google Gears
Google GearsGoogle Gears
Google Gears
silenceIT Inc.
 
Android best practices
Android best practicesAndroid best practices
Android best practices
Jose Manuel Ortega Candel
 
Gae
GaeGae
Gae
Zong-shuo Jheng
 
mobl
moblmobl
mobl
zefhemel
 
Designing REST API automation tests in Kotlin
Designing REST API automation tests in KotlinDesigning REST API automation tests in Kotlin
Designing REST API automation tests in Kotlin
Dmitriy Sobko
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 
Green dao
Green daoGreen dao
Green dao
Droidcon Berlin
 
Introduction to Datastore
Introduction to DatastoreIntroduction to Datastore
Introduction to Datastore
Software Park Thailand
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
Joaquim Rocha
 
A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django Introduction
Ganga Ram
 
PyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven DevelopmentPyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven Development
Tudor Munteanu
 
S03 hybrid app_and_gae_datastore_v1.0
S03 hybrid app_and_gae_datastore_v1.0S03 hybrid app_and_gae_datastore_v1.0
S03 hybrid app_and_gae_datastore_v1.0
Sun-Jin Jang
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
fool2nd
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
Tony Frame
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API Requests
RapidValue
 
Using Task Queues and D3.js to build an analytics product on App Engine
Using Task Queues and D3.js to build an analytics product on App EngineUsing Task Queues and D3.js to build an analytics product on App Engine
Using Task Queues and D3.js to build an analytics product on App Engine
River of Talent
 
Oleksandr Tolstykh
Oleksandr TolstykhOleksandr Tolstykh
Oleksandr Tolstykh
CodeFest
 
Java Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : DatastoreJava Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : Datastore
IMC Institute
 
The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Started
guest1af57e
 
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
jpalley
 
Designing REST API automation tests in Kotlin
Designing REST API automation tests in KotlinDesigning REST API automation tests in Kotlin
Designing REST API automation tests in Kotlin
Dmitriy Sobko
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
Joaquim Rocha
 
A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django Introduction
Ganga Ram
 

More from Pranav Prakash (20)

Data engineering track module 2
Data engineering track module 2Data engineering track module 2
Data engineering track module 2
Pranav Prakash
 
Data engineering track module 2
Data engineering track module 2Data engineering track module 2
Data engineering track module 2
Pranav Prakash
 
Machine Learning Introduction
Machine Learning IntroductionMachine Learning Introduction
Machine Learning Introduction
Pranav Prakash
 
Test document
Test documentTest document
Test document
Pranav Prakash
 
Webtech1b
Webtech1bWebtech1b
Webtech1b
Pranav Prakash
 
Solidry @ bakheda2
Solidry @ bakheda2Solidry @ bakheda2
Solidry @ bakheda2
Pranav Prakash
 
To Infinity and Beyond - OSDConf2014
To Infinity and Beyond - OSDConf2014To Infinity and Beyond - OSDConf2014
To Infinity and Beyond - OSDConf2014
Pranav Prakash
 
#comments
#comments#comments
#comments
Pranav Prakash
 
Ibm haifa.mq.final
Ibm haifa.mq.finalIbm haifa.mq.final
Ibm haifa.mq.final
Pranav Prakash
 
Apple banana oranges_peaches
Apple banana oranges_peachesApple banana oranges_peaches
Apple banana oranges_peaches
Pranav Prakash
 
Banana oranges peaches
Banana oranges peachesBanana oranges peaches
Banana oranges peaches
Pranav Prakash
 

Recently uploaded (20)

Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
Developing System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptxDeveloping System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptx
wondimagegndesta
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
Developing System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptxDeveloping System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptx
wondimagegndesta
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 

PyCon India 2010 Building Scalable apps using appengine

  • 1. Building Scalable Apps using Google App Engine Pranav Prakash bit.ly/scalableapps PyCon India 2010
  • 2. Agenda Scalabality Introduction to Google App Engine Hello World App Engine DataStore Cache Scalability Revisited Case Study Q-n-A
  • 4. Google App Engine Develop, Deploy web apps on Google's Infrastructure Application Environment Sandbox Environment Runtime Environment Python Java DataStore Google Accounts Services Cron Jobs and Task Queues
  • 5. Hello World :) from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app 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()
  • 6. app.yaml application : helloworld version : 1 runtime : python api_version : 1 handlers : - url : /.*    script : helloworld.py
  • 7. App Engine Datastore Scalable data storage for your applications Write once, read many Stores data entities with properties, organised by application defined Kinds Queries on entities of same kind Filter and sort order on property values and keys Pre-Indexing
  • 8. Entities and Models Datastore Entity = key + set(attributes) Models describe the kind of data an app uses from google.appengine.ext import db import datetime 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)
  • 9. Entity Groups, Ancestors and Path Entities residing in same part of the distributed network Transactions Parent Child relationship Path and Key uniqueness
  • 10. Fetching Entities GQL GqlQuery Query db.get() all_teds = Person.gql( “ WHERE name = :1 ” , “ Ted ” ).fetch(100) all_teds_1 = GqlQuery( “ SELECT * FROM Person WHERE name = :1 ” , “ Ted ” ).fetch(100) all_teds = Person.all().filter( “ name = “ , “ Ted ” ).fetch(100) specific_ted = Person.get_by_key_name(' person_ted ') specific_teds_key = db.Key(' Person ', ' person_ted ') specfic_ted_1 = db.get(specific_ted_key)
  • 12. Scalability Revisited Read and Write Infrequently Keys, Key Names, ID Batch Reads and Writes Small Entity Groups Sharding Memcache
  • 13. Case Study Social apps and games from Oxylabs
  翻译: