Server in the sky: Getting started with Google App Engine

Credit: Space & Light via Flickr

Getting development resources from IT departments takes time. It can take months, even for a priority project. Then there’s the tussle for resources and software, for tools and for expertise. With IT teams setting priorities that might not be aligned with your business needs, the app you need may be too late or, as is often the case, never built.

That’s where the cloud and Bring Your Own Development (BYODev) come in -- you find the tools that are needed when you need them. It’s no wonder then that Platform as a Service environments like Google’s App Engine are becoming increasingly popular. Sure, you have to pay for the resources you use, but with a corporate credit card and a cooperative manager, you can build and run the app you need when you need it, for as long as required. $25 – or even $250 – for a month of running an app in the cloud is a fraction of the cost of servers, software, and developer time.

Credit: Simon Bisson
Firing up an App Engine account is just a click away

Google designed App Engine for web applications. That means it’s quick and easy build HTML apps that just need a browser (though you can easily take advantage of REST endpoints in your code to link it to desktop and mobile apps).  It’s built around the old familiar CGI features that have driven web apps since the 90s, but uses modern tooling to give you the speed and performance you expect. Apps are driven by request handlers, which are accessed via URLs, using the webapp framework to simplify your code and handle the underlying complexity of HTTP for you. Webapp also gives you tooling to support HTML forms, managing input and output.

That’s much the same as most other PaaS services, whether it’s Azure or Heroku. But App Engine differs in that it gives you access to key elements of Google’s infrastructure. So you can use Google’s user tooling to add authentication to your apps, either using Google accounts or OpenID for single sign on services (there’s also OAuth support for app-to-app authentication). It’s also possible to work with Google’s storage tools, both to manage large amounts of data, and using parallel programing techniques to quickly process and explore data. Google is also providing experimental endpoints for mobile devices, but these can change – so keep them for apps that aren't going to become business essential.

The documentation for App Engine’s Datastore has been written by a master of ironic understatement:“Storing data in a scalable web application can be tricky”.

Luckily for us, we can take advantage of Google’s cloud scale experienc. Google App Engine’s High Replication Datastore distributes data across Google’s datacenters, making it extremely resilient. The HDR is a hierarchical entity store, so you can’t treat it like a traditional database. You’ll need to structure data differently, thinking about working with entity groups in a store that only guarantees eventual consistency. The App Engine data store works well for semi-structured information, where you're collecting and collating information. More structured data can use a cloud hosted version of MySQL, or can be stored in Google Sheets via the Google Docs web APIs.

Credit: Simon Bisson
Write App Engine code in any text editor, on any PC, anywhere

You don’t have to worry so much about querying your data once it's been loaded in the HRD. The App Engine store has its own SQL-like query language, GQL. If you’re written SQL code, then you’ll be able to write GQL. There’s even an inline query option using methods to build query options. To get the best results, you’ll need to work with what Google calls an ancestor query that limits results to just one entity group in your store. While that seems inefficient, you can use multiple parallel ancestor queries to work across a large amount of data. A built-in data modeling API simplifies creating and storing your data.

App Engine is able to take advantage of other parts of the Google cloud. You can use built-in MapReduce tools to work with large data, or use the REST interface that’s built into the BigQuery service to use App Engine code to work with extremely large data sets. Other features let you use a Task Queue to handle asynchronous background processing – so you can hand complex features off to a series of threads. As Task Queues can work asynchronously, you can use them to handle queries that work with external services, or that need to work efficiently with large amounts of data. There’s also support for XMPP, to link apps to Google Chat and other instant messaging services.

Python isn’t the only option for building App Engine apps. You can also use Java and Google’s own experimental Go language. However, Python is certainly the easiest option – it’s a commonly used web development tool, and Google takes advantage of many of the tool kits and libraries that are in wider use. Development tooling doesn’t need to be complex, either, as versions of the App Engine SDK are available for most desktop operating systems – and include a local version of the App Engine operating environment. That local environment makes building and testing apps on your PC a matter of just a few clicks in the App Engine Launcher, and once you’re done, another few clicks uploads your files to your App Engine account and the Google cloud. All you need is your favorite text editor.

As Python is an interpreted language, that means you can work with live apps on your PC, editing code and templates in a text editor, ready to test each change in your browser as you make it. There’s support for external files, so you can add images and CSS to give your apps a more polished look and feel. All you need to do is add handlers in the configuration file for additional URLs and associated directories. App Engine supports the Django templating language to help style pages around your code – which will also simplify your code, as you don’t have to programmatically construct every piece of HTML and JavaScript on your pages.

Credit: Simon Bisson
The App Engine dashboard shows you just how your app is running

If you’re planning on using App Engine for BYODev, you’ll find Google’s pricing structure attractive. A basic account gives you 10 apps on Google’s Appspot domain (you can tie them to a custom domain if you have a Google Apps account), and the generous usage quotas in the free tier means that most basic departmental apps will never be chargeable – and if they are, the pricing remains relatively low compared to other cloud services. You’ll get plenty information about your apps in the dashboard, helping you keep an eye on usage – as well as spotting problems quickly.

Oh, and you don't need to wait for that server to be configured.

From CIO: 8 Free Online Courses to Grow Your Tech Skills
View Comments
Join the discussion
Be the first to comment on this article. Our Commenting Policies