Skip to content

Reduce memory consumption under heavy usage. #50

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

Merged
merged 1 commit into from
Dec 15, 2020

Conversation

conormcd
Copy link
Member

If we are reporting many similar exceptions we will call circleci.rollcage.core/build-trace many times for exceptions with
identical or very similar stack traces. By memoizing circleci.rollcage.core/rollbar-frame we can avoid some expensive
re-work on the most common stack frames and thereby reduce the memory consumption (and I/O profile) of this library.

Rough testing suggests that this change can yield a >20x reduction in memory consumption when many similar exceptions are thrown.

If we are reporting many similar exceptions we will call
`circleci.rollcage.core/build-trace` many times for exceptions with
identical or very similar stack traces. By memoizing
`circleci.rollcage.core/rollbar-frame` we can avoid some expensive
re-work on the most common stack frames and thereby reduce the memory
consumption (and I/O profile) of this library.

Rough testing suggests that this change can yield a >20x reduction in
memory consumption when many similar exceptions are thrown.
@codecov
Copy link

codecov bot commented Dec 15, 2020

Codecov Report

Merging #50 (e14deb3) into master (dc0df39) will decrease coverage by 4.73%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
- Coverage   96.94%   92.20%   -4.74%     
==========================================
  Files           4        4              
  Lines         229      231       +2     
  Branches        4        5       +1     
==========================================
- Hits          222      213       -9     
- Misses          3       13      +10     
- Partials        4        5       +1     
Impacted Files Coverage Δ
src/circleci/rollcage/core.clj 91.41% <100.00%> (-5.53%) ⬇️

Continue to review full report at Codecov.

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

@conormcd
Copy link
Member Author

I'm also open to implementing this as some sort of extension/hook to prevent us from having to bring in an additional dependency.

@marcomorain marcomorain merged commit ee9a216 into circleci:master Dec 15, 2020
@conormcd conormcd deleted the reduce-memory-consumption branch December 15, 2020 14:44
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.

2 participants