• No results found

Google App Engine

In document Thesis MSCC 2763777 Amit Sharma (Page 30-36)

3.1.1 What Is Google App Engine?

Google App Engine lets you run your web applications on Google's infrastructure. App Engine applications are easy to build, easy to maintain, and easy to scale as your traffic and data storage needs grow. With App Engine, there are no servers to maintain: You just upload your application, and it's ready to serve your users [36].

We can serve our app from our own domain name (such as http://www.example.com/) using Google Apps. Or, we can serve our app using a free name on the appspot.com domain. You can share your application with the world, or limit access to members of your organization [36][40][41].

3.1.2 The Application Environment

Google App Engine makes it easy to build an application that runs reliably, even under heavy load and with large amounts of data. App Engine includes the following features [36][40][41].

 dynamic web serving, with full support for common web technologies

 persistent storage with queries, sorting and transactions

 automatic scaling and load balancing

 APIs for authenticating users and sending email using Google Accounts

 a fully featured local development environment that simulates Google App Engine on your computer

 task queues for performing work outside of the scope of a web request

 scheduled tasks for triggering events at specified times and regular intervals

Your application can run in one of two runtime environments: the Java environment, and the Python environment. Each environment provides standard protocols and common technologies for web application development [36][40][41].

3.1.3 The Sandbox

Applications run in a secure environment that provides limited access to the underlying operating system. These limitations allow App Engine to distribute web requests for the application across multiple servers, and start and stop servers to meet traffic demands. The sandbox isolates your application in its own secure, reliable environment that is independent of the hardware, operating system and physical location of the web server [36][40][41].

3.1.3.1 Examples of the limitations of the secure sandbox environment include:

 An application can only access other computers on the Internet through the provided URL fetch and email services. Other computers can only connect to the application by making HTTP (or HTTPS) requests on the standard ports.

 An application cannot write to the file system. An app can read files, but only files uploaded with the application code. The app must use the App Engine datastore, memcache or other services for all data that persists between requests.

 Application code only runs in response to a web request, a queued task, or a scheduled

The Java runtime environment uses Java 6. The App Engine Java SDK supports developing apps using either Java 5 or 6 [36][40][41].

The environment includes the Java SE Runtime Environment (JRE) 6 platform and libraries. The restrictions of the sandbox environment are implemented in the JVM. An app can use any JVM bytecode or library feature, as long as it does not exceed the sandbox restrictions. For instance, bytecode that attempts to open a socket or write to a file will throw a runtime exception [36][40][41].

Your app accesses most App Engine services using Java standard APIs. For the App Engine datastore, the Java SDK includes implementations of the Java Data Objects (JDO) and Java Persistence API (JPA) interfaces. Your app can use the JavaMail API to send email messages with the App Engine Mail service. The java.net HTTP APIs access the App Engine URL fetch service. App Engine also includes low-level APIs for its services to implement additional adapters, or to use directly from the application. See the documentation for the datastore, memcache, URL fetch, mail, images and Google Accounts APIs [36][40][41].

Typically, Java developers use the Java programming language and APIs to implement web applications for the JVM. With the use of JVM-compatible compilers or interpreters, you can also use other languages to develop web applications, such as JavaScript, Ruby, or Scala [36][40][41].

3.1.5 The Datastore

App Engine provides a powerful distributed data storage service that features a query engine and transactions. Just as the distributed web server grows with your traffic, the distributed datastore grows with your data [36][40][41].

The App Engine datastore is not like a traditional relational database. Data objects, or "entities,"

have a kind and a set of properties. Queries can retrieve entities of a given kind filtered and sorted by the values of the properties. Property values can be of any of the supported property value types [36][40][41].

Datastore entities are "schemaless." The structure of data entities is provided by and enforced by your application code. The Java JDO/JPA interfaces and the Python datastore interface include features for applying and enforcing structure within your app. Your app can also access the datastore directly to apply as much or as little structure as it needs [36][40][41].

The datastore is strongly consistent and uses optimistic concurrency control. An update of a entity occurs in a transaction that is retried a fixed number of times if other processes are trying to update the same entity simultaneously. Your application can execute multiple datastore operations in a single transaction which either all succeed or all fail, ensuring the integrity of your data [36][40][41].

The datastore implements transactions across its distributed network using "entity groups." A transaction manipulates entities within a single group. Entities of the same group are stored

together for efficient execution of transactions. Your application can assign entities to groups when the entities are created [36][40][41].

3.1.6 Google Accounts

App Engine supports integrating an app with Google Accounts for user authentication. Your application can allow a user to sign in with a Google account, and access the email address and displayable name associated with the account. Using Google Accounts lets the user start using your application faster, because the user may not need to create a new account. It also saves you the effort of implementing a user account system just for your application [36][41][40].

If your application is running under Google Apps, it can use the same features with members of your organization and Google Apps accounts [36][40][41].

The Users API can also tell the application whether the current user is a registered administrator for the application. This makes it easy to implement admin-only areas of your site [36][40][41].

3.1.7 Development Workflow

The App Engine software development kits (SDKs) for Java and Python each include a web server application that emulates all of the App Engine services on your local computer. Each SDK includes all of the APIs and libraries available on App Engine. The web server also simulates the secure sandbox environment, including checks for attempts to access system resources disallowed in the App Engine runtime environment [36][40][41].

Each SDK also includes a tool to upload your application to App Engine. Once you have created your application's code, static files and configuration files, you can run the tool to upload the data. The tool prompts you for your Google account email address and password [36][40][41].

When you build a new major release of an application that is already running on App Engine, you can upload the new release as a new version. The old version will continue to serve users until you switch to the new version. You can test the new version on App Engine while the old version is still running [36][40][41].

The Java SDK runs on any platform with Java 5 or Java 6. The SDK is available as a Zip file. If you use the Eclipse development environment, you can use the Google Plugin for Eclipse to create, test and upload App Engine applications. The SDK also includes command-line tools for running the development server and uploading your app [36][40][41].

The Python SDK is implemented in pure Python, and runs on any platform with Python 2.5, including Windows, Mac OS X and Linux. The SDK is available as a Zip file, and installers are available for Windows and Mac OS X [36][40][41].

3.1.8 The Administration Console

The Google App Engine Administration Console gives you complete access to the public version of your application. Access the Console by visiting the following link in your web browser:

[36][40][41].

https://appengine.google.com

Sign in with your Google account, or create one with an email address and password.

If you are using App Engine with your Google Apps account, you can sign in to App Engine for your domain using a URL similar to the following, where your-domain.com is your Google Apps domain:

https://appengine.google.com/a/your-domain.com

We can use the Administration Console to:

 create a new application, and set up a free appspot.com sub-domain, or a top-level domain name of your choosing

 invite other people to be developers for your application, so they can access the Console and upload new versions of the code

 view access data and error logs, and analyze traffic

 browse your application's datastore and manage indexes

 view the status of your application's scheduled tasks

 test new versions of your application, and switch the version that your users see [36][40][41].

In document Thesis MSCC 2763777 Amit Sharma (Page 30-36)

Related documents