Discussion:
Throttle/Aleph Websocket
Nathan B
2016-12-31 17:51:58 UTC
Permalink
If I apply s/throttle to the websocket stream on an Aleph server, where is
the backpressure actually accumulated? Throttle would block further puts!
that exceed the rate, but then where do these pending websocket messages
accumulate in the stack? Is it a Netty buffer that would then determine how
many accumulate before they get dropped?

Maybe simpler question is whether there is an easy way to make a pipeline
that drops any excess messages that would be held up by the throttling?
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Zach Tellman
2017-01-03 07:11:57 UTC
Permalink
Hi Nathan,

First of all, by default no messages will get dropped. When using
`throttle`, you'd expect some messages to accumulate upstream (how many
depends on a lot of different configurations, but somewhere between tens
and hundreds), and then TCP backpressure to kick in, which will cause
messages to accumulate on the client until they are accepted by the server.


This is almost always the behavior that you want, and Manifold does not
expose any "dropping buffer" behavior a la core.async. However, this is
pretty easy to implement yourself via a `try-put!` with a 0ms timeout,
which can simply be put in a `consume` callback somewhere upstream of the
`throttle`.

Hope this helps,
Zach
Post by Nathan B
If I apply s/throttle to the websocket stream on an Aleph server, where is
the backpressure actually accumulated? Throttle would block further puts!
that exceed the rate, but then where do these pending websocket messages
accumulate in the stack? Is it a Netty buffer that would then determine how
many accumulate before they get dropped?
Maybe simpler question is whether there is an easy way to make a pipeline
that drops any excess messages that would be held up by the throttling?
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nathan B
2017-01-03 13:46:13 UTC
Permalink
Thanks for clarifying where it backs up the pipe. I think that should be
fine to have it push back to the client side and likely slow down the send
on their end.
Post by Zach Tellman
Hi Nathan,
First of all, by default no messages will get dropped. When using
`throttle`, you'd expect some messages to accumulate upstream (how many
depends on a lot of different configurations, but somewhere between tens
and hundreds), and then TCP backpressure to kick in, which will cause
messages to accumulate on the client until they are accepted by the server.
This is almost always the behavior that you want, and Manifold does not
expose any "dropping buffer" behavior a la core.async. However, this is
pretty easy to implement yourself via a `try-put!` with a 0ms timeout,
which can simply be put in a `consume` callback somewhere upstream of the
`throttle`.
Hope this helps,
Zach
Post by Nathan B
If I apply s/throttle to the websocket stream on an Aleph server, where
is the backpressure actually accumulated? Throttle would block further
puts! that exceed the rate, but then where do these pending websocket
messages accumulate in the stack? Is it a Netty buffer that would then
determine how many accumulate before they get dropped?
Maybe simpler question is whether there is an easy way to make a pipeline
that drops any excess messages that would be held up by the throttling?
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...