Fine grained control of parallelism is a superb aspect of core.async.

Cassandra is a distributed database, often a query requires you 
resolve-on-read denormalised data partitioned multiple ways (semantically, 
by time, etc). You can think of it like a grid I guess.

Lets say I have a query that I want to execute against Cassandra that 
covers a week of data, where the data is partitioned chronologically by the 
hour, and by modulo 24 to spread data around the cluster, that's going to 
require 4032 queries. Judicious use of core.async/pipeline-async allows me 
to execute those queries in parallel with granular control of the 
chronological / modulo parallelism independent of one another, meaning I 
can play with that parallelism in the REPL by just adjusting a couple of 
numbers and reviewing the results. Twiddling knobs, measuring output.

That allows me to execute those 4032 queries in parallel, sub-second, with 
non-blocking requiring none of the overhead of thread-per-request.

My services are Netty end-to-end (server and driver interface to Cassandra) 
so there are always a fixed number of threads. If I wanted to tune the 
buffers or thread-pool sizes I could probably get an even higher degree of 
throughput / lower-latency on each monolithic cassandra query, the 
constraints are known, quantifiable, and easily configurable.

On Sunday, September 18, 2016 at 6:37:38 PM UTC+12, Matan Safriel wrote:
>
> Hi,
>
> It's very easy to see how core.async solves callback hell for front-end 
> development with clojurescript.
> In what use cases would you use it for server-side? we already have 
> non-blocking IO from Java, and we have clojure agents. So what's a bunch of 
> salient use cases?
> Are there prominent clojure http server implementations which rely on it 
> for transcending the threaded web service paradigm?
>
> Thanks,
> Matan
>
>

-- 
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