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

feat: Relayer heap profiling #4180

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

feat: Relayer heap profiling #4180

wants to merge 5 commits into from

Conversation

daniel-savu
Copy link
Contributor

@daniel-savu daniel-savu commented Jul 23, 2024

Description

During the scalability audit we've identified relayer memory usage as a cause of concern. This PR runs the profiler each time e2e is run and outputs a report called dhat-heap.json in the current dir. That file can be visualised with a dhat viewer, such as the one hosted by the author here.

It adds a conditionally compiled heap memory profiler (dhat-rs), which is only included when both the memory-profiling feature is enabled and the memory-profiling cargo profile is used.

The report can order the profiling results by total lifetime allocated bytes, peak allocated bytes, total allocation count, etc. Below is the result of sorting by total lifetime allocated bytes, which reveals that the biggest memory hogs are the hook indexing channel senders (one per origin chain), taking up 100+ MB. Its size can most likely be reduced from 1M to 1k.

Screenshot 2024-07-23 at 14 32 21

Drive-by changes

Adds the remaining IDs in the channel as a field to the hook indexing log, to know if it's safe to lower the channel size.

Related issues

Backward compatibility

Yes, since everything is conditionally compiled / isolated in a new cargo profile.

Testing

Manual

Copy link

changeset-bot bot commented Jul 23, 2024

⚠️ No Changeset found

Latest commit: 471cce4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (944b2f6) to head (471cce4).
Report is 9 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #4180   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          1       1           
  Lines         14      14           
=====================================
  Misses        14      14           
Components Coverage Δ
core ∅ <ø> (∅)
hooks ∅ <ø> (∅)
isms ∅ <ø> (∅)
token ∅ <ø> (∅)
middlewares ∅ <ø> (∅)

Copy link
Collaborator

@tkporter tkporter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 🔥

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

Successfully merging this pull request may close these issues.

None yet

2 participants