Azure Table JSON vs. AtomPub

A few months ago Microsoft released an update to the Microsoft Azure platform allowing developers to access Azure Tables using JSON payloads. Until then, developers had no choice but to use the AtomPub model.  Since this was the only data representation model available, there was no choice to be made, and as a result the use of the AtomPub model was implicit. With the introduction of JSON payloads, developers can now choose one or the other. Although the choice of using AtomPub or JSON is largely transparent (there are at this time a couple of minor exceptions), meaning that there are no functionality differences, developers should use the JSON payload going forward because the payload is significantly smaller. Take a quick look at payload examples on the MSDN documentation

To use the JSON payload, developers can set the PayloadFormat property as such (tableClient is and instance of CloudTableClient):

  tableClient.DefaultRequestOptions.PayloadFormat = TablePayloadFormat.JsonNoMetadata;

In order to see how much data was actually flowing through, Microsoft published a small test application that allows you to send a few entities into an Azure Table. The source code provided by Microsoft can be found on that page, so it’s pretty easy to try it out. However I needed to see this in action, and wanted to use Fiddler to see the actual payload leaving my machine. So I used the same general idea provided by the sample code from Microsoft and modified it to create my own test harness. To do this, I created a new Console application using Visual Studio 2012, added the Windows Azure Storage 3.0 library as a Nuget package, and created a simple application. You can download my test harness here.  The application saves an log data in a test table called LogTest.  You can change the ‘count’ variable to add more records if you want.

I used Fiddler to capture the tests. The first test was to insert 100 entities in my Azure Table using JSON. The second test was to read those entities back using JSON. The third was to insert 100 entities using AtomPub and the fourth was to read them back using AtomPub. Here are the results of those tests:

  JSON Payload AtomPub Payload Payload Savings
Insert 100 Entities 97,700 bytes sent 155,870 bytes sent -37%
Read 100 Entities 40,550 bytes received 122,578 bytes received -67%

 

In my tests, the JSON payload reduced network traffic (bytes sent) by 37% when inserting data, and about 67% when reading data (bytes received). Note that there was virtually no performance improvement in terms of execution time; the advantage of using JSON is limited to smaller network payloads. Still, this is a significant difference; considering that extracting data out of the Microsoft data centers costs money, companies that read lots of data from Azure Tables could realize cost savings as a result of using JSON payloads.

About Herve Roggero

Herve Roggero, Microsoft Azure MVP, @hroggero, is the founder of Blue Syntax Consulting (http://www.bluesyntaxconsulting.com). Herve's experience includes software development, architecture, database administration and senior management with both global corporations and startup companies. Herve holds multiple certifications, including an MCDBA, MCSE, MCSD. He also holds a Master's degree in Business Administration from Indiana University. Herve is the co-author of "PRO SQL Azure" and “PRO SQL Server 2012 Practices” from Apress, a PluralSight author, and runs the Azure Florida Association.

Print | posted @ Monday, July 14, 2014 8:31 AM

Comments on this entry:

Comments are closed.

Comments have been closed on this topic.