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

Allow ODataUtf8JsonWriter buffer size to be configurable by the user. #3100

Open
habbes opened this issue Oct 25, 2024 · 0 comments
Open

Allow ODataUtf8JsonWriter buffer size to be configurable by the user. #3100

habbes opened this issue Oct 25, 2024 · 0 comments
Assignees
Labels

Comments

@habbes
Copy link
Contributor

habbes commented Oct 25, 2024

A customer wants to be able to configure the buffer size of ODataUtf8JsonWriter, e.g. increase the buffer size to reduce how frequent stream I/O is invoked. While ODataUtf8JsonWriter accepts a buffer size as a constructor parameter, this parameter is not exposed on the IJsonWriterFactory interface or any of the built-in implementations of that interface. ODataMessageWriter has a BufferSize property, but that's only used when using the "older" JsonWriter.

There are some existing design issues that make this feature request less straightforward:

  • Changing the signature of IJsonWriterFactory methods would be breaking
  • We could add a buffer size parameter to the default implementation without a breaking change, but there would now be two places where a BufferSize option is exposed, which could be confusing to users: ODataMessageWriter.BufferSize setting, and the proposed default JSON writer ffactory buffer size option (e.g. Constructor parameter)
  • The default buffer size in ODataMessageWriter.BufferSize is different (and higher) than the default buffer size in ODataUtf8JsonWriter. Changing the default buffer size to a higher could have visible side-effects on customers who are already aware of the ODataUtf8JsonWriter's buffer size and prefer its smaller memory footprint.

If the issue #3099 is addressed, a workaround would be for the user to wrap the output stream behind a custom stream implementation that intercepts writes and users a buffer size the user desires, then pass that stream to ODataMessageWriter.

Assemblies affected

Microsoft.OData.Core 7.x and 8.x

Reproduce steps

N/A

Expected result

There's no way for the user to configure the ODataUtf8JsonWriter buffer size

Actual result

There should be a way to control the buffer size of ODataUtf8JsonWriter

@marabooy marabooy self-assigned this Oct 29, 2024
@habbes habbes added the P3 label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants