Thanks for the reference, I've seen it before and it looks interesting, especially thanks to the failover built-in. It also greatly shows how Clojure can reduce the `Java boilerplate`.
Speaking on the performance note, I am not entirely sure what's causing my REST API to be slower than `Node.js` one, I have two the same auth logic implemented in both Node/Clojure. The Node.js version is running on Heroku (London) with MongoLab hosted in (US-east-1) which can handle login in 140ms. On the other hand, the Clojure Aleph/Compojure hosted in London on DigitalOcean with MongoHQ database hosted in the same DigitalOcean region handles the same thing in 350ms in the best case. This is really weird as the `non-database` request is 40ms faster than Node.js one. I need to investigate, but apart from that, all good so far. On Wednesday, 24 June 2015 20:49:40 UTC+2, Stuart Sierra wrote: > > 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.