Skip to content

Can't run simple app on heroku due to memory calculator #2

Closed

Description

@jarias

On early versions I was able to run a simple spring boot app on Heroku's free tier suing paketo but now I get:

2020-08-14T20:23:31.670371+00:00 app[web.1]: required memory 819590K is greater than 512M available for allocation: -XX:MaxDirectMemorySize=10M, -Xmx400M, -XX:MaxMetaspaceSize=102790K, -XX:ReservedCodeCacheSize=240M, -Xss1M x 50 threads

Is there a way to disable the memory calculator and pass my own JVM memory settings?

Activity

  1. nebhale commented on Aug 26, 2020

    @nebhale
    Contributor

    You can set any valid JVM memory flag (the ones in the log message are the pertinent ones) and the calculator will take that setting into account when calculating the rest.

    Note though, that your explicit setting of -Xmx400M plus the JVM's default ReservedCodeCache of 240M already exceeds the container size of 512M. You can try to decrease the JVM's default configuration but doing so will result in a drastic performance penalty when the JIT is forced to evict earlier optimizations from the ReservedCodeCache. This also doesn't take into account the 50M for threads (50 threads * 1M stacks) or the ~100M of Metaspace.

    It's important to remember that the memory calculator is designed to ensure that your application will never exceed the size of your container, even when it is fully utilized (full JIT cache, all threads running). Few, if any, JVM-based applications can achieve this in a 512M container without drastically changing the JVM's defaults.

  2. self-assigned this
    on Aug 26, 2020
  3. jarias commented on Aug 29, 2020

    @jarias
    Author

    Thanks for the info, I know the risk of bad memory config, but is good to know I can still controll it at my own risk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions