Google App Engine for business

Google App Engine for Business (GAE) is a development and hosting platform for web applications. In some sense, it can be compared with an application server or more precisely with a cluster of application servers that offer similar services. GAE is a Cloud Computing technology that proposes to use Google's infrastructure to run applications that are scalable when the number of requests increases or when the need for storage space grows. Designing and testing a GAE application are all done on a local development platform that simulates both the services offered by GAE and the constraints that apply to a GAE app. Once the application has been tested locally, it can be uploaded on Google's servers using a simple command in the development tool.

So far, only two languages are available: Python and Java and, by extension, any language that can be executed on a JVM like Groovy or Ruby. For the Java language, the development platform (SDK) is available as an Eclipse plugin.

Google App Engine for business

The architecture of a Java application deployed on Google App Engine. The Secure Data Connector (SDC) that makes it possible for GAE to access data in IS behind a firewall will be covered in Chapter 9, Advanced Integration.

Applications that were developed for GAE can integrate seamlessly with all the Google Apps (Doc, Gmail, or Calendar). Any such application can then be distributed on the Google Apps marketplace.

By the end of 2010, GAE will operate with a 99.9% SLA. Centralized management of applications and security tools will also be provided.

Pricing is on a pay-per-use basis and starts when a certain threshold is crossed. Currently, this limit is about 500 MB of storage space and 5 million pages viewed per month.

Google App Engine for business

The Google App Engine administration console provides access to application settings, logs, and billing information

A web console for managing any application that runs under Google App Engine is available. Deploying new applications, adjusting their settings, or changing the version number is possible as well. Reading logs and navigating the Datastore are yet more features.

The deployment environment for GAE

The ma in features of the GAE environment are listed as follows:

  • Support for most dynamic page-creation technologies like JSP for Java and all Python libraries
  • Data storage in a non-relational database (Datastore) that is accessible in read or write mode through a set of APIs
  • Sorting operations on data and transactions are available.
  • Load balancing and automatic scaling
  • Using Google Apps accounts for authentication
  • Ability to launch asynchronous tasks or to queue them
  • All these services are available for both Java and Python

The sandbox

For security reasons, and also to decouple applications from physical servers, each GAE application runs in a secured environment called a "sandbox". From a conceptual point of view, this environment is quite similar to the execution context of a Java Applet within a browser, which prevents an app from accessing local physical resources, like the file system for instance. The application is seamlessly distributed on a network of servers that creates as many instances of the application as is necessary to match the load.

This environment, however, induces a number of limitations that you should be aware of when designing an application that will run on GAE.

Accessing a remote machine on the Internet, for instance, cannot be done directly. A dedicated service, the URL Fetch Service, should be used for that purpose. For a Java application, this simply amounts to encapsulating a remote call with the java.net network API.

A GAE application can only access those files that were uploaded simultaneously with the application itself. For persistence of data, other services should be used (see the following), such as the cache service or the Datastore.

There are other limitations regarding the processes. These should only be started by web requests, by "cronjobs", or queued jobs and their execution time should not exceed 30 seconds. Also, a process cannot start another process. A Java application cannot use the java.lang.Thread. API for this reason.

The Java environment

The Java development kit for GAE is compatible with Java 5 or Java 6. The environment includes the Java Standard Edition Runtime Environment (JRE) 6. The sandbox restrictions that we mentioned in the last section are implemented using the standard mechanisms of the Java security infrastructure at the JVM level. When a process violates one of these restrictions, a java.lang.RuntimeException exception is raised.

Only part of the Java Enterprise Edition API is available to build an application running on GAE. Accessing the various GAE services (see the following table) is through the usual APIs. Handling HTTP requests uses that standard Servlet API. The following table indicates which Java Enterprise Edition APIs are available on GAE:

Name of the API

Availability

Usage in GAE

Java Servlet API 2.4

Available

Basic API for handling HTTP requests.

Java Data Objects (JDO 2.3)

Available

Is the standard means to interact with a database whether it is relational or not. The GAE implementation includes an access to the Datastore.

Java Persistence API (JPA 1.0)

Available but partial compatibility

Another way to interact with a relational database. The GAE implementation allows accessing the Datastore but with restrictions.

Java Server Faces (JSF 1.1 et 2.0)

Available but requires adjusting settings

The standard presentation component framework in Java.

Java Server Pages (JSP et JSTL)

Available

The standard tag libraries in Java for building dynamic applications.

Java Beans Activation Framework (JAF)

Available

Allows inspection and manipulation of arbitrary data types.

Java Architecture for XML Binding (JAXB)

Available

A Java library that allows conversion of an XML document into a tree of Java objects and vice versa.

Java Mail

Available

Allows mail exchange in an application independently of the protocol used.

The status and usage of the different Java Enterprise Edition APIs on the GAE platform

Other Java APIs from the Enterprise Edition that are not available with GAE include: EJB, JAX-RPC, JAX-WS, JDBC, JCA, JMS, JNDI, or RMI. The reason behind this is that GAE security mechanisms already take care of these features or that these APIs are not compatible with them.

For the Java community, it is of interest to know that Google has recently partnered with VMware, the company that acquired SpringSource. Starting now, applications hosted on GAE will be able to use the Spring framework. Recall that, to this day, Spring remains an essential component in software architecture and is used in more than 70% of Java applications.

The RAD tool for Spring, Roo, developed by WMware, now includes the Google Web Toolkit, a graphical component technology from Google.

Google and VMware jointly developed test and performance tools that cover the whole stack of software architecture.

The GAE services

To achieve high levels of security and performance, GAE offers an array of services that, for the most part, just encapsulate the usual APIs.

URL Fetch allows access to a web service or another application on a remote machine while using Google's high-performance infrastructure.

Mail enables sending mail while benefiting from Google's infrastructure.

Memcache is a high-availability cache mechanism for storing key-value pairs. This service proves most useful when accessing the Datastore in a non-transactional way.

Image manipulation is a service that can manipulate JPEG and PNG images.

Asynchronous tasks can be used to start processing independently of request handling. There are two methods. The "cronjobs" are tasks for which one defines a periodicity (once a day, once every hour). The tasks can be queued in a waiting list as the usual means to handle asynchronous tasks.

A relational database (will be available by the end of 2010).

An SSL service for secure access to an enterprise domain (will be available by the end of 2010).

Meeting the constraints

The Datastore

The Datastore is a distributed and transactional persistence mechanism, which has its own request engine.

The distributed nature of the Datastore prescribes drastic limits on the structure of data that is not relational. The Datastore indeed has no equivalent for the traditional "join" between two tables, familiar in relational databases. Designing the persistence layer for an application running on GAE is substantially different from the usual practice with a relational model.

Without going into too many details, let's mention here that any persistent entity is characterized by both a "kind" and a set of properties. A list of entities can be sorted according to one of its parameters and searches within the list can be performed. Respecting integrity constraints is the responsibility of application code. APIs like Java JDO and JPA contain tools that simplify their implementation.

The Datastore uses optimistic concurrency management.

Quotas

Hosting of a GAE application is free; a Google account is all that is needed. Hosting remains free, provided storage space does not exceed 500 MB and that a quota of 5 million pages accessed per month is not exceeded. To go beyond these limits, it is possible to enable billing for hosting.

Each Google Apps account can deploy at most 10 applications running on GAE.

A few examples of sites running on GAE

The Food Prints application offers the possibility to retrieve the nutritive value of products from a large number of brands.

The Café Survey value can help to quickly create a poll and to collect associated data.

The iFreeTools CRM is a customer relationship management system.

The tFeeder application is an aggregator based on Tweeter that deals with news in the technology world.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset