On Tue, Nov 23, 2021 at 3:59 PM Ian Denhardt <i...@zenhack.net> wrote:

> What are apps *supposed* to do here? It isn't clear to me where else the
> backpressure is supposed to come from?
>

Apps should cap the number of write()s they have in-flight at once. (`->
stream` helps a lot with this, as it'll automatically figure out how many
is a good number of requests to have in flight.)

Most apps are using sandstorm-http-bridge anyway, so they're just acting
> like normal http servers -- which generally write out data to the
> response stream as fast as the socket will take it. Skimming
> sendRequest() in the bridge's source, it looks like it just copies that
> data directly into the response stream. So I am confused as to what a
> "well written" app would do?
>

sandstorm-http-bridge currently only does one outstanding write RPC at a
time. The code is convoluted but look at pumpWrites() -- it waits for each
send() to complete before performing the next one.

Historically there was a time where it didn't implement such a limit and
would just pump the whole response as fast as it got it, which led to the
need to do some enforcement on the supervisor side.

-Kenton

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CAJouXQ%3D9PVexazqg30yqh9Umb83Z5Vnb7%2Bu8A2q%2BDyZiPX68WQ%40mail.gmail.com.

Reply via email to