Synopses & Reviews
As a cloud computing service, Google App Engine does more than provide access to a large system of servers. It also offers you a simple model for building applications that scale automatically to accommodate millions of users. With this updated edition of Programming Google App Engine, you'll get expert practical guidance that will help you make the best use of this powerful platform. Google engineer Dan Sanderson shows you how to design your applications for scalability, including ways to perform common development tasks using App Engine's APIs and scalable services.
You'll learn about App Engines application server architecture, runtime environments, and scalable datastore for distributing data, as well as techniques for optimizing your application. App Engine offers nearly unlimited computing power, and this book provides clear and concise instructions for getting the most from it right from the source. It's ideal for intermediate and advanced web developers familiar with Java or Python.
The second edition features:
- Complete coverage of all of Google App Engine's latest features, including backends, task queues, web sockets (channels), and the blobstore.
- Major updates for changes to the App Engine datastore, memcache, URL fetch, and the Python and Java runtime environments.
- New fully-tested sample code and best practices.
- Added material on testing your app for functionality and performance.
Google App Engine makes it easy to create a web application that can serve millions of people as easily as serving hundreds, with minimal up-front investment. With Programming Google App Engine, Google engineer Dan Sanderson provides practical guidance for designing and developing your application on Googles vast infrastructure, using App Engines scalable services and simple development model.
Through clear and concise instructions, youll learn how to get the most out of App Engines nearly unlimited computing power. This second edition is fully updated and expanded to cover Python 2.7 and Java 6 support, multithreading, asynchronous service APIs, and the use of frameworks such as Django 1.3 and webapp2.
- Understand how App Engine handles web requests and executes application code
- Learn about new datastore features for queries and indexes, transactions, and data modeling
- Create, manipulate, and serve large data files with the Blobstore
- Use task queues to parallelize and distribute computation across the infrastructure
- Employ scalable services for email, instant messaging, and communicating with web services
- Track resource consumption, and optimize your application for speed and cost effectiveness
About the Author
Dan Sanderson is a technical writer and software engineer at Google Inc. He has worked in the web industry for over 10 years as a software engineer and technical writer for Google, Amazon.com, and the Walt Disney Internet Group. He lives in Seattle, Washington. For more information about Dan, visit his website at http://www.dansanderson.com.
Table of Contents
Preface; Using This Book; Conventions Used in This Book; Using Code Samples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1: Introducing Google App Engine; 1.1 The Runtime Environment; 1.2 The Static File Servers; 1.3 The Datastore; 1.4 The Services; 1.5 Namespaces; 1.6 Google Accounts, OpenID, and OAuth; 1.7 Task Queues and Cron Jobs; 1.8 Developer Tools; 1.9 The Administration Console; 1.10 Things App Engine Doesn't Do...Yet; 1.11 Getting Started; Chapter 2: Creating an Application; 2.1 Setting Up the SDK; 2.2 Developing the Application; 2.3 Registering the Application; 2.4 Uploading the Application; 2.5 Introducing the Administration Console; Chapter 3: Configuring an Application; 3.1 The App Engine Architecture; 3.2 Configuring a Python App; 3.3 Configuring a Java App; 3.4 Domain Names; 3.5 App IDs and Versions; 3.6 Multithreading; 3.7 Request Handlers; 3.8 Static Files and Resource Files; 3.9 Secure Connections; 3.10 Authorization with Google Accounts; 3.11 Environment Variables; 3.12 Inbound Services; 3.13 Custom Error Responses; 3.14 Administration Console Custom Pages; 3.15 More Python Features; 3.16 Java Servlet Sessions; Chapter 4: Request Handlers and Instances; 4.1 The Runtime Environment; 4.2 The Request Handler Abstraction; 4.3 Introducing Instances; 4.4 Request Scheduling and Pending Latency; 4.5 Warm-up Requests; 4.6 Resident Instances; 4.7 The Instances Console; 4.8 Instance Hours and Billing; 4.9 Instance Classes; Chapter 5: Datastore Entities; 5.1 Entities, Keys, and Properties; 5.2 Introducing the Python Datastore API; 5.3 Introducing the Java Datastore API; 5.4 Property Values; 5.5 Keys and Key Objects; 5.6 Using Entities; 5.7 Allocating System IDs; 5.8 The Development Server and the Datastore; Chapter 6: Datastore Queries; 6.1 Queries and Kinds; 6.2 Query Results and Keys; 6.3 GQL; 6.4 The Python Query API; 6.5 The Java Query API; 6.6 Introducing Indexes; 6.7 Automatic Indexes and Simple Queries; 6.8 Custom Indexes and Complex Queries; 6.9 Not-Equal and IN Filters; 6.10 Unset and Nonindexed Properties; 6.11 Sort Orders and Value Types; 6.12 Queries and Multivalued Properties; 6.13 Query Cursors; 6.14 Projection Queries; 6.15 Configuring Indexes; Chapter 7: Datastore Transactions; 7.1 Entities and Entity Groups; 7.2 What Can Happen in a Transaction; 7.3 Transactions in Python; 7.4 Transactions in Java; 7.5 How Entities Are Updated; 7.6 How Entities Are Read; 7.7 Batch Updates; 7.8 How Indexes Are Updated; 7.9 Cross-Group Transactions; Chapter 8: Datastore Administration; 8.1 Inspecting the Datastore; 8.2 Managing Indexes; 8.3 The Datastore Admin Panel; 8.4 Accessing Metadata from the App; 8.5 Remote Controls; Chapter 9: Data Modeling with Python; 9.1 Models and Properties; 9.2 Property Declarations; 9.3 Modeling Relationships; 9.4 Model Inheritance; 9.5 Queries and PolyModels; 9.6 Creating Your Own Property Classes; Chapter 10: The Java Persistence API; 10.1 Setting Up JPA; 10.2 Entities and Keys; 10.3 Entity Properties; 10.4 Embedded Objects; 10.5 Saving, Fetching, and Deleting Objects; 10.6 Transactions in JPA; 10.7 Queries and JPQL; 10.8 Relationships; 10.9 For More Information; Chapter 11: The Memory Cache; 11.1 Calling Memcache from Python; 11.2 Calling Memcache from Java; 11.3 Keys and Values; 11.4 Setting Values; 11.5 Getting Values; 11.6 Deleting Values; 11.7 Atomic Increment and Decrement; 11.8 Compare and Set; 11.9 Batching Calls to Memcache; 11.10 Memcache and the Datastore; 11.11 Handling Memcache Errors; 11.12 Memcache Administration; Chapter 12: Large Data and the Blobstore; 12.1 Accepting User Uploads; 12.2 Using BlobInfo Entities; 12.3 Serving Blobstore Values; 12.4 Deleting Blobstore Values; 12.5 Reading Blobstore Values; 12.6 A Complete Example; Chapter 13: Fetching URLs and Web Resources; 13.1 Fetching URLs in Python; 13.2 Fetching URLs in Java; 13.3 Outgoing HTTP Requests; 13.4 HTTP Over SSL (HTTPS); 13.5 Request and Response Sizes; 13.6 Request Deadlines; 13.7 Handling Redirects; 13.8 Response Objects; Chapter 14: Sending and Receiving Email Messages; 14.1 Sending Email Messages; 14.2 Receiving Email Messages; Chapter 15: Sending and Receiving Instant Messages with XMPP; 15.1 Inviting a User to Chat; 15.2 Sending Chat Messages; 15.3 Receiving Chat Messages; 15.4 Handling Error Messages; 15.5 Managing Presence; Chapter 16: Task Queues and Scheduled Tasks; 16.1 Configuring Task Queues; 16.2 Enqueuing a Task; 16.3 Task Parameters; 16.4 Push Queues; 16.5 Pull Queues; 16.6 Transactional Task Enqueueing; 16.7 Task Chaining; 16.8 Task Queue Administration; 16.9 Deferring Work; 16.10 Scheduled Tasks; Chapter 17: Optimizing Service Calls; 17.1 Calling Services Asynchronously; 17.2 Visualizing Calls with AppStats; Chapter 18: The Django Web Application Framework; 18.1 Using the Bundled Django Library; 18.2 Creating a Django Project; 18.3 Hooking It Up to App Engine; 18.4 Creating a Django App; 18.5 Using Django Templates; 18.6 Using Django Forms; 18.7 The django-nonrel Project; Chapter 19: Managing Request Logs; 19.1 Writing to the Log; 19.2 Viewing Recent Logs; 19.3 Downloading Logs; 19.4 Logs Retention; 19.5 Querying Logs from the App; 19.6 Flushing the Log Buffer; Chapter 20: Deploying and Managing Applications; 20.1 Uploading an Application; 20.2 Using Versions; 20.3 Managing Service Configuration; 20.4 Application Settings; 20.5 Managing Developers; 20.6 Quotas and Billing; 20.7 Getting Help; Colophon;