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
Set Java heap size lower than default #5
Conversation
Cool, thanks for the contribution @jkutner ! I'll have to mull this over a little bit because the down side to this is that you are forcing all launches of the app (via this script) to have those constrained memory settings. Ideally this is something that should come from the environment somehow so that it's configurable. In the case of Heroku specifically, we have a separate repository for the Heroku Button just to make things a little faster and to make it easy to pin to our production releases. I'm not as familiar with Heroku as @tlrobinson , but is there no way to set environment variables when launching dynos? Is it possible to include env settings in the one-click deploy recipes? I think that ideally we'd have a default setting which uses nice tidy memory settings like are proposed here, but it should be easy to modify those settings if someone wants to upgrade to a larger dyno and has more resources available. |
What you want makes perfect sense, and is easy to do -- i just didn't want to intrude to much. The first option is to replace the null-buildpack with the https://github.com/heroku/heroku-buildpack-jvm-common as the buildpack for the button. This will setup intelligent defaults for your app, and install JDK 8 (instead of using JDK 7, which is the default on the cedar stack image). The only problem is that even with the intelligent defaults, I've see this app go over 512mb on a few of my tests (because So you could just set JAVA_OPTS dynamically in your
But I maintain the JVM buildpack, and I've recently decided to scale down the default 384mb for heap on the 1X, because I do see a lot of apps going over. So maybe give the https://github.com/heroku/heroku-buildpack-jvm-common in After the black friday season, I will probably bring this down some more, and your app should be fine then. Let me know if any of this needs clarification. |
After a little experimentation with heap values on 512MB Heroku dynos (free), I settled on 250MB. |
I've updated this PR so that it sets the heap size to 256m, but only for Free, Hobby and 1X dynos that have 512mb of RAM. @agilliland it definitely seems that the experience is a little rough without this. And it seems fine with it. If the user scales the app up, the |
Hello, I'm getting the R14 error on Heroku as well and I was wondering if this PR will fix it (once / if it's merged with master)? @wvengen @agilliland
Using Hobby Basic (the $9/mo tier) for database and one free dyno. |
@ArtursO yes, I would expect this PR to fix that problem. But you can also override the heap settings yourself by running:
(Where |
@jkutner looks like I'm still getting the R14 memory error :(
|
@ArtursO a Hobby dyno has exactly the same resources (memory) as a free dyno. The only difference is that it doesn't go to sleep when not in use. You may need to step up to Standard-2X, which has more RAM. At some point, with real usage, 512mb will probably not be enough for Metabase. |
Hey @jkutner - Thanks so much for this PR and for persisting. We've been a bit overwhelmed and a lot of PRs have slipped through the cracks. The ulimit finger prints for the different dynos was new to me. |
@jkutner thanks for letting me know and your help. Really appreciate it :)! |
Set Java heap size lower than default
NwLKNgf+M7NsCbMXBY+rhEtFjCWmXahuDX1wHHWiqZOB6rP3IT+ccNgMOX9y4NQm ZHR3AgxKB+OVed0t2kZmNq/cPiqt1yexcND0QgfEBVIYqRzJ0Jbro6s7t3nr9pyG NJ6TYNM7rJz83llFNJQQ29IemQRo2SOfXCPw1nmZbbJVSpYTTVM/FU830U2QNneu nYnKcOdMu8Vepy4laVgKrSg/ZmQbXq6OVjAf3zSb/8KdhKHeznOLrl+UquBAKk0a yuf9H8hd2QnMwnCoMuGt55ZO2DnzCNc1rl/IRUDEc59PbJ6I/YVYJcKCnMbjfDGZ /T13NFhiOITfxFq/f36P+ub8rshzgA== =Z8+g -----END PGP SIGNATURE----- Merge pull request #5 from jkutner/master Set Java heap size lower than default
The addition of the JAVA_OPTS in this PR will prevent R14 and R10 errors I've seen. The default JVM heap size is too high for Heroku's 512mb RAM on a free dyno. But the app seems to work fine with this heap setting.
Also, I gave the source project a try:
And it worked on the first attempt. So I'm curious why the Heroku Button uses this repo instead? Is just because it's faster?
Thanks!