This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-03
Channels
- # aws (1)
- # beginners (5)
- # boot (46)
- # cider (6)
- # cljs-dev (421)
- # cljsrn (74)
- # clojure (77)
- # clojure-greece (1)
- # clojure-italy (7)
- # clojure-russia (12)
- # clojure-serbia (42)
- # clojure-sg (1)
- # clojure-spec (10)
- # clojure-uk (38)
- # clojurescript (40)
- # core-async (14)
- # data-science (1)
- # datomic (18)
- # emacs (2)
- # events (1)
- # garden (4)
- # gorilla (4)
- # graphql (5)
- # hoplon (69)
- # luminus (1)
- # lumo (1)
- # off-topic (31)
- # om (31)
- # om-next (2)
- # overtone (3)
- # pedestal (1)
- # precept (4)
- # re-frame (23)
- # reagent (2)
- # remote-jobs (1)
- # ring-swagger (23)
- # rum (7)
- # spacemacs (7)
- # sql (4)
- # unrepl (9)
- # untangled (5)
- # vim (11)
- # yada (5)
(def ch (async/chan 10))
(go (async/>! ch data))
I've been trying to figure out: how many of these non-blocking calls you can make before things start to clog up/blow up? What happens, and what is a good way to get to the answer myself, should I be looking at the state machine that is the expanded go
macro?you have 1024 pending puts per unbuffered channel, no matter the number of go blocks & co, if buffered add the buffer size to that, otherwise if sliding/dropping etc, it doesn't really matter. It's quite easy to test
(put! ch x) and (go (async/>! ch x)) are equivalent with regards to pending tasks number
@mpenet Thanks!
Is there any way to get a count of how many of the 1024 we've used up (and possibly what those pending messages are)? I'm debugging a production server, I created a /health
endpoint which basically does a sub
, and a (go (async/>! ch :test-message))
and after about 30-45min this stops working.
@mpenet got it, figured out how to print the put queue size: (.size (.puts ch))
. Thanks for your help again. And wish me luck debugging, this is someone else's code. Yikes.
1) that go block is better written as (put! ch :test-message)
2) make sure all the topics have consumers, and check that the messages have the topics you think they do
(that is, all the topics generated by the pub
that you sub
to)
Right, if you ever hit the limit of 1024 pending puts on a channel, chances are really high that you have a bug in your code. The limit is artificial and is designed to provide quicker feedback in the case of an unbounded queue.
@noisesmith I guess (hope) the go example is a slimmed down example
in my experience, core.async code that uses go blocks for a single channel put is common - but of course if they are doing more than that it won’t translate to put! and the suggestion is moot