Clojure is a dynamic, general-purpose programming language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. If you are considering microservice development in Clojure or maybe you have heard of Clojure and are just curious about what it is all about, then read on as this blog is for you.
Clojure was first released in 2007 by the CTO of a small consulting company that was recently acquired by a Brazilian digital bank. Its creator, Rich Hickey, had this to say about why he invented Clojure. “I wanted a language as acceptable as Java or C#, but supporting a much simpler programming model, to use for the kinds of information system development I had been doing professionally.” In terms of programming language popularity, Clojure is pretty low on the list but still in the top 100.
I came to Clojure in 2014. It was a time when Java the programming language was losing mindshare but Java the Virtual Machine was experiencing a renaissance of interest. Other high profile languages hosted in the JVM include Groovy, Scala, and Kotlin. There are over 60 niche languages hosted on the JVM. I picked Clojure as the first JVM hosted language to learn because it was inspired by Lisp which I enjoyed learning when I was much younger. I started this learning adventure by implementing a rudimentary news feed microservice in Clojure.
Fast forward to today which is 7 years after that. I decided to revisit Clojure again to see what innovations and improvements to that community and ecosystem have transpired since. I rewrote a similar microservice in Clojure using more modern frameworks, techniques, etc. The article below documents my findings in terms of architecture, design, coding, and performance testing under load. Both implementations are open source and freely available at my github repo.
|Revisiting Clojure||article below|
|Donkey||Clojure framework covered here|
|Intro to Donkey||Original InfoQ article|
|A History of Clojure||Origins of Clojure from its inventor|
|Clojure||home page for Clojure|
|Clojure – Java Interop||Source for the quote about type hints|
|Vert.x||reactive web framework for Donkey|
|JDBI||used to access relational database|
|Clojure Ring||Clojure framework used by feed 1|
|Pedestal||another Clojure framework|
|Leiningen||build tool for both feed 1 and 13|
|Jetty||server backend used by feed 3, 6, and 8|
|Netty||server backend used by feed 11, 12, and 13|
|Java NIO||Netty uses this part of the JRE for non-blocking IO|
|reactive programming||concepts behind reactive programming|
|feed 1||the original news feed implementation in Clojure|
|feed 13||Clojure rewrite of news feed implementation|
|Counterclockwise||IDE used for deving feed 1|
|Gatling||use this to load feed 13 while profiling|
|Visual VM||used to profile feed 13|
Having trouble viewing the embedded document? Feel free to download the PDF for offline viewing.