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?
@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
it may be possible for us to make that a bounded queue, and have send!
block when it is full
@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 🙂
So I would definitely recommend doing something about that. Is this concerning Immutant or Undertow?
this would be in Immutant itself - would you mind filing an issue at https://issues.jboss.org/projects/IMMUTANT?
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
@tcrawley Sure! Looking at the existing issues, https://issues.jboss.org/browse/IMMUTANT-562 seems related
Or did you refer to something else there?
ah, yes, indeed. that is related
feel free to comment there
:thumbsup: Will do
thanks!
OK, I hope I managed to express myself well enough, it's already a bit late over here 🙂
(in the comment I just added to that ticket, that is)
cool, thanks!
You're welcome! And thanks for Immutant 🙂
aw, shucks. you're welcome!