-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rfc42: add credit based flow control for channels #427
Conversation
just so i don't forget later, gotta add a "forwarding flag" for credits here
|
in my prototyping I've determined there's two "styles" of using credits
This will necessitate sending a flag to the remote subprocess to tell it to send/not-send the initial credits. Any opinions on how to add this to the exec request. A) new flag that specifies subprocess flags (could also add NO_SETPGRP, FORK_EXEC, etc. flags in there) My anal retentiveness likes to keep this stuff separate and wants to do 'A'. But that is more bytes in the payload. |
It seems like the server should always send credits to the client and the client should wait until it gets that response to send any data. What I was on about earlier was that the server should be able to send that response immediately rather than wait for the local reactor loop to tell it the initial value, since the initial value should already be known to the server. It would be worrisome to have the client make any assumptions about the size of the server's buffer IMHO. |
So for a remote subprocess I did have to add a flag for the server to tell its local subprocess not to send the "initial credits", since the server can handle that themselves.
We could certainly leave this off until a time it becomes necessary. Atleast w/ my |
Maybe we should establish a minimum buffer size of 4K or so and say that if a subprocess client wants to ignore credits (not register the callback) they can behave as before, but if they send more than 4K of data, it will not be reliable? I hate to make every client register a credit callback. |
They way I initially implemented things, a client does require credits to call |
the rune to allow me to push to this branch probably isn't setup, but this is so tiny, perhaps just easiest to manually add this to PR?
|
Oh so that's how you got the sdexec tests to pass :-) This seems reasonable though there may need to be some text added to say what happens with and without this flag. I'll play with it. |
Playing devils advocate: is there a reason not to keep it simple and always send the |
bb7d880
to
c267181
Compare
OK, I added the flag renaming it to I also got rid of the read direction language since we are not there yet. Finally, I reworded some of the text concerning credits in the |
It's a lot of processing and extra traffic that serves no purpose. I could argue why not do that with the output too? If the caller doesn't want the stdout just drop it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this LGTM given flux-framework/flux-core#6353 work. Not approving at the moment, we probably want to hold off merging until we review that PR a little bit more.
This allows us to reject an sdexec request with this flag for now, which is appropriate while it's unsupported. That seems like a good enough reason to me for :-) If that weren't the case I'd probably argue that you ignore these messages at your peril, unless you're not using stdin or you know you are writing less than the buffer size, in which case it won't be very many messages wasted. |
Problem: rfc42 does not specify anything about channel flow control, so it is difficult to design clients and servers that operate without dropping data. Add credit based flow control to the protocol in the write direction. The client receives credit for writes to the subprocess via the exec add-credit response.
Problem: clients cannot send data to a remote subprocess before receiving the first exec add-credit response unless they know how big the remote buffer is. State that the minimum default buffer size is 4096 bytes. The default may be greater, but an eager client that doesn't know the remote buffer size should know it can safely send that much data initially without receiving credit.
c267181
to
ffca60e
Compare
Just pushed the following changes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Only thing is do we want to say buffer size shall be >= 4096 in the general sense (i.e. input & output). Or we can deal with that tweak when we begin to implement the stdout/output side of this.
Thanks! I vote we cross that bridge when we come to it. Setting MWP. |
Problem: rfc42 does not specify anything about channel flow control, so it is difficult to design clients and servers that operate without dropping data.
Add credit based flow control to the protocol.
The client receives credit for writes to the subprocess via the exec add-credit response.
The server receives credit for output to the client via the add-credit RPC.