This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-18
Channels
- # ai (1)
- # beginners (71)
- # boot (15)
- # cider (26)
- # clara (4)
- # cljs-dev (81)
- # cljsrn (26)
- # clojure (393)
- # clojure-berlin (2)
- # clojure-dev (5)
- # clojure-dusseldorf (1)
- # clojure-greece (5)
- # clojure-italy (6)
- # clojure-russia (97)
- # clojure-serbia (11)
- # clojure-sg (2)
- # clojure-spec (14)
- # clojure-uk (66)
- # clojurescript (58)
- # core-async (19)
- # cursive (18)
- # data-science (2)
- # datomic (75)
- # emacs (20)
- # events (5)
- # figwheel (1)
- # graphql (2)
- # hoplon (29)
- # jobs-discuss (3)
- # juxt (6)
- # lein-figwheel (1)
- # london-clojurians (2)
- # lumo (29)
- # mount (9)
- # off-topic (4)
- # om (16)
- # onyx (25)
- # other-languages (2)
- # pedestal (38)
- # protorepl (2)
- # re-frame (20)
- # reagent (9)
- # ring-swagger (6)
- # sql (10)
- # unrepl (3)
- # untangled (19)
- # utah-clojurians (1)
- # videos (2)
- # vim (20)
hello everyone, i know jdbc is synchronous, but is anyone aware of somekind of thread pool which can be consumed by an async api? (a dedicated threadpool for database access)
plins: Which DB are you using?
if you’re really worried about the async bit, you can use https://github.com/alaisi/postgres.async with postgres. Don’t know of a good alternative with mysql
you can also work around this by adding some kind of intermediary function that runs the SQL query via a threadpool, which once the query completes puts it onto a core.async channel. However, when I’ve played with things like this in the past, I’ve found it to be way more of a headache then it was actually worth, based off of the performance changes
you’re generally better off spending the time to reduce the number of DB calls you’re making and the performance of those calls, and just let the JVM do it’s stuff with thread switching
obvious depends on your usecase and what’s causing you to want this
i was thinking about heading down the road of thread pool + core.async … im coming from nodejs development and now compojure supports async routes so i was wondering if it was possible/worth to wrap sync jdbc calls on a thread pool with an async interface, maybe using channels
@plins You can create a thread-pool (using Java interop) and submit JDBC jobs to it. Would that work for you?