Analysis of JSON parser for Elixir

Anwesh Reddy
2 min readMar 18, 2019

--

Well, Elixir is been moved into production in serious environments. One of the major deployment, I came across is JSON API or JSON related endpoints on Elixir application.

We have observed that, Poison used to be and still being used as JSON parser in many major modules. Now, Jason is default in phoenix application, for its performance upgrades.

This is good for small scale application, but when the application has to process 5MB/sec and when application have to process about 4–5TB/data a day. Even Jason falls short.

Today, we look at various implementation of Json parser and results we experienced.

List consists of -

  1. Poison
  2. Jason
  3. Jiffy (eljiffy elixir wrapper)

Poison — Is probably the first JSON parser in Elixir ecosytem.

Jason — Build after seeing short comings of Poison, having the similar functions to help in migration and been using in phoenix framework since 1.4.

Jiffy — Not exactly a Elixir/Erlang module, it is C NIF to erlang ecosystem.

Code Migration is pretty straight forward.

Integration with phoenix with Jiffy.

Following are server outputs, we found.

CPU load when Jason is used
CPU load when Jiffy is used

We observed a drop of 40–50% load on CPU, when we are using jiffy endpoint.

For benchmark comparison, Jason developer has some benchmarks

Ref from Jason

Jiffy is clear winner in terms of performance and memory.

Most people stayed away from jiffy because of lesser popularity and no wrapper until now, there are many hidden gems in hex binaries.

--

--