Date post: | 11-Nov-2014 |
Category: |
Technology |
Upload: | chris-bunch |
View: | 17,138 times |
Download: | 0 times |
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
$
>
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!
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!
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
www.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected] PAGE
Supported Languages
5
Go
Python
Go
Java
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
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
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()
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()
PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]
Kind, entities
10
class Person(ndb.Model):
...
new_person = Person()
new_person.put()
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)
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
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
PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]
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)
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
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
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
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!
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
PAGEwww.appscale.comPhone: +1(805) 845 0010 | e-mail: [email protected]
load balancing + app servers
23
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!
Demo