Google App Engine - Intro

7,779 views

Published on

Demos created for public lecture in VarnaLab (19 June 2013)
Online demos : Google App Engine Presentation - 19.06.2013
Services :
Hello App Engine
User Service - Authenticaton
Blobstore
Task Queue
Datastore - Entities
Datastore - Queries and Indexes
Datastore - Transactions

Youtube video : http://www.youtube.com/watch?v=-4BbrINScYI

0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,779
On SlideShare
0
From Embeds
0
Number of Embeds
2,226
Actions
Shares
0
Downloads
3
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

Google App Engine - Intro

  1. 1. App EngineGetting started for ... Java Developers@d_danailov
  2. 2. Google App Engine : IntroDimitar DanailovSenior Developer at 158ltd.comdimityr.danailov[at]gmail.comGithubFounder at VarnaITSenior Developer at 158ltd.comGoogle App Engine - Online DemosGithub Code
  3. 3. Topics Today● Cloud Computing● What is Google App Engine(GAE) ?● Architecture of GAE● Quota & Pricing● Developing using GAE● Deploying Applications● Security● GAE datastore● Demo Application
  4. 4. Cloud computing
  5. 5. Classification of cloud computing
  6. 6. What is Google App Engine(GAE) ?● Google’s platform to build Web Applications on thecloud● Dynamic Web server● Transactional Data Store Model
  7. 7. Why GAE?● Automatic scaling and load balancing● Lower total cost of ownership● Web administration console & utilities● Enhances developing & deploying of web applications● Multilanguage support (Java, Python, GO, PHP)● Fully featured SDK for local development● Rich set of Google APIs● Secure environment (Sandbox)
  8. 8. What is Google AppEngine(GAE) ?
  9. 9. Quota & Pricing● Google App Engine Pricing● Google Compute Engine● Google Cloud Storage● Google BigQuery● Google Cloud SQL
  10. 10. Application life Cycle
  11. 11. Application Developmentusing GAE
  12. 12. Development life Cycle
  13. 13. Your first GAE Application● Hello, World
  14. 14. GAE Services● Developers are focused on implementing custombusiness logic● Wide range of services available○ User service○ Blobstore○ Task Queues○ Mail Service○ Image○ Memcache, etc
  15. 15. User Services● Provides a simple API for authentication andauthorization○ Detect if a user is signed in App○ Detect if a user is an admin● Works in combination with web.xml security settings● Three authentication options○ Google Account○ Google Apps domains users○ OpenID - experimental
  16. 16. User Services Demo
  17. 17. Blobstore Services● The Blobstore Service allows your application to servebinary objects, larger than the entities in the Datastore.● Blobs are created by uploading files through HTTP○ The upload and store logic is handled by theService○ The HTTP request is redirected to a dispatcher, byspecified by the developer
  18. 18. Blobstore ServicesDemo
  19. 19. Task Queues● Task Queues allow the application to perform work,initiated by a user request, outside of that request.● Suitable for triggering background processes● Different types of queues○ Push queues○ Pull queues○ REST reference
  20. 20. Task Queues Demo
  21. 21. Storing Data● GAE provides different ways of storing applicationdata○ Datastore - provides a noSQL schemaless objectdatastore with a query engine and transactions○ Google Cloud SQL - provides a relation database,based on MySQL○ Google Cloud Storage - provides a storage servicefor objects and files up to terabytes in size
  22. 22. Storing Data (2)● Watch a video demonstration comparing theMaster/Slave and High Replication Datastores.● Watch a video demonstration comparing SQL vsNoSQL: Battle of the Backends
  23. 23. SQL vs NoSQL : Battle of Backends
  24. 24. Datastore● Based on Google Big Table● NoSQL object storage● Schemaless● No joins and aggregations● Hierarchical● Queries must rung against existing indexes● Access API using an instance of the DatastoreServiceClass
  25. 25. Datastore - Types● There are two different Datastore types we can use :○ High Replication Datastore(HRD)○ Master / Slave Datastore
  26. 26. Datastore - Types (HRD)● High Replication Datastore(HRD) is replicated acrossmultiple data centers○ Highest level of availability○ Higher latency on writes○ Query data is eventually consistent
  27. 27. Datastore - Types (Master/Slave)● Master / Slave Datastore - one data center holdsmaster copy of the data. Data in the master isasynchronously copied to the slaves.○ Periods of unavailability○ Low latency○ Highest level on consistency
  28. 28. Datastore - Entities● Entities - contain key/value pairs● Each entity has a unique key comprised of :○ The kind of the entity (Example : Person, Human)○ An identifier for the the individual entity that can be:■ a key name string■ an integer numeric ID○ An optional ancestor path locating the entity in theDatastore hierarchy
  29. 29. Datastore - Entities (2)● The Entity class● Creating an Entity○ Create an instance of the Entity class○ pass it to the DatastoreService.put() method● Retrieving an Entity○ Pass an entity Key to the DatastoreService.get()● Updating an Entity○ No different between creating and updating● Deleting an Entity○ Pass an entity Key to the DatastoreService.delete()method
  30. 30. Datastore Entities Demo
  31. 31. Datastore - Queries● Queries retrieve a number of entities that meet aspecified set of conditions from Datastore● Queries can specify :○ Entity kind○ Zero or more filters, based on entity propertiesvalues○ Zero or more sort order descriptions○ Default or you can set a limit clause● Rung against an existing index
  32. 32. Datastore - Queries (2)● The Query Class○ Pass entity kind as constructor parameter● Adding filters - Datastore Filter Class and setFiltermethod○ Property name○ Operator - a value, defined in FilterOperator○ Value - the value to compare to● Sorting - addsort() method○ Property name○ Sort order - a value, defined in SortDirection
  33. 33. Datastore - Queries (3)● Fetching results○ Pass a Query instance to the DatastoreService.prepare() method○ Use one of the methods of the PreparedQueryinstance, returned as a result○ Refine your results using FetchOptions
  34. 34. Datastore - Indexes● Similar to relational database indexes● Automatic indexed created for some queries● Other queries require indexes to be manually createdin the datastore-indexes.xml. They include :○ Queries with multiple sort orders○ Queries with a sort order on keys in descendingorder○ Queries with one or more inequality filters on aproperty and one or more equality filters on otherproperties, etc.
  35. 35. Datastore - Indexes● Similar to relational database indexes● Automatic indexed created for some queries● Other queries require indexes to be manually createdin the datastore-indexes.xml. They include :○ Queries with multiple sort orders○ Queries with a sort order on keys in descendingorder○ Queries with one or more inequality filters on aproperty and one or more equality filters on otherproperties, etc.
  36. 36. Queries Demo
  37. 37. Datastore - Transactions● Transactions - a set of atomic operations● Transaction type :○ Default transactions - work on a single entity○ Cross - group (XG) transactions - work on differententity groups● Getting a Transaction instance - DatastoreService.beginTransaction()● Manipulating a transaction○ Transaction.commit() - confirm changes○ Transaction.rollback - rollback changes, restoreprevious state
  38. 38. Datastore TransactionsDemo
  39. 39. Questions ?Dimitar DanailovSenior Developer at 158ltd.comdimityr.danailov[at]gmail.comGithubFounder at VarnaITSenior Developer at 158ltd.comGoogle App Engine - Online DemosGithub Code

×