platforms in the cloud - ae-book.appspot.comae-book.appspot.com/static/pgae-20141204.pdf ·...
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/1.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/2.jpg)
![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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/3.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/4.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/5.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/6.jpg)
• 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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/7.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/8.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/9.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/10.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/11.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/12.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/13.jpg)
• 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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/14.jpg)
• 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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/15.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/16.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/17.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/18.jpg)
![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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/19.jpg)
![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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/20.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/21.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/22.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/23.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/24.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/25.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/26.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/27.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/28.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/29.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/30.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/31.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/32.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/33.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/34.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/35.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/36.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/37.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/38.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/39.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/40.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/41.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/42.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/43.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/44.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/45.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/46.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/47.jpg)
• 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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/48.jpg)
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)](https://reader033.vdocuments.us/reader033/viewer/2022052106/60412686443c6e6981145825/html5/thumbnails/49.jpg)
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