Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Intro to App Engine and AppScale
1. 8 build apps
faster and
b intro
easier
To
>
Google K
5 app engine developer
innovation
&
Appscale Z
x
$ ( deploy and
scale on any
cloud
rapid
releases
Chris bunch
chris@appscale.com
2. • You have a cool idea
a • To make it into an app, you
need to:
common • Setup hardware
pattern • Configure, deploy app
One of several recurring
problems seen in the real
services
•
world today.
And you have to do this
for every app!
3. Why not Amazon?
• 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.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 3
4. google app engine
• 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.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 4
5. Supported Languages
Python Java
Go
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 5
6. Programming Model
Ñ 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
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 6
7. The DATAstore
• 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
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 7
8. Defining a kind
class Person(ndb.Model):
user = ndb.UserProperty()
balance = ndb.FloatProperty()
phone = ndb.StringProperty()
last_login = ndb.DateTimeProperty()
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 8
11. transactions
• 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)
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 11
12. memcache
data = memcache.get(‘key’)
if data:
return data
else:
data = db.get(‘key’)
memcache.set(‘key’, data, 300)
return data
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 12
16. url fetch
r = urlfetch.fetch(“http://www.google.com/”)
if r.status_code == 200:
do_something_with_result(r.content)
else:
# retry later
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 16
17. xmpp
user = “chris@appscale.com”
msg = “Hello there!”
status = xmpp.send_message(user, msg)
if status != xmpp.NO_ERROR:
# decide what to do with the failed msg
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 17
18. enter appscale
• 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!
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 18
25. the development cycle
• App Engine SDK for rapid development
• Limitations:
• Many APIs are stubbed out (XMPP, Mail)
• Not designed for production workloads
• Use AppScale!
www.appscale.com
Phone: +1(805) 845 0010 | e-mail: chris@appscale.com
PAGE 25