Re:600K concurrent HTTP connections with Clojure and http-kit
by stiff on Monday January 28, 2013 @02:42AM
(#5127601)
The server itself seems to be written in Java: https://github.com/http-kit/http-kit I wonder what the factors were for not writing it in Clojure if Clojure is the target platform.
[ Parent
| on HN ]
Re:600K concurrent HTTP connections with Clojure and http-kit
by ptaoussanis on Monday January 28, 2013 @04:50AM
(#5127859)
To clarify: the core server is indeed written in Java, but it's written to conform to the standard Clojure web server (Ring [1]) spec and to be consumed by Clojure applications.
The public API is all Clojure-side and essentially uses the Java parts as an implementation detail. This kind of interop is easy to do with Clojure and is usually motivated by performance.
The best way of describing http-kit would probably be as a "Clojure web server written in Java".
Re:600K concurrent HTTP connections with Clojure and http-kit
by shenedu on Monday January 28, 2013 @04:04AM
(#5127756)
author here:
Java part:
1. Java NIO's performance is amazing: event driven r/w bytes
2. maintain state machine when parsing HTTP from bytes buffer need many local variables, I get used to do it in a C style code.
Clojure: I like this language. It's brilliant. So I write a fast http server/client for it. Clojure is also write in JAVA, great interoperation
Re:600K concurrent HTTP connections with Clojure and http-kit
by nqzero on Monday January 28, 2013 @09:55AM
(#5128688)
can the http-kit server be used from java directly ? last i looked, all the async java webservers seemed limited to 1000s of connections, which largely defeats the purpose. i'm willing to give up the servlet spec if needed
Re:600K concurrent HTTP connections with Clojure and http-kit
by shenedu on Monday January 28, 2013 @09:26PM
(#5132019)
Hey, http-kit can be used to from java directly:
https://github.com/http-kit/http-kit/blob/master/test/java/o...
Not recommended! The API is very lowlevel.
Maybe you can try to tweak the max allowed open file to a larger value. The default is about 1024, that how you just get 1000(I guess). Jetty is quite good at concurrency, you can double check it.
Why not try Clojure? Your web dev's productivity increase by few times instantly.