Ring server built with Netty (https://netty.io/)
Latest commit 37846c9 May 10, 2013 @aesterline aesterline Merge pull request #1 from RallySoftware/encoding
Character encoding of response body.
Failed to load latest commit information.
HISTORY.md Preparing for release. Apr 24, 2013



netty-ring-adapter is a ring server built with Netty. netty-ring-adapter is designed to be a drop in ring adapter that should work just like reference ring adapter.

Build Status


netty-ring-adapter is available as a Maven artifact from Clojars:

[netty-ring-adapter "0.4.6"]

Previous versions available as

[netty-ring-adapter "0.4.5"]
[netty-ring-adapter "0.4.4"]
[netty-ring-adapter "0.4.3"]
[netty-ring-adapter "0.4.2"]


(use 'netty.ring.adapter)

(defn handler [req]
  {:status 200
   :headers {"Content-Type" "text/html"}
   :body "Hello world from Netty"})

(def shutdown (start-server handler {:port 8080}))

;; If you want to stop the server, just invoke the function returned from the `start-server` function.

The server currently supports the following options when starting the server.

{ :port 8080                        ;; The port in which the server will be listening for requests
  :zero-copy true                   ;; Should the server send file response bodies with Netty's FileRegion functionality
  :channel-options                  ;; Channel options passed to the ServerBootstrap.setOptions
    { "child.tcpNoDelay" true}
  :max-http-chunk-length 1048576    ;; The maximum length of the aggregated content
  :number-of-handler-threads 16     ;; The number of threads that will be used to handle requests.
                                    ;; These threads are used to allow the handler function to work without blocking an I/O
                                    ;; worker thread.
  :max-channel-memory-size 1048576  ;; the maximum total size of the queued events per channel
  :max-total-memory-size 1048576    ;; the maximum total size of the queued events
  :debug :slf4j }                   ;; turns on debugging using the slf4j as a logging framework.
                                    ;; debugging options include (:commons :jboss :log4j :slf4j :jdk)

Using :zero-copy may not work in all cases depending on your operating system and JVM version. Please see FileRegion for more information.


To run the tests:

$ lein deps
$ lein test


  • Support HTTP Keep-Alive? Not sure if this already works, but it should.
  • Add metrics. Seems like it would be good to add JMX metrics to the various queues and requests/responses.
  • Create a lein plugin for the netty-ring-adapter.
  • SSL support


Distributed under the Eclipse Public License, the same as Clojure. http://opensource.org/licenses/eclipse-1.0.php