FAQ

Page Discussion History

ClojureModule

Nginx-Clojure is a Nginx module for embedding Clojure or Java or Groovy programs, typically those Ring based handlers.

There are some core features :

  1. Compatible with Ring and obviously supports those Ring based frameworks, such as Compojure etc.
  2. Use Clojure / Java / Groovy(NEW ) to write simple ring handlers for http services.
  3. Use Clojure / Java / Groovy(NEW ) to write a simple nginx rewrite handler to set var or return errors before proxy pass or content ring handler
  4. Non-blocking coroutine based socket which is Compatible with Java Socket API and works well with largely existing java library such as apache http client, mysql jdbc drivers. With this feature one java main thread can handle thousands of connections.
  5. Handle multiple sockets parallel in sub coroutines, e.g. we can invoke two remote services at the same time
  6. Asynchronous callback API of socket for some advanced usage
  7. Run initialization clojure code when nginx worker starting
  8. Support user defined http request method
  9. Compatible with the Nginx lastest stable version 1.6.0. (Nginx 1.4.x is also ok, older version is not tested and maybe works.)
  10. One of benifits of Nginx is worker processes are automatically restarted by a master process if they crash
  11. Utilizes lazy headers and direct memory operation between Nginx and JVM to fast handle dynamic contents from Clojure or Java code.
  12. Utilizes Nginx zero copy file sending mechanism to fast handle static contents controlled by Clojure or Java code.
  13. Supports Linux x64, Linux x86 32bit, Win32 and Mac OS X. Win64 users can also run it with a 32bit JRE/JDK

By the way it is very fast, the benchmarks can be found HERE .

Please visit nginx-clojure.github.io for more details.