Many database APIs already contain async interfaces. Simply use those and use core.async/put! and take! to allow them to operate on core.async channels. You often don't need much more than that.
Timothy On Mon, Jan 5, 2015 at 3:18 PM, Robin Heggelund Hansen <skinney...@gmail.com > wrote: > I guess this post is mostly going to be a question, but one that could > shape up to be a long open source project and contribution on my part, if > it is warranted. > > The Clojure community has been blessed with good language interoperability > with Java, which has made it easy to use and wrap Java-libraries, which > again I suspect is why Clojure is where it is today, a tool for > professional development. > > This has also, to some extent, been a curse, as we've relied on libraries > made for a different language, instead of "creating the world in our > image", so to speak. I assume this is why core.async isn't as integrated in > the Clojure ecosystem as I would like, because we already have libraries > that works, and taking the time to make sure they scale well simply isn't > worth it. > > So I thought I would re-invent the wheel a little, but it depends on my > premise being correct. > > From what I understand, core.async basically creates state machines, that > are run on a threadpool. Once you do something that blocks (like IO), you > are kinda ruining the idea behind core.async, which is efficient > concurrency at a large scale. I also assume, that having more than one > threadpool, isn't really what you want. You want core.async to have the > only threadpool running, and you want to run most things as go-blocks. > > Today, way to many things block, like reading a file or reading from a > database. Things that are async, mostly uses it's own threadpool. If I got > this correctly, a standard web-app today will usually perform a blocking > action for most DB-ops, requests will run in a http-server-specific > threadpool, while agents or go-blocks has their own threadpool again. > > Would I be correct that a clojure web-server, would be more efficient (at > scale) if DB-ops and general request handling, ran entirely as go-blocks on > the core.async threadpool alone? > > I was thinking of creating a async.io library (core.async + NIO for file > and socket ops), and after that perhaps create a socket-pool library before > creating a core.async friendly SQL interface. Is there a point to this, or > would I just be doing a lot of work for very little gain? > > Thanks! > > -- > 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. > -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- 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.