Skip to content

Commit

Permalink
Remove pause/resume on session level buffer
Browse files Browse the repository at this point in the history
Summary:
We currently pause all producers if the sum of the egress buffers of all transactions exceeds the write buffer limit.  This turns out to be deterimental to prioritization.

Now, we pass the underlying transport pause state or connection flow control state back to the handlers.  The previous diff in this stack introduces a per-stream buffer limit (64kb default).  To limit total session buffer size, limit the number of concurrent streams or lower the per-stream limit.

Reviewed By: lnicco

Differential Revision: D17097138

fbshipit-source-id: 9025c5be8b318963311c3aaad9ee9a03c0e2265e
  • Loading branch information
afrind authored and facebook-github-bot committed Oct 28, 2019
1 parent a2708d3 commit 8b81314
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions quic/api/QuicSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ class QuicSocket {
virtual void
setSendBuffer(StreamId id, size_t maxUnacked, size_t maxUnsent) = 0;

/**
* Return the amount of transport buffer space available for writing
*/
virtual uint64_t getConnectionBufferAvailable() const = 0;

/**
* Get the flow control settings for the given stream (or connection flow
* control by passing id=0). Settings include send and receive window
Expand Down
6 changes: 5 additions & 1 deletion quic/api/QuicTransportBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,11 @@ void QuicTransportBase::setSendBuffer(
size_t /*maxUnacked*/,
size_t /*maxUnsent*/) {}

uint64_t QuicTransportBase::bufferSpaceAvailable() {
uint64_t QuicTransportBase::getConnectionBufferAvailable() const {
return bufferSpaceAvailable();
}

uint64_t QuicTransportBase::bufferSpaceAvailable() const {
auto bytesBuffered = conn_->flowControlState.sumCurStreamBufferLen;
auto totalBufferSpaceAvailable =
conn_->transportSettings.totalBufferSpaceAvailable;
Expand Down
4 changes: 3 additions & 1 deletion quic/api/QuicTransportBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ class QuicTransportBase : public QuicSocket {

void setSendBuffer(StreamId id, size_t maxUnacked, size_t maxUnsent) override;

uint64_t bufferSpaceAvailable();
uint64_t getConnectionBufferAvailable() const override;

uint64_t bufferSpaceAvailable() const;

folly::Expected<QuicSocket::FlowControlState, LocalErrorCode>
getConnectionFlowControl() const override;
Expand Down
1 change: 1 addition & 0 deletions quic/api/test/MockQuicSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class MockQuicSocket : public QuicSocket {
MOCK_CONST_METHOD0(getAppProtocol, folly::Optional<std::string>());
MOCK_METHOD2(setReceiveWindow, void(StreamId, size_t));
MOCK_METHOD3(setSendBuffer, void(StreamId, size_t, size_t));
MOCK_CONST_METHOD0(getConnectionBufferAvailable, uint64_t());
MOCK_CONST_METHOD0(
getConnectionFlowControl,
folly::Expected<FlowControlState, LocalErrorCode>());
Expand Down

0 comments on commit 8b81314

Please sign in to comment.