+ All Categories
Home > Documents > Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf ·...

Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf ·...

Date post: 11-Oct-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
49
Platforms in the Cloud Dan Sanderson, Google December 4, 2014
Transcript
Page 1: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Platforms in the CloudDan Sanderson, Google

December 4, 2014

Page 2: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)
Page 3: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Software as a Service (SaaS)Gmail, Google Docs, NetSuite, SugarCRM

Infrastructure as a Service (IaaS)Google Compute Engine, Amazon EC2; networking, storage

Page 4: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Software as a Service (SaaS)Gmail, Google Docs, NetSuite, SugarCRM

Infrastructure as a Service (IaaS)Google Compute Engine, Amazon EC2; networking, storage

Platform as a Service (PaaS)Google App Engine, Heroku, Microsoft Azure

Page 5: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

All problems in computer science can be solved by another level of indirection.

— David Wheeler

Page 6: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

• web applications

• managed servers

• automatic scaling

Page 7: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Why PaaS?

Page 8: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

client

Page 9: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

server

Page 10: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

request

response

Page 11: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

load balancer

Page 12: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

storage

Page 13: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

• configuration • deployments • OS upgrades, security patches • hardware failures • peak provisioning

Self Hosted

Page 14: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

• configuration • deployments • OS upgrades, security patches* • hardware failures • peak provisioning*

IaaS / Managed Servers

Page 15: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google App Engine

Page 16: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google App Engine

• Easy deployment

• No servers to manage, no OS to update;App Engine does this for you

• Pay for what you use

• Instance hours, storage, bandwidth, service calls

Page 17: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google App Engine

• Built on Google infrastructure

• Based on Google’s internal best practices

• Based on standard technologies

Page 18: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)
Page 19: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)
Page 20: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

App Engine Architecture

Page 21: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

App handlers

Static file handlers

FEcache

AE FE

Datastore Memcache

Task Queue

URL Fetch

Mail XMPP

Blobstore Channel

Services

Page 22: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Instances and Request Handlers

Page 23: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Instances andRequest Handlers

• Request handlers are ephemeral: now you see them, now you don’t

• Can’t rely on data persistence between requests

• Use storage services to persist data

Page 24: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Request handler

Request handler

Request handler

Request handler

⋯ ⋯

Page 25: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Instances andRequest Handlers

• In practice, app initialization is expensive

• An app instance is long running, can handle multiple requests in its lifetime

• Environment initialized; instance memory loaded

• Started and stopped as needed

• Can’t rely on a single user’s session to go to the same instance

Page 26: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Instance

Request handler

Page 27: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Instance

Request handler

Page 28: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Instance InstanceInstance

Request handler

Request handler

Request handler

Page 29: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Instance InstanceInstance

Request handler

Request handler

Request handler

⋯Request handler

Request handler

Request handler

threading enabled

Page 30: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Instance InstanceInstance

Request handler

Request handler

Request handler

⋯Request handler

Request handler

Request handler

threading enabled

Page 31: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Instance InstanceInstance

Request handler

Request handler

⋯Request handler

Request handler

threading enabled

Page 32: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Runtime Environments

• Sandboxing

• Data isolation

• Performance isolation

• Sandboxing → scalability

Page 33: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Runtime Environments• Limits

• Request timer

• Restricted access to filesystem, sockets

• More performance isolation: RAM, CPU

• Data sizes: requests, responses, API calls, storage objects

• Limits → scalability

Page 34: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Runtime Environments

Python Java

Go PHP

Page 35: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Services

• Features with their own scalable infrastructure

• Architecturally distinct from the runtime environments

• Synchronous and asynchronous calling APIs

• Data storage, communication, data processing

Page 36: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

Page 37: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

• Scalable object storage

• Based on high-powered key-value storage (“BigTable”); see also “MegaStore”

• Named properties, typed values

• “Schemaless;” data modeling in app code

• Replication using Paxos

Page 38: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

• entities

• keys: kind, ID, […]

• properties, typed values

Page 39: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

p3 = Player(name=‘druidjane’, level=7, create_date=now) p3key = p3.put()

Key:

name: ‘druidjane’ level: 7 create_date: 2012-10-09 10:20:00 am PDT

Kind: PlayerID: 324

Page 40: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

p3key = ndb.Key(‘Player’, 324) p3 = p3key.get()

if p3.level > 5: # ...

Key:

name: ‘druidjane’ level: 7 create_date: 2012-10-09 10:20:00 am PDT

Kind: PlayerID: 324

Page 41: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

class Player(ndb.Model): name = ndb.StringProperty() level = ndb.IntegerProperty() create_date = ndb.DateTimeProperty()

p1 = Player() p1.level = 7 p1.put()

p2 = Player() p2.level = ‘warrior’ # BadValueError p2.put()

Page 42: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

• queries

• kind (Player)

• property filters (level > 7),property sort order (creation_date ascending)

• indexes

• key, property (Player : level)

• custom indexes

Page 43: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

Every query is served byreading rows from an index.

Indexes are updated asdata is updated.

Page 44: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

Query speed is proportional to the size of the result set,

not the size of the data set.

Page 45: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Cloud Datastore

• transactions

• local vs. global transactions

• datastore transaction locality = entity groups

• defined by the key

• strong consistency vs. eventual consistency

Page 46: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

From PaaS to IaaS

Page 47: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

• automatic scaling • streamlined runtime • optimized for small

units of computation

• manual scaling • full virtual machines • suitable for large

units of computation

Managed VMs• automatic scaling • full virtual machines • more flexible software

Page 48: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Google Container Engine (GKE)

Page 49: Platforms in the Cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf · 2014-12-04  · Gmail, Google Docs, NetSuite, SugarCRM Infrastructure as a Service (IaaS)

Thank you!

cloud.google.com

ae-book.appspot.com

Programming Google App Engine with Python, … with Java Early Access available now

Dan Sanderson profiles.google.com/ dan.sanderson


Recommended