26
intro To Google app engine & Appscale build apps faster and easier developer innovation K rapid releases Z deploy and scale on any cloud x Chris bunch [email protected] ( b 8 5 $ >

Intro to App Engine and AppScale

Embed Size (px)

DESCRIPTION

These slides introduce new users to Google App Engine and AppScale, focusing on the APIs that App Engine offers and how AppScale implements them.

Citation preview

Page 1: Intro to App Engine and AppScale

introTo

Googleapp engine

&Appscale

build apps faster and easier

developer innovation

K

rapid releases

Zdeploy and

scale on any cloud

x

Chris [email protected]

(

b8

5

$

>

Page 2: Intro to App Engine and AppScale

a common pattern

One of several recurring problems seen in the real world today.

• You have a cool idea

• To make it into an app, you need to:

• Setup hardware

• Configure, deploy app services

• And you have to do this for every app!

Page 3: Intro to App Engine and AppScale

www.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected] PAGE

Why not Amazon?

3

• You don’t want to deploy and maintain:

• Servers

• Load balancers

• App Servers

• Databases

• And you don’t want to hire people to do it!

Page 4: Intro to App Engine and AppScale

www.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected] PAGE

google app engine

4

• A web application hosting service

• Never log into a server

• Crystallizes web service best practices

• Share common services between apps

• Focus on writing your app

Page 5: Intro to App Engine and AppScale

www.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected] PAGE

Supported Languages

5

Go

Python

Go

Java

Page 6: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

Programming Model

(

Ñ

6

Everything is a web request

Stateless, scalable web server, meaning:

• No filesystem access

• Persistence via Datastore / memcache

• 60 second time limit on requests

• APIs from whitelist only

Page 7: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

The DATAstore

7

• Not a relational database, but resembles an object database

• You define Kinds of data you want to store

• Each object stored is an Entity

• Entities can be arranged into Groups

Page 8: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

Defining a kind

8

class Person(ndb.Model):

user = ndb.UserProperty()

balance = ndb.FloatProperty()

phone = ndb.StringProperty()

last_login = ndb.DateTimeProperty()

Page 9: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

EXTENDING a kind

9

class Person(ndb.Model):

user = ndb.UserProperty()

balance = ndb.FloatProperty()

phone = ndb.StringProperty()

last_login = ndb.DateTimeProperty()

login_location = ndb.GeoPt()

Page 10: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

Kind, entities

10

class Person(ndb.Model):

...

new_person = Person()

new_person.put()

Page 11: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

transactions

11

• Updating an Entity happens in a Transaction

• Apps tell App Engine which Entities will be updated together by putting them into an Entity Group

• Transactions can only occur within an Entity Group*

def f():

person = db.get(key1)

person.balance = 100.00

person.put()

db.run_in_transaction(f)

Page 12: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

memcache

12

data = memcache.get(‘key’)

if data:

return data

else:

data = db.get(‘key’)

memcache.set(‘key’, data, 300)

return data

Page 13: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

users

13

user = users.get_current_user()

if user:

return user.nickname()

else:

return None

Page 14: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

mail

14

from = “Chris Bunch <[email protected]>”

to= “You <[email protected]>”

subject = “Try out AppScale!”

body = “http://download.appscale.com”

mail.send_mail(sender=from, to=to, subject=subject, body=body)

Page 15: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

task queue

15

taskqueue.add(url=“/path/to/worker”)

cron:- description: sends friendly emails url: /path/to/worker schedule: every 24 hours

Page 16: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

url fetch

16

r = urlfetch.fetch(“http://www.google.com/”)

if r.status_code == 200:

do_something_with_result(r.content)

else:

# retry later

Page 17: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

xmpp

17

user = “[email protected]

msg = “Hello there!”

status = xmpp.send_message(user, msg)

if status != xmpp.NO_ERROR:

# decide what to do with the failed msg

Page 18: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

enter appscale

18

• But what if you need:

• To fail over to a private cloud?

• To run your App Engine app in-house?

• To use APIs App Engine doesn’t support?

• Then you need AppScale!

Page 19: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

run anywhere

19

Page 20: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

datastore

20

• Supports NoSQL datastores via a database agnostic API:

• get

• put

• range_query

• delete

Page 21: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

we have supported

21

Page 22: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

now focusing on...

22

Page 23: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

load balancing + app servers

23

Page 24: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

API Services

24

Page 25: Intro to App Engine and AppScale

PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]

the development cycle

25

• App Engine SDK for rapid development

• Limitations:

• Many APIs are stubbed out (XMPP, Mail)

• Not designed for production workloads

• Use AppScale!

Page 26: Intro to App Engine and AppScale

Demo