Depends on #36
Feature description
ACK frames serve as both: a method to ensure reliable delivery (just in case the remote client shuts down), and a way of basic flow control.
The way it is currently implemented can be improved to allow greater performance.
Is your feature request related to a problem? Please describe.
In the current state of the system, a (*dmsg.Transport).Write() operation awaits to receive an ACK frame from the remote Client. This is both time consuming and resource-intensive (as we have to use ioutil.AckWaiter to align sequences of both ends of the transport).
Describe the solution you'd like
dmsg.Transport should have fields that keep track of the local and remote window sizes (the buffer size left in bytes).
REQUEST and ACCEPT frames should contain window sizes. And each edge keeps track of the remote edge's window size and stops sending when it is maxed out (when this happens, the Write operation should block).
Write operations no longer needs to wait for an ACK frame from remote.
ACK frames are sent on every Read operation and contain the number of bytes read. The remote then increases the tracked window size by that amount.
Describe alternatives you've considered
We can also make the dmsg.Server be responsible for sending the ACK frames after the FWD is forwarded. However, this doesn't give us the ability to do flow control, and it is not as performant as the aforementioned solution.
Possible implementation
Feature description
ACKframes serve as both: a method to ensure reliable delivery (just in case the remote client shuts down), and a way of basic flow control.The way it is currently implemented can be improved to allow greater performance.
Is your feature request related to a problem? Please describe.
In the current state of the system, a
(*dmsg.Transport).Write()operation awaits to receive anACKframe from the remoteClient. This is both time consuming and resource-intensive (as we have to useioutil.AckWaiterto align sequences of both ends of the transport).Describe the solution you'd like
dmsg.Transportshould have fields that keep track of the local and remote window sizes (the buffer size left in bytes).REQUESTandACCEPTframes should contain window sizes. And each edge keeps track of the remote edge's window size and stops sending when it is maxed out (when this happens, theWriteoperation should block).Writeoperations no longer needs to wait for anACKframe from remote.ACKframes are sent on everyReadoperation and contain the number of bytes read. The remote then increases the tracked window size by that amount.Describe alternatives you've considered
We can also make the
dmsg.Serverbe responsible for sending theACKframes after theFWDis forwarded. However, this doesn't give us the ability to do flow control, and it is not as performant as the aforementioned solution.Possible implementation
dmsg.TransportREQUESTandACCEPTframes.ACKafterWrite()operation.ACKafter everyRead()operation, which includes number of bytes read.ACKframes, that adds to remaining window size.Writeoperation should block until remote window size frees up.