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

Add a UTF-8 statistics handler #2225

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

verdie-g
Copy link

@verdie-g verdie-g commented May 29, 2024

The statistics payload can be quite large (several MB) and currently it can be copied twice in the managed code:

  1. The payload is received from the C driver
  2. A .NET string is allocated for the JSON
  3. The statistics handler is called
  4. The subscriber will likely call System.Text.Json.Serialize.Deserialize which cause the string to be converted back to UTF-8

This round-trip causes important memory fragmentation which puts pressure on the GC. In .NET 6, this can be avoided using Span.

Copy link

cla-assistant bot commented May 29, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

cla-assistant bot commented May 29, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant