Monday, May 19, 2008

San Francisco Hack-a-thon



On Friday, May 16th, we had our second Google App Engine Hack-a-thon at the Google offices in San Francisco. For 12 hours, developers coded, talked with the Google App Engine engineering team and each other, and filled up on Google snacks.

At the end of the day we had some great results:



Check out some pictures of the Hack-a-thon:



If you still haven't got a chance to meet the App Engine developers and build some apps with other App Engine developers, we will be holding some codelab sessions at Google I/O, our annual developer event on May 28th and 29th.

Thursday, May 15, 2008

App Engine Launcher for Mac OS X

While I was writing scenario applications to test Google App Engine, I had the following idea: If BBEdit, Dreamweaver, CSSEdit, and TextMate were at a party, what kind of application would be welcomed to help with App Engine development? As silly as this sounds, it led me to think more about workflow. I used:

  • a few applications for Python, CSS, HTML, and JavaScript.
  • the command line to run applications and to view logs.
  • a browser to test locally and to access the local developer console.
  • the command line to deploy the application.
  • a browser to view a live application's dashboard.

I began to think about how unfriendly command line interfaces can be, and how much repetitive typing I had been doing to test and deploy applications. With that said, I worked with John Grabowski of the Google Mac team and Brett Slatkin, an engineer on App Engine, on a 20% project to make Google App Engine Launcher for Mac OS X.

Now, App Engine Launcher is not a replacement for your code editor or your IDE. It improves your App Engine development experience by managing a list of your applications. With a few clicks you can run, browse, deploy, and view logs for your applications. It also has some added sugar thrown in like drag and drop, integration with your editor, and quick links to the local developer console and the live application dashboard.

Download it now. If it's missing a feature that you'd like to see (like scripting, a Windows or Linux version, human-level AI ;), let us know in the Discussion Group.

Thursday, May 8, 2008

Google App Engine New York Hack-a-thon



Yesterday, Google App Engine held our first ever hack-a-thon at the Google Office in New York City. We had a great turn out of App Engine developers. Some programmed along with us, building a wiki, and some developers brought along their own ideas and spent the day building some awesome applications.

At the end of the day, a few developers even came up and presented their work:

  • An application that provides 'a simple API for writing and reading small chunks of data from anywhere' : http://tinydb.org/
  • An app that adds photos to the developer's facebook account
  • An Open Source Django utility project: http://code.google.com/p/django-ae-utils/
  • An application that searches for clinical trials based on keywords
  • An application that uses GWT, Maps and Gears to track and map appointments and uses App Engine to keep the client side data synced
  • An app where users can list items for sale and get emails from interested buyers: http://sellstuff.appspot.com/
Check out the pictures for the event at: http://picasaweb.google.com/appengine.hackathon/GoogleAppEngineHackathon#



We look forward to seeing you at the San Francisco Hack-a-thon on May 16th

Tuesday, May 6, 2008

An Open Source App: Rietveld Code Review Tool

My first project as a Google engineer was an internal web app for code review. According to Wikipedia, code review is "systematic examination (often as peer review) of computer source code intended to find and fix mistakes overlooked in the initial development phase, improving both the overall quality of software and the developers' skills." Not an exciting topic, perhaps, but the internal web app, which I code-named Mondrian after one of my favorite Dutch painters, was an overnight success among Google engineers (who evidently value software quality and skills development :-). I even gave a public presentation about it: you can watch the video on YouTube.

I've always hoped that we could release Mondrian as open source, but so far it hasn't happened: due to its popularity inside Google, it became more and more tied to proprietary Google infrastructure like Bigtable, and it remained limited to Perforce, the commercial revision control system most used at Google.

Fortunately, now that I work on the Google App Engine team, I've been able to write a new web app that incorporates many ideas (and even some code!) from Mondrian, and release it as open source. The Python open source community has been trying out Rietveld for the past few days, and has already been using it to do code reviews for Python (as well as providing valuable feedback in the form of bug reports and feature requests). Of course, the tool is not language-specific: you can use it for code reviews for any language!

To learn more about Rietveld, try it out, or take a look at the code, check out the article on Google Code!

Monday, April 28, 2008

Tips on writing scalable apps

Google App Engine makes writing scalable apps easier, and a well-designed app should be able to grow automatically from one user to millions. What does it mean for a Google App Engine application to be "well-designed," though? Here are a few simple tips that, if you design with them in mind, should help ensure your App will stand up with grace and aplomb, even under heavy load.

  • Avoid contention on datastore entities. If every request to your app reads or writes a particular entity, latency will increase as your traffic goes up because reads and writes on a given entity are sequential. One example construct you should avoid at all costs is the gobal counter, i.e. an entity that keeps track of a count and is updated or read on every request. There are some interesting ways of simulating this behavior that don't require reads/writes on every request, and we'll talk about a handy way to cache entities for reads below.
  • Avoid large entity groups. Any two entities that share a common ancestor belong to the same entity groups. All writes to an entity group are sequential, so large entity groups can bog down popular apps quickly if there are a lot of writes to that group. Instead, use small, localized groups in your design.
  • Write sparingly. Writes are more expensive than reads; keep this in mind when designing your data model. If you can avoid a write--it's best to do so.
  • Define a main() function for code reuse. Instances of your app are kept running for a certain period after each request, so there's a chance that any request will hit an already-running app. Apps that define main as in the following example:

    def main():
       application = webapp.WSGIApplication(_URLS, debug=True)
       wsgiref.handlers.CGIHandler().run(application)

    if __name__ == '__main__':
       main()
    can reuse global variables, so although there's no guarantee that any given request will hit a running app instance, you can take advantage of this to non-deterministically cache entities and other expensive values. This works simply because App Engine will detect if main() is present in an already-loaded script and call it instead of re-importing.
  • Profile your code. You can use the Python profiler to profile your code's performance.
Do you have tips for scaling web apps on App Engine? Post them in our Google Group!

Wednesday, April 23, 2008

Google App Engine + Google Data APIs: A Match Made on the Web



Don't you think it'd be cool if you could blog about a party, add it to your calendar and invite all your friends in one fell swoop? After the party, how about viewing photos and videos from the event in the same application? The Google Data APIs make all this possible, and your Google App Engine apps can use feeds from Google services to display and update information for a particular user stored by these services.

The Google Data APIs team just released an update to the Google Data Python client library which includes support for Google App Engine. With this library, your app can now use AuthSub to gain access to your users' feeds.

Jeff Scudder, member of the Google Data APIs team and the main contributor to the Google Data Python client library, has written an article that takes you through all of the steps necessary to use Google Data feeds in your Google App Engine application. He's even added his sample application to our Google App Engine sample code project.

Try out it, and let us know what you come up with!

Monday, April 21, 2008

Google App Engine Hack-a-thons!



In May, Google will be holding two free Google App Engine developer events: one in New York and one in San Francisco.

Learn about Google App Engine
The events will include training on the major features of Google App Engine, including data modeling, the App Engine APIs, some aspects of Django, and how to mashup App Engine with other web services. Google Engineers and Product Managers will be on hand to help and answer questions throughout the day.

As well as covering the Google App Engine SDK, we will show you how to deploy and manage your own applications on Google App Engine servers. For people who don't already have a Google App Engine account, we will be inviting people who come to the hack-a-thon to develop on App Engine.

Build With Us, or Build Your Own
We will use the information shared at the event to build up a working Google App Engine application throughout the day, which you can code along with us. On the other hand, if you already have a great idea for what to build, bring that idea along. Even better, bring along anything you can prepare ahead of time (sketches, designs, web page mock ups, etc.) and use the time and information provided to develop your idea into a working application, then share it with the world.

What Do I Need?
We will provide facilities, power, food and refreshments and experts to help you learn to use Google App Engine and write your application. Just bring your laptops, ideas and enthusiasm to complete the mix. We will assume some basic skills and preparation for the event, and these details will be provided soon.

When and Where?
The first event will be in New York, on May 7th from 10am to 6pm. The second will be in San Francisco on May 16th from 10am to 10pm. Space is limited so sign up now!

New York Hack-a-thon
San Francisco Hack-a-thon