31
Google App Engine Day of Cloud October 16, 2009 1 Monday, October 19, 2009

Don Schwarz App Engine Talk

Embed Size (px)

Citation preview

Page 1: Don Schwarz App Engine Talk

Google App EngineDay of Cloud

October 16, 2009

1Monday, October 19, 2009

Page 2: Don Schwarz App Engine Talk

About Me

Don Schwarz

[email protected]

Software Engineer

Google

2

2Monday, October 19, 2009

Page 3: Don Schwarz App Engine Talk

Overview

• Problems with scalable web applications

• What is Google App Engine?

• Let’s Play a Game

• How much does it cost?

• Q/A

3

3Monday, October 19, 2009

Page 4: Don Schwarz App Engine Talk

Challenges of Building Web Apps

4

4Monday, October 19, 2009

Page 5: Don Schwarz App Engine Talk

Easy to start. Easy to scale.

5

5Monday, October 19, 2009

Page 6: Don Schwarz App Engine Talk

It’s all included!Hardware

ConnectivityOperating System

Web ServerLanguage RuntimesSoftware Services

Fault-toleranceLoad balancing

SSL Support

6

6Monday, October 19, 2009

Page 7: Don Schwarz App Engine Talk

Key Features

• No need to install or maintain your own stack

• We do the scaling for you

• Use Google’s scalable services

• We charge only for actual usage

–Always free to get started

• Built-in application management console

• Tool integration (IDE plugins, etc.)

7

7Monday, October 19, 2009

Page 8: Don Schwarz App Engine Talk

Incoming Requests

App Engine Front End

App Engine Front End

App Engine Front End

AppServer AppServer AppServer

Load Balancer

AppServer

API Layer

Other Google Infrastructure

- Bigtable

- Google Accounts

- Memcache

- Image manipulation

App App App

Architecture

8

8Monday, October 19, 2009

Page 9: Don Schwarz App Engine Talk

9

Service Google Infrastructure

Authentication Google Accounts

Datastore Bigtable

Caching Custom memcache implementation

E-mail Gmail gateway

URLFetch Caching HTTP proxy

XMPP Google Talk infrastructure

Images Picasa Web Photo Infrastructure

Software Services

9Monday, October 19, 2009

Page 10: Don Schwarz App Engine Talk

Web Hooks

• Receiving XMPP

• Receiving Email

• Scheduled Tasks (cron)

• Task Queue (offline processing)

• Google Wave Robots

10

10Monday, October 19, 2009

Page 11: Don Schwarz App Engine Talk

Restrictions

• No threads

• No direct network connections

• ... but URLFetch & SDC

• No direct file system writes

• ... but Datastore and Memcache

• No subprocesses or native code

• “Safe” subset of runtime environment

• 30 seconds per request, 10MB limit

11

11Monday, October 19, 2009

Page 12: Don Schwarz App Engine Talk

Java• Java 6 VM (with Hotspot)

• Full Servlet 2.5 Container

• HTTP Session support

• JSP support

• Services integrate with common Java Standards

• JDO/JPA for Datastore API

• JSR 107 for Memcache API

• javax.mail for Mail API

• java.net.URLConnection for URLFetch API

• IDE integration: Eclipse, IntelliJ, NetBeans

12

12Monday, October 19, 2009

Page 13: Don Schwarz App Engine Talk

Python• Python 2.5.2

• CGI environment, provided by WSGI module

• Web frameworks

• webapp - Minimal built-in framework, based on WebOb

• Django 0.96 is built-in, can deploy 1.0 or 1.1

• App Engine Launcher (Mac & Windows)

• Easy access to edit, test, and deploy applications

13

13Monday, October 19, 2009

Page 14: Don Schwarz App Engine Talk

Datastore

14

• Datastore is:

• Transactional

• Natively Partitioned

• Hierarchical

• Schema-less

• Based on Bigtable

• Datastore is not:

• A relational database

• A SQL engine

14Monday, October 19, 2009

Page 15: Don Schwarz App Engine Talk

Interesting Datastore Modeling

• Ancestor

• Multi-value properties

• Variable properties

• Heterogenous property types

15

Kind Person

Entity Group /Person:Ethel

Key /Person:Ethel

Age Int64: 30

Hobbies String: Tennis

Kind Person

Entity Group /Person:Ethel

Key /Person:Ethel/Person:Jane

Age Double: 3.5

PetsKey:/Turtle:Sam

PetsKey:/Dog:Ernie

15Monday, October 19, 2009

Page 16: Don Schwarz App Engine Talk

Datastore Transactions• Transactions apply to a single Entity Group

• Global transactions are feasible

• get(), put(), delete() are transactional

• Ancestor queries are transactional

16

/Person:Ethel/Person:Jane

/Person:Ethel

/Person:Max

Transaction

16Monday, October 19, 2009

Page 17: Don Schwarz App Engine Talk

Testing Locally• “Development AppServer”

• Emulates production environment

• Enforces many of the same restrictions

• Local implementation of software services

• Disk-based datastore

• In-memory LRU memcache implementation

• Simple URLFetch implementation

17

17Monday, October 19, 2009

Page 18: Don Schwarz App Engine Talk

Deploying to the Cloud• Application is available at:

• yourapp.appspot.com, or

• a custom domain

• Command-line and IDE-based tools

• Admin Console

• Dashboards, Data Viewer

• Request and diagnostic logs

• Billing

18

18Monday, October 19, 2009

Page 19: Don Schwarz App Engine Talk

Code Walkthrough

19Monday, October 19, 2009

Page 20: Don Schwarz App Engine Talk

http://java-demo.appspot.com

20Monday, October 19, 2009

Page 21: Don Schwarz App Engine Talk

21

Resource Provided Free Additional Cost

CPU 6.5 hours/day $0.10/hour

Bandwidth In 1GByte/day $0.10/GByte

Bandwidth Out 1GByte/day $0.12/GByte

Stored Data 1 GB $0.005/GB-day

Emails sent2000/day to users

50000/day to admins$0.0001/email

Quotas and Billing

21Monday, October 19, 2009

Page 22: Don Schwarz App Engine Talk

Quotas and Billing: Estimates

• Will always be free to get started

• ~5 million pageviews/month free

• Pay only for what you use

• 10-20 million pageviews/month for$20-30/month

• Payment via Google Checkout

•X-AppEngine-Estimated-CPM-US-Dollars

22

22Monday, October 19, 2009

Page 23: Don Schwarz App Engine Talk

Questions?

23Monday, October 19, 2009

Page 24: Don Schwarz App Engine Talk

Resources• Speaker

• Don Schwarz ([email protected])

• Google App Engine

• http://code.google.com/appengine

• Google Group

• http://groups.google.com/group/google-appengine

24

24Monday, October 19, 2009

Page 25: Don Schwarz App Engine Talk

Backup Slides

25Monday, October 19, 2009

Page 26: Don Schwarz App Engine Talk

Does it scale?

http://whitehouse.gov/openforquestions26

26Monday, October 19, 2009

Page 27: Don Schwarz App Engine Talk

Secure Data Connector

27

27Monday, October 19, 2009

Page 28: Don Schwarz App Engine Talk

Demo - Login

28

28Monday, October 19, 2009

Page 29: Don Schwarz App Engine Talk

Demo - Question

29

29Monday, October 19, 2009

Page 30: Don Schwarz App Engine Talk

Demo - Question Result

30

30Monday, October 19, 2009

Page 31: Don Schwarz App Engine Talk

Demo - Scoreboard

31

31Monday, October 19, 2009