330 likes | 658 Views
Google App Engine Now Serving Java. Chris Schalk June 29, 2009. Goals. Help you understand... what App Engine is. what App Engine is not. where App Engine preserves programming models. where App Engine changes programming models.
E N D
Google App Engine Now Serving Java Chris Schalk June 29, 2009
Goals • Help you understand... • what App Engine is. • what App Engine is not. • where App Engine preserves programming models. • where App Engine changes programming models. • Demonstrate that App Engine really is fast and free to get started.
Overview • Google App Engine • Java on App Engine • The App Engine Datastore • Demo • Questions
What Is Google App Engine? • A cloud-computing platform • Run your web apps on Google’s infrastructure • We provide the container and services (PaaS) • Hardware, connectivity • Operating system • JVM • Servlet container • Software services
Key Features • No need to install or maintain your own stack • We scale for you • Use Google’s scalable services via standard APIs • Charge only for actual usage • Always free to get started • Built-in application management console
App Engine Architecture Incoming Requests App Engine Front End App Engine Front End App Engine Front End Load Balancer AppServer AppServer AppServer Other Google Infrastructure - Bigtable - Google Accounts - Memcache - Image manipulation AppServer API Layer App App App
When To Use Google App Engine • Targeting web applications • Serve HTTP requests, limited to 30 seconds • No long-running background processes • No server push • Sandboxed environment • No threads • Read-only file system
Java Support • Servlets • Software services • Sandboxing • DevAppServer • Deployment • Tooling
Demo! Java App Engine Basics
Servlet API • Full Servlet 2.5 Container • HTTP Session • JSP • Uses Jetty and Jasper • Powered by Google’s HTTP stack • No Jetty-specific features • Subject to change
Sandboxing • What do we do? • Restrict JVM permissions • WhiteList classes • Why is it necessary? • Clustering - JVMs come and go • Protect applications from one another
Flexible Sandboxing • JVM Permissions often too coarse • Reflection • Access private fields, call private methods • Class Loading • Custom Class Loaders • Dynamic bytecode • Alternate JVM languages
DevAppServer • Emulates the production environment • Customized Jetty server • Local implementation of services • LRU memcache • Disk-backed datastore • HttpClient-backed URLFetch • Some sandbox restrictions difficult to emulate
Deployment • Your app lives at • <app_id>.appspot.com, or • Custom domain with Google Apps for your Domain • Command line and IDE tools • Application • Datastore Indexes • Cron Jobs
Tooling • SDK Tools API • Command-line tools, Ant, and IDE plugins • Provides • Deployment • DevAppServer • WhiteList for compile-time checks • XML validation • Google Eclipse Plugin
The Datastore Is... • Distributed • Scalable • Transactional • Natively Partitioned • Hierarchical • Schema-less • Based on Bigtable
The Datastore Is Not... • A relational database • A SQL engine • Just Bigtable
Simplifying Storage • Simplify development of apps • Simplify management of apps • App Engine services build on Google’s strengths • Scale always matters • Request volume • Data volume
Datastore Storage Model • Basic unit of storage is an Entity consisting of • Kind (table) • Key (pk) • Entity Group (top level ancestor) • Has locking implications • 0..N typed Properties (columns)
Interesting Datastore Modeling Features • Ancestor • Multi-value properties • Variable properties • Heterogenous property types
Datastore Transactions • Transactions apply to a single Entity Group • Global transactions are feasible • get(), put(), delete() are transactional • Queries are not transactional (yet) Transaction /Person:Ethel /Person:Ethel/Person:Jane /Person:Max
Datastore Queries • Every query must be supported by an index • Built-in or user-defined • Filters • Equality, inequality, intersection, ancestor • Union, IN not supported (yet) • Joins not supported (unlikely, but never say never) • Sorting
Standards-based Persistence • JDO or JPA (your choice) • Established apis and existing tooling • Easier porting • Mappable (mostly) to the datastore • Soft schemas • DataNucleus App Engine plugin • Why not a JDBC driver instead?
Transparent Entity Group Management • Entity Group layout is important • Write throughput • Atomicity of updates • Ownership implies co-location within Entity Group
Demo! Building Apps with Java App Engine
Coming Soon • Task queues • Full text search • Incoming email • XMPP • Large file storage and retrieval • Datastore export tools