It’s turtles all the way down

This will be a quick one because I’m feeling a bit under the weather, but I wanted to post a quick update on some of our tornado-like progress post-alpha.

So, Bill mentioned in an earlier post that OpenSRF 2.0 might be JSON through and through. Looks like that has happened a little early. Yesterday at lunch Bill and I decided to sit down and plan out what it would take to move our low level messaging format from XML to JSON, and it turns out that it takes all of about 20 lines of Perl, 50 or so of C, and about 1 hour. Why did we do it? Well, using our handy-dandy benchmarking tool for the OpenSRF core we see these times for 100 iterations of a trivial request:

  • ALPHA hybrid XML-JSON messaging: Average round trip time: 0.031017 seconds
  • Pure JSON messaging: Average round trip time: 0.018740 seconds

Not only that, but we see CPU usage drop from around 30% per backend process down to around 12%, meaning that network latency and actual work are our bottlenecks. I love it when a plan comes together. 🙂

Oh, and as a side note (and another vote for the JSON way), we’ve trimmed a portion of the OPAC javascript that used to be about 40KB (and was something like 65KB as XML, many moons ago) down to about 13KB by slimming down the data and using pure JSON to encode it.