Fork me on GitHub
#core-async
<
2016-05-17
>
hlship16:05:54

So here’s an open topic for discussion: how do you decide on the size of channel buffers? It’s kind of implicit that you want things to balance so that producers can just keep ahead of consumers but will also slow down with back-pressure if they get too far ahead. The buffer size of the channel seems to be the way to tune that … but that feels like black magic to get the numbers “right”, and core.async doesn’t have a lot of hooks for monitoring, to help with making these determinations.

hlship16:05:31

Also, there’s the vast difference between development environment and production.

hlship16:05:24

Is it cave man numbers? (0, 1, many)?

hiredman16:05:50

I think it would be pretty straightforward to wrap your choice of buffer with a logging implementation, to get some idea of what is happening https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/protocols.clj#L31-L35

hiredman16:05:23

I have gone through and updated a bunch of go blocks to write information to an atom before doing channel operations, and then compared channel read and writes, but that was more for debugging deadlocks

hiredman16:05:43

pipeline might be a good place to look, it makes the buffer size equal to the number of consumers, maybe that is a good rule of thumb

hiredman16:05:43

my understanding of queueing theory is limited, it does seem to be exactly for modeling these things