-
Notifications
You must be signed in to change notification settings - Fork 97
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
ref(server): Move body compression into EnvelopeManager (INGEST-357) #1085
Conversation
relay-server/src/actors/envelopes.rs
Outdated
let (envelope_body, envelope_meta) = match Self::encode_envelope(envelope, http_encoding) { | ||
Ok(v) => v, | ||
Err(e) => { | ||
return Box::new(future::err(SendEnvelopeError::SendFailed( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not particularly happy about the type of this error cause it's all backwards. i was thinking of making a new variant of SendEnvelopeError (two actually, a BodyEncodingError(std::io::Error) and an EnvelopeBuildError(EnvelopeError)), but then i'd have to carry them into ProcessingError too, and i'm not 100% sure it's worth it? idk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd do exactly that, it's fine to have so many variants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok will do
i ran some preliminary benchmarks and i get 1500 rps? not very cool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after the singular change to error mapping this is good to merge without another review
// Override the `sent_at` timestamp. Since the envelope went through basic | ||
// normalization, all timestamps have been corrected. We propagate the new | ||
// `sent_at` to allow the next Relay to double-check this timestamp and | ||
// potentially apply correction again. This is done as close to sending as | ||
// possible so that we avoid internal delays. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I think we need to live with this. This value will be horribly wrong if there is significant amount of data piling up in the queue but if we need to fix that, I question why double-checking is done at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
y'know this comment is not mine, i'm just copying it along with the rest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right but you were moving the code below this comment from after the upstream actor queue to before it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm tbh i think i don't quite understand what double checking we have
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i ran some preliminary benchmarks and i get 1500 rps? not very cool. i think actually envelopemanager doesn't have a syncarbiter?
this is actually a blocker... discussing how to solve this
benchmarking again against fake-sentry+nginx. 1000 clients over 4 locust workers. relay pinned to 6 cpu cores. just reading the rps gauge, so no flamegraph overhead.
so gzip is spectacularly good here imo but i'm worried about identity. thinking either a small refactor to skip encoding handling for identity or a canary to see if it matters? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving for canary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let' ship
Instructions and example for changelogFor changes exposed to the Python package, please add an entry to For changes to the Relay server, please add an entry to
To the changelog entry, please add a link to this PR (consider a more descriptive message): - Move body compression into EnvelopeManager (INGEST-357). ([#1085](https://github.com/getsentry/relay/pull/1085)) If none of the above apply, you can opt out by adding #skip-changelog to the PR description. |
While researching performance of Relay I discovered that the body compression for upstream requests is run on the system arbiter instead of on a thread pool, and that removing compression increases throughput drastically.
This change moves the workload of compression from UpstreamRelay to EnvelopeProcessor, which runs on a SyncArbiter.