Skip to content
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

Support Scatter Gather Buffers on the client to copy data directly to application provided buffers #4747

Open
srsubra opened this issue Jan 17, 2025 · 2 comments
Assignees
Labels
Area: API feature request A request for new functionality Partner: SQL By or For the SQL team
Milestone

Comments

@srsubra
Copy link

srsubra commented Jan 17, 2025

Describe the feature you'd like supported

Currently, MsQuic with XDP provides the application level callbacks using internal buffers. This requires a mem copy from the MsQuic Internal buffers to the target application buffer. For large blob, allocating this memory and performing a memory copy

Proposed solution

Provide an option where the user can specify the Target buffer address where the data needs to be copied to and MsQuic core layer can automatically copy the data to the target buffer.

Additional context

No response

@srsubra srsubra added the feature request A request for new functionality label Jan 17, 2025
@nibanks nibanks added this to the Future milestone Jan 17, 2025
@nibanks nibanks added Area: API Partner: SQL By or For the SQL team labels Jan 17, 2025
@guhetier guhetier self-assigned this Jan 17, 2025
@guhetier
Copy link

Hi!

Here is how we see how the implementation would look like:

  • Probably a new flag "QUIC_STREAM_OPEN_FLAG_USE_EXTERNAL_RECEIVE_BUFFERS" to opt-in the feature, when opening the stream
  • A new API function along the lines of "StreamProvideReceiveBuffers(stream, nb_buff, QUIC_BUFFERS* buff)"
    • The user can call this on an open stream to provide a list of buffers
    • The user would call it before starting the stream and may call it again later (on a receive callback, etc...) if it needs to provide more buffers

MsQuic would write the received data in the buffers in the order they are provided. A buffer would never be internally allocated or re-used: if MsQuic runs out of provided buffer space for receiving data, the stream would be failed.

The user would need to ensure the buffer remain valid until:

  • either the stream is closed, and no more data can be received
  • or a "receive" notification indicates all the bytes of the buffer
    • the user needs to keep track of the total number of bytes to know this
    • a "receive" notification could indicate only part of a buffer, multiple buffers, etc... depending on how the data is received

Does it sound like this would work for you?

@nibanks
Copy link
Member

nibanks commented Jan 18, 2025

Probably a new flag "QUIC_STREAM_OPEN_FLAG_USE_EXTERNAL_RECEIVE_BUFFERS" to opt-in the feature, when opening the stream

I'm not convinced we need this for a couple reasons:

  1. This doesn't work for peer started streams. You never open them locally.
  2. I think it's enough to say calling StreamProvideReceiveBuffers opts into the feature. You don't need two signals for the same thing.

So, I'm leaning towards only the new API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: API feature request A request for new functionality Partner: SQL By or For the SQL team
Projects
None yet
Development

No branches or pull requests

3 participants