Skip to content

Customize GC behavior #2

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 3 commits into from
Feb 4, 2016
Merged

Customize GC behavior #2

merged 3 commits into from
Feb 4, 2016

Conversation

pbrisbin
Copy link
Contributor

@pbrisbin pbrisbin commented Feb 3, 2016

Hi @andrewhr, I'm an engineer at Code Climate and was looking into some
out-of-memory errors we see on this engine. I think I've got a fix here by way
of tuning the GC -- let me know what you think.


By default, the JVM does not free allocated heap back to the OS. This
configures away from that behavior, hopefully to prevent OOM engine
errors.

See http://www.stefankrause.net/wp/?p=14 for details on the specific
options chosen. Of all the examples in that post, this one performed the
best and brought my test repository's memory usage down from ~700MB to
~150MB. Its graph also shows most closely the pattern we'd prefer: the
slope of allocated heap closely matching used.

Despite my best efforts at .dockerignore'ing things, adding all of .
would always blow the layer cache. This change ensures that only changes
to the source files themselves will trigger compilation.
By default, the JVM does not free allocated heap back to the OS. This
configures away from that behavior, hopefully to prevent OOM engine
errors.

See http://www.stefankrause.net/wp/?p=14 for details on the specific
options chosen. Of all the examples in that post, this one performed the
best and brought my test repository's memory usage down from ~700MB to
~150MB. Its graph also shows most closely the pattern we'd prefer: the
slope of allocated heap closely matching used.
andrewhr added a commit that referenced this pull request Feb 4, 2016
@andrewhr andrewhr merged commit 6743e4d into andrewhr:master Feb 4, 2016
@andrewhr
Copy link
Owner

andrewhr commented Feb 4, 2016

Thanks @pbrisbin, very nice tunning!

@pbrisbin
Copy link
Contributor Author

pbrisbin commented Feb 5, 2016

Just a heads up: I noticed a deprecation warning for this configuration after the fact. I'm inclined to keep using it anyway because it did give the best performance. If/when they fully remove the support for it, we'll likely have to use G1GC, which was less of an improvement (but still an improvement).

@andrewhr
Copy link
Owner

andrewhr commented Feb 8, 2016

👍

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