Reduce payload size sent by agent in remote config#8238
Reduce payload size sent by agent in remote config#8238andrewlock wants to merge 2 commits intoandrew/remote-config/remove-regexfrom
Conversation
Previously, we were always sending the same rootversion, which meant that RCM was always sending us the signatures, which significantly increases the payload size sent to us (~35kB of data) We still pay the cost of this the first time _and_ we now materialize the strings, but we avoid it for all subsequent requests
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33707ed9b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { | ||
| ArrayPool = JsonArrayPool.Shared, | ||
| }; | ||
| var tufRoot = new JsonSerializer().Deserialize<MinimalTufRoot>(jsonReader); |
There was a problem hiding this comment.
Add missing namespace for MinimalTufRoot deserialization
MinimalTufRoot is declared in Datadog.Trace.RemoteConfigurationManagement.Protocol.Tuf, but this file only imports ...Protocol, so this generic call does not resolve and the tracer project fails to compile (CS0246 on dotnet build tracer/src/Datadog.Trace/Datadog.Trace.csproj). Because this blocks all target frameworks from building, the change cannot be shipped as-is.
Useful? React with 👍 / 👎.
Summary of changes
Stop sending the fixed
RootVersion = 1with every remote config requestReason for change
Currently we're sending a fixed value of
RootVersion = 1for all our remote config requests, but doing so causes the agent to repeatedly send us all the root certificates, significantly increasing the payload size, because it thinks we haven't seen them. Sending the "final" version, acknowledges it, and stops all the extra data, saving ~35kB per call.Implementation details
GetRcmResponse, leaving them as base64 encodedstrings (which is how they are sent in the payload)Base64DecodingStreamintroduced in AddBase64DecodingStream#8226 to avoid extra allocationsIArrayPoolfrom Add anIArrayPool<char>implementation for vendored Newtonsoft.JSON #8228MinimalTufRoot(in contrast toTufRoot) so that we only materialize what we need (theroots.signed.versionkey)This implementation avoids ~35kB per call for subsequent remote config requests.
Test coverage
Added unit test, and did manual test with the real agent, to confirm the expected behaviour (reduction in data sent)
Other details
https://datadoghq.atlassian.net/browse/LANGPLAT-940
All part of the Remote Config perf stack