December 2nd, 2015
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: email@example.com
After about a week of experimentation, we hit a sticking point. While we had a large number of “normal” CRUD operations, all of our queries on behalf of the end user, were generated dynamically. Most of the Scala database ecosystem is geared towards extending Scala’s type system to include database query type checking. Overall, our enthusiasm for Scala didn’t survive the first attempt to port our query language system.
Clojure for the win
It was at this juncture where we re-evaluated Clojure, and specifically Korma. A quick prototype of the application was done in Clojure, and the most complicated aspect of our application was very easy to express. We made more headway in the first day than we had gotten done in Scala over a week and in general felt like it was a much more natural fit. Clojure it was!
The move from an async work queue to lightweight threads, significantly reduced the complexity of our codebase. This simplicity reduced the number of possible error states and generally made for a simpler and better user experience. In addition, between threads and the overall better latency profile of Clojure, user perceived speed improved dramatically.
The improvement in developer productivity has been dramatic. The JDK is mostly trivial to install, and with Leiningen, getting a developer machine setup has been uniformly painless. Day to day, far fewer issues come up and the overall language has been much easier to get new developers up to speed on than expected.
As a result of switching to Clojure a number of unanticipated benefits emerged. The stability of the JVM, the simplicity of having a single jar as a deployment artifact, and a pretty disciplined testing and code review process has allowed us to manage a relatively large number of instances (~15 at last count) with no real effort on our part. The combination of Elastic Beanstalk and an uberjar has made our overall support footprint negligible. We haven’t had a significant server crash that required manual intervention in about a year of running in production.