Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

What's the Best Library to Consume JSON in IoT Applications?

DZone's Guide to

What's the Best Library to Consume JSON in IoT Applications?

Using JSON in a low latency environment.

· IoT Zone
Free Resource

Download Red Hat’s blueprint for building an open IoT platform—open source from cloud to gateways to devices.

In this post I am including the performance of our JSON parser.  Given a choice I suggest YAML for a host of reasons, however if you have to use JSON, how does the performance compare?

The Message

The message is simple and contains a number of data typoes.

"price":1234,"longInt":1234567890,"smallInt":123,"flag":true,
"text":"Hello World!","side":"Sell" 

The actual message doesn't have a new line in it

The Performance

This is the time to write and then read the message.

These timings are in micro-seconds (0.001 milli-seconds)

Wire Format Bytes 99.9 %tile 99.99 %tile 99.999 %tile worst
JSONWire 100* 3.11 5.56 10.6 36.9
Jackson 100 4.95 8.3 1,400 1,500
Jackson + C-Bytes 100* 2.87 10.1 1,300 1,400
BSON 96 19.8 1,430  1,400 1,600
BSON + C-Bytes 96* 7.47 15.1 1,400 11,600
BOON Json 100 20.7 32.5 11,000 69,000

"C-Bytes" means using Chronicle Bytes to provide a recycled buffer.

"*" means this data was written to/read from direct memory wouldnt' need additional copying to use with NIO.

The code is the same as in this post and this post, the only difference is the use of JSONWire.

Conclusion

JSONWire may be a very good choice for performance, especially where consistent low latency through ultra low garbage production is required.

Build an open IoT platform with Red Hat—keep it flexible with open source software.

Topics:
json ,performance

Published at DZone with permission of Peter Lawrey, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}