Skip to content

Conversation

patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Aug 27, 2025

In testing, I found that jemalloc used significantly less memory than the default glibc allocator (leaving more space for the kernel disk cache and assuaging fears of runaway memory leaks).

Instead of integrating this natively into the binary, we just set an ENV variable when running!

@patrick-ogrady patrick-ogrady changed the title [deployer] Use jemalloc2 + Remove Pyroscope Until Official Support [deployer] Use jemalloc2 + Remove (Janky) memleak Until official Rust Support Aug 27, 2025
@patrick-ogrady patrick-ogrady requested a review from Copilot August 27, 2025 22:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces memory leak monitoring with jemalloc allocator integration. The change switches from using BCC-based memleak monitoring to using the jemalloc2 allocator, which provides better memory efficiency for the deployed binary service.

Key changes:

  • Integrates jemalloc allocator via LD_PRELOAD in the binary service
  • Removes the complex memleak monitoring agent and associated infrastructure
  • Updates configuration naming from "profiling" to "instrument" for clarity

Reviewed Changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
examples/flood/src/lib.rs Renames profiling field to instrument in Config struct
examples/flood/README.md Updates command line example to use --instrument true instead of --profiling false
deployer/src/ec2/services.rs Adds jemalloc preload to binary service and removes entire memleak agent implementation
deployer/src/ec2/mod.rs Updates documentation to remove memleak references and correct service descriptions
deployer/src/ec2/create.rs Removes memleak agent file creation and deployment steps
deployer/src/ec2/aws.rs Removes memleak port from security group configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@patrick-ogrady patrick-ogrady marked this pull request as ready for review August 27, 2025 23:39
echo "0 * * * * /usr/sbin/logrotate /etc/logrotate.d/binary" | crontab -
# Setup pyroscope agent script and timer
sudo ln -s "$(find /usr/lib/linux-tools/*/perf | head -1)" /usr/local/bin/perf
Copy link
Contributor Author

@patrick-ogrady patrick-ogrady Aug 27, 2025

Choose a reason for hiding this comment

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

This was a subtle break over time (and unrelated to these changes)

@patrick-ogrady patrick-ogrady changed the title [deployer] Use jemalloc2 + Remove (Janky) memleak Until official Rust Support [deployer] Use jemalloc2 + Remove (Janky) memleak Aug 27, 2025
@patrick-ogrady patrick-ogrady merged commit a822a2e into main Aug 27, 2025
37 checks passed
@patrick-ogrady patrick-ogrady deleted the jemalloc-deployer branch August 27, 2025 23:50
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.77%. Comparing base (b8f3430) to head (f5c626b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
deployer/src/ec2/destroy.rs 0.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main    #1489      +/-   ##
==========================================
+ Coverage   91.72%   91.77%   +0.05%     
==========================================
  Files         280      280              
  Lines       70579    70541      -38     
==========================================
+ Hits        64739    64740       +1     
+ Misses       5840     5801      -39     
Files with missing lines Coverage Δ
deployer/src/ec2/aws.rs 0.00% <ø> (ø)
deployer/src/ec2/create.rs 0.00% <ø> (ø)
deployer/src/ec2/mod.rs 0.00% <ø> (ø)
deployer/src/ec2/services.rs 0.00% <ø> (ø)
deployer/src/ec2/destroy.rs 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8f3430...f5c626b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant