Google APIs Get Faster Thanks to Smart Optimizations

Matthew Casperson, March 26th, 2010

Google Code“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.

Both comments and pings are currently closed.

3 Responses to “Google APIs Get Faster Thanks to Smart Optimizations”

March 26th, 2010
at 1:13 am
Comment by: William Antônio Siqueira

This is a revolution!

Sometimes I need just an information and I need to get a big XML/JSON to parse and get a single information…

March 31st, 2010
at 1:47 am
Comment by: 7 Ways to Make Your API More Successful

[...] 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’s API launched with this feature because it really is [...]

December 10th, 2012
at 8:48 pm
Comment by: Daniel Jacobson's Blog » 7 Ways to Make Your API More Successful

[...] 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 [...]

Follow the PW team on Twitter

ProgrammableWeb
APIs, mashups and code. Because the world's your programmable oyster.

John Musser
Founder, ProgrammableWeb

Adam DuVander
Executive Editor, ProgrammableWeb. Author, Map Scripting 101. Lover, APIs.