vege - Fotolia

Tip

Is JSON and XML your REST performance bottleneck?

Learn how ASCII encoding formats like JSON and REST can adversely impact server application performance compared with emerging binary formats.

The widespread use of ASCII encoding formats like JSON and rest may be killing server performance. A wide variety of emerging binary formats offer significantly improved performance for processing messages. This could be particularly important for I/O intensive applications like transaction processing, data analytics, and financial services.

The server-side recently spoke with Martin Thompson, founder of software consultancy Real Logic about the merits of binary encoding formats for message processing. He said, “I've seen many applications that spend significantly more CPU time parsing and transforming XML and JSON than executing business logic.”

Message parsing gains

This in particularly important in the finance industry, where applications need to be able to process market feeds that can peak at over 10 million messages per second, and are continuing to grow. The financial industry ratified the SBE binary messaging for processing financial data and transactions designed to dramatically reduce the latency compared with alternatives.

Thompson worked with a team to develop a reference implementation of SBE in Java, C++, and C# that was able to process about to process about 34,000 messages per second, or about 16-25 times faster than Google Protocol Buffers (GPB ) on the same hardware. This in turn was over a thousand times quicker then what can be achieved with JSON.

Achieving this level of efficiency is not for the faint of heart. Thompson said that the resulting application had to be debugged using the Wireshark protocol analyzer, rather than the built-in debugging tools in Java IDEs. This of course begs the question of whether more efficient binary formats that reduce CPU and networking bandwidth are worth the trade-off of increased developer bandwidth and a longer software development lifecycle.

Many binary messaging formats emerging

A number of different binary messaging formats have emerged over the last couple of years including the finance industry’s Fast Protocol, Google Protocol Buffers, Apache Avro, Facebook’s Thrift, and Microsoft Bond. All of these different formats promise increased efficiency compared with ASCII encoding formats like JSON and XML.

Adopting them can improve the throughput of almost any application involved in message processing. They also promise to reduce the power requirements in IoT devices, said Thompson. These messaging formats also show promise ingesting data from the rising tide of IoT devices now being deployed.

What holding back binary messaging?

At the same time these formats have not been widely adopted by the developer community outside of finance. One part of the challenge might be that JSON fits in well with the Java development paradigm. These other encoding formats require developers to stretch their thinking around application development. They may also make it harder to document an API in a way that is accessible to third-party developers. This could be a deal breaker for enterprises that work with a larger developer community that integrate the API into their applications.

Another factor holding back adoption may be that the performance gains are just not significant enough compared to other components of an application’s performance. If a particular application is more constrained by compute or memory limitations, a more efficient messaging protocol will not be as important. Enterprises would also have to consider how to shift their development tooling and train developers to get the most from these new protocols.

In some ways, it’s surprising that enterprises are starting to adopt less performance development languages like JavaScript and Python. But this makes a lot of sense when developer attention becomes a scarcer resource. Futurist George Gilder once opined that the best business models waste the eras cheapest resources in order to conserve the era’s most expensive resources. As the cost of cloud services goes the cost of an efficient application development lifecycle becomes more important. Thus, some start to finish. Businesses may want to wait until these binary messaging alternatives become cheaper to integrate into modern applications.

Next Steps

Here are some alternatives to REST if performance is a problem

Still wondering about the differences between SOAP and REST?

governance model is the key to managing your RESTful web service portfolio

Dig Deeper on DevOps-driven, cloud-native app development