Google APIs Get Faster Thanks to Smart Optimizations

Matthew Casperson
Mar. 26 2010, 12:22AM EDT

“Doing more with less” is one of those mantras that developers can quite often ignore thanks to ever increasing bandwidth, memory and CPU speeds. Google has once again bucked this trend, this time by announcing that they intend to implement changes that can be used to optimize most of their API’s that are based on the Google Data Protocol:

Today, we’re proud to take our first big step in making APIs faster by introducing two experimental features in the Google Data Protocol, partial response and partial update. Together, partial response and partial update can drastically reduce the network, memory, and CPU resources needed to work with Google APIs.

The changes mean that developers can now specify which fields should be returned by the server, meaning only the data that is required is actually transmitted:

With the addition of partial response you can now use the fields query parameter to request only relevant information -- in this case, event titles and times. Constructing such a request using the fields query parameter is simple:

GET http://www.google.com/calendar/feeds/zachpm@google.com/private/full?fields=entry(title,gd:when)

By including the entry argument and specifying title and gd:when, this request ensures that the partial response contains only the title and time for each event, along with a small amount of wrapping metadata.

In addition, the partial update feature allows developers to modify the returned data:

Simply edit the data you received in the partial response and use the HTTP PATCH verb to send the modified data back to the server. The server then intelligently interprets your PATCH, updating only the fields you chose to send. Throughout this entire read-modify-write cycle, the unneeded data remains server-side and untouched.

For such a simple concept, the benefits can be quite significant. The blog post mentions a scenario where a partial response managed to reduced the amount of data that was transferred by 95%. You can easily try this demo for yourself. If you are logged into your Google Account, compare the response size of this partial calendar feed to this full calendar feed.

Right now four Google APIs have implemented the new partial response and update functionality: YouTube, Calendar, Picasa Web Albums and SideWiki data. However Google is planning to add it across the range of APIs that are built on the Google Data Protocol.

Matthew Casperson Matthew is a freelance writer, focusing on web and multimedia technologies. His work can be found featured on Programmable Web, Brighthub, Hubfolio, Chrome Experiments, Informit, Flash Tuts Plus and The Tech Labs.

Comments

Comments(3)

User HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

[...] Efficient: Handle Partial Response This concept is now starting to get some more traction, now that Google announced partial response handling for some of their APIs. But NPR&#8217;s API launched with this feature because it really is [...]

[...] Handle Partial Response This concept is now starting to get some more traction, now that Google announced partial response handling for some of their APIs. NPR’s API also makes extensive us of this feature because it really is [...]