On Tuesday, June 23, 2015, Mike Grabowski wrote:
> ... I just can't stop thinking about non-blocking evented
> IO interactions. It just does not feel right to me to
> block the thread when e.g. logging in an user.
> Unfortunately, there are no NIO drivers for the database
> engines I am interested in (Neo4J, Mongo) so async
> channels are not the way to go.

This is pretty much unavoidable on the JVM. Java started
with a multi-threaded blocking I/O model, and that's still
how most Java code is written despite the availability of
non-blocking I/O.

The typical way to mitigate this in Java is with thread
pools. The JVM is capable of handling hundreds of threads,
and modern operating systems are pretty good at
context-switching.

For an extreme example, look at Netflix's [Hystrix], which
isolates *every* library in its own thread pool, so they can
guarantee timeouts and other bounded behaviors. Netflix
reports that the overhead of extra threads is worth the
more-predictable behavior.

[Hystrix]: https://github.com/Netflix/Hystrix

-S

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to