Fork me on GitHub
#immutant
<
2017-02-14
>
dergutemoritz20:02:38

Hey everyone, I have a question about immutant.web.async: It seems to me that there is no provision of flow control, so I'm a little worried that my application's memory usage will blow up indefinitely if it sends data at a higher rate than the receiver is able to keep up with. In other words: With send! being asynchronous, is there an unbounded transmission queue hiding in the innards of Immutant or rather Undertow somewhere?

tcrawley21:02:20

@dergutemoritz: the actual writes are limited by the number of threads in a thread pool - each send gets enqueued, then popped and handled by a loop in a worker thread. If writing the data blocks, that worker will block. However, the queue that worker is reading from is unbounded, so you could exhaust memory if you enqueue (call send) faster than it is written

tcrawley21:02:08

it may be possible for us to make that a bounded queue, and have send! block when it is full

dergutemoritz21:02:16

@tcrawley Thanks, that confirms my suspicion. Yeah, I think it's never a good idea to place unbounded queues in such places, cf. core.async's insistence on not allowing that 🙂

dergutemoritz21:02:43

So I would definitely recommend doing something about that. Is this concerning Immutant or Undertow?

tcrawley21:02:41

this would be in Immutant itself - would you mind filing an issue at https://issues.jboss.org/projects/IMMUTANT?

tcrawley21:02:29

it's been a long time since I wrote/looked at that code, so I may be reading it wrong. It seems like it would be relatively straightforward to confirm it is indeed a problem

dergutemoritz21:02:52

@tcrawley Sure! Looking at the existing issues, https://issues.jboss.org/browse/IMMUTANT-562 seems related

dergutemoritz21:02:08

Or did you refer to something else there?

tcrawley21:02:29

ah, yes, indeed. that is related

tcrawley21:02:42

feel free to comment there

dergutemoritz21:02:01

:thumbsup: Will do

dergutemoritz21:02:51

OK, I hope I managed to express myself well enough, it's already a bit late over here 🙂

dergutemoritz21:02:07

(in the comment I just added to that ticket, that is)

tcrawley21:02:28

cool, thanks!

dergutemoritz21:02:00

You're welcome! And thanks for Immutant 🙂

tcrawley21:02:20

aw, shucks. you're welcome!