Dr. Max Völkel, Calpano 1 You know Java, but what is AppEngine? In this session Max will walk you from a brief introducAon of Servlets to an overview of the Google AppEngine. We learn about the basics such as the data store – which is quite different from SQL , applicaAon versions, backends, scheduler, instances and logging. Services such as mail, url fetch, task queue are also explained. Since we use GAE/J since 2010 in Calpano we also talk about costs and experience in pracAce.
26
Embed
Google AppEngine (GAE/J) - Introduction and Overview from a Java Guy
You know Java, but what is AppEngine? In this session Max will walk you from a brief introduction of Servlets to an overview of the Google AppEngine. We learn about the basics such as the data store – which is quite different from SQL -, application versions, back-ends, scheduler, instances and logging. Services such as mail, url fetch, task queue are also explained. Since we use GAE/J since 2010 in Calpano we also talk about costs and experience in practice.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Dr. Max Völkel, Calpano 1
You know Java, but what is AppEngine? In this session Max will walk you from a brief introducAon of Servlets to an overview of the Google AppEngine. We learn about the basics such as the data store – which is quite different from SQL -‐, applicaAon versions, back-‐ends, scheduler, instances and logging. Services such as mail, url fetch, task queue are also explained. Since we use GAE/J since 2010 in Calpano we also talk about costs and experience in pracAce.
Poll § Language? § Java? § AppEngine? § Servlets?
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 2
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 4
AppEngine Architecture�Java/Python/Go
§ Running Code § Storing Data
• JVM • Memcache • Data store (Old vs. High
Replication) § Connect to the outside world
• Mail (Incoming, Outgoing) • Urlfetch
§ Delay or schedule work • Taskqueue • Cron
§ More helper services • Images • Users
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 5
Servlet Container
JVM
Data Store Memcache Images
HTTP, Incoming Mail, Cron, Taskqueue
Urlfetch, Outgoing Mail, Taskqueue
Hello AppEngine § Typical first test: • Register, Verify mobile number via SMS • Create new app “helloworld”
• http://helloworld.appspot.com
§ Next step: • Buy domain name • Configure …
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 6
1. Appspot.com > Create App
2. Go to “Apps for your Domain”�https://www.google.com/a/calpano.com
3. Organization & Users > Create user�! Only those can send emails
4. Domain Settings > �Domain names > �Add domain name or alias >
5. Go to appspot.com and “Add Domain”
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 7
Application Versions § http://{version}.{appid}.appspot.com"§ http://{appid].appspot.com �à main version (Selected in Dashboard)
§ All versions • Share the same datastore, memcache (!) • Different logs, stats, instances
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 8
Running Code § Java 6 VM (experimental Java 7) § No Files (only read the ones you put in your .war) § Explicit whitelist which Java classes are allowed (many!)
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 11
Delay or schedule work § Taskqueue Queue queue = QueueFactory.getDefaultQueue();!queue.add(TaskOptions.Builder.withDefaults()!.payload(task));!
• Task is a DeferredTask (has a run() method) • Very quick to enqueue task • Task queue service fires requests as
HttpRequests at defined rates, unwraps task, runs it
• Max runtime: 10 minutes § Cron • Scheduled GET-requests at defined urls
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 12
More helper services § Images • Looks like a subset of ImageMagick
§ Users • Log in via Google Account
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 13
Where is a request going? Typical setup § DNS lookup: CNAME or A-record to Google § GAE scheduler: • Request queue for your app • Boot new instance? Takes ca. 10-30 seconds.
§ On instance: • Run WAR, • Run servlet
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 14
Instances
GDG Karlsruhe DevFest 2012 | Dr. Max Völkel | Calpano.com 15
Time is Money. What time? § Free vs. Payment enabled § Quotas • Usage – Free = Billable à Pay • Resource quota à Fair use limit à Error page