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

⚡️[RUM-3570] Batch the records for 16ms minimum before processing them #2807

Merged
merged 3 commits into from
Jun 14, 2024

Conversation

amortemousque
Copy link
Collaborator

Motivation

When recording for Session Replay, MutationRecord objects are batched together (see mutationBatch), then deduplicated on processing (ex: here).

When the same mutation happens continuously on the same element, for example with JS-driven animations, a lot of MutationRecords can be notified by the browser in a very short amount of time, which can significantly inflate the data sent to Datadog, and have a performance impact both on the recorder side and on the player side (see below). Those mutations could be deduplicated if they were batched together.

Changes

Batch the records for 16ms minimum before processing them

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@amortemousque amortemousque requested a review from a team as a code owner June 12, 2024 08:27
@amortemousque amortemousque force-pushed the aymeric/mutation-batch-minimum-duration branch from d48922f to 4fb6387 Compare June 12, 2024 08:28
@codecov-commenter
Copy link

codecov-commenter commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.65%. Comparing base (b839f8c) to head (28d38d9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2807   +/-   ##
=======================================
  Coverage   93.65%   93.65%           
=======================================
  Files         243      243           
  Lines        7140     7143    +3     
  Branches     1599     1599           
=======================================
+ Hits         6687     6690    +3     
  Misses        453      453           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cit-pr-commenter bot commented Jun 12, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 159.49 KiB 159.55 KiB 62 B +0.04%
Logs 58.02 KiB 58.02 KiB 0 B 0.00%
Rum Slim 108.07 KiB 108.07 KiB 0 B 0.00%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.002 0.002 -0.000
addaction 0.050 0.042 -0.007
adderror 0.052 0.034 -0.017
addtiming 0.001 0.001 -0.001
startview 1.427 0.999 -0.428
startstopsessionreplayrecording 1.077 0.825 -0.252
logmessage 0.007 0.019 0.012
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 19.58 KiB 18.83 KiB -766 B
addaction 68.97 KiB 68.36 KiB -632 B
adderror 83.18 KiB 85.19 KiB 2.00 KiB
addtiming 17.24 KiB 17.05 KiB -193 B
startview 313.58 KiB 317.81 KiB 4.22 KiB
startstopsessionreplayrecording 11.51 KiB 12.38 KiB 890 B
logmessage 64.11 KiB 67.06 KiB 2.95 KiB

@amortemousque amortemousque merged commit bafeb7a into main Jun 14, 2024
20 checks passed
@amortemousque amortemousque deleted the aymeric/mutation-batch-minimum-duration branch June 14, 2024 07:45
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.

4 participants