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

test(replays): jemalloc and serde struct deserialization #1817

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG DOCKER_ARCH=amd64
### Deps stage ###
##################

FROM getsentry/sentry-cli:1 AS sentry-cli
FROM getsentry/sentry-cli:2 AS sentry-cli
FROM $DOCKER_ARCH/centos:7 AS relay-deps

ARG DOCKER_ARCH
Expand Down Expand Up @@ -47,6 +47,7 @@ FROM relay-deps AS relay-builder

ARG RELAY_FEATURES=ssl,processing,crash-handler
ENV RELAY_FEATURES=${RELAY_FEATURES}
ENV JEMALLOC_SYS_WITH_MALLOC_CONF=background_thread:true,abort_conf:true

COPY . .

Expand Down
10 changes: 4 additions & 6 deletions relay-replays/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ license-file = "../LICENSE"
publish = false

[dependencies]
flate2 = "1.0.19"
once_cell = "1.13.1"
rand = "0.8.5"
rand_pcg = "0.3.1"
relay-common = { path = "../relay-common" }
relay-filter = { path = "../relay-filter" }
relay-general = { path = "../relay-general" }
relay-log = { path = "../relay-log" }
serde = { version = "1.0.114", features = ["derive"] }
serde_json = "1.0.55"
serde-transcode = "1.1.1"
relay-filter = { path = "../relay-filter" }
rand = "0.8.5"
rand_pcg = "0.3.1"
unicase = "2.6.0"
flate2 = "1.0.19"

[dev-dependencies]
criterion = "0.4"
Expand Down
28 changes: 3 additions & 25 deletions relay-replays/benches/benchmarks.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
use std::io::Read;

use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use flate2::{bufread::ZlibEncoder, Compression};

use relay_general::pii::DataScrubbingConfig;
use relay_replays::recording::ReplayScrubber;
use relay_replays::recording::_deserialize_event;

fn bench_recording(c: &mut Criterion) {
let payload = include_bytes!("../tests/fixtures/rrweb.json");

// Compress the payload to mimic real-world behavior. The replay processor can also handle
// uncompressed payloads, but those happen infrequently.
let mut compressed = Vec::new();
let mut encoder = ZlibEncoder::new(payload.as_slice(), Compression::default());
encoder.read_to_end(&mut compressed).unwrap();

let mut scrubbing_config = DataScrubbingConfig::default();
scrubbing_config.scrub_data = true;
scrubbing_config.scrub_defaults = true;
scrubbing_config.scrub_ip_addresses = true;
let pii_config = scrubbing_config.pii_config_uncached().unwrap().unwrap();

let mut scrubber = ReplayScrubber::new(usize::MAX, Some(&pii_config), None);

c.bench_with_input(BenchmarkId::new("rrweb", 1), &compressed, |b, &_| {
b.iter(|| {
let mut buf = Vec::new();
scrubber.transcode_replay(&compressed, &mut buf).ok();
buf
});
c.bench_with_input(BenchmarkId::new("rrweb", 1), &payload, |b, &_| {
b.iter(|| _deserialize_event(payload));
});
}

Expand Down
1 change: 0 additions & 1 deletion relay-replays/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod recording;
mod transform;
Loading