Comments (1)
This should probably be improved in the docs a bit, but the answer is you start up your application and look 😄.
For loadedClasses
you’re trying to document the number of classes that your application will load into memory at runtime. We’ve done some analysis of existing applications out in the world and worked out that applications generally load fewer than 35% of the classes they have access to. We do an analysis of all of the JARs that will be on an application’s classpath and calculate a value for that, so I don’t think that most people will need to ever change this. If you find that your application is loading vastly more or less than that amount I’d make a change, but given how little effect changing that number has on the metaspace (70M + (5K * loaded classes)) it’s probably a non-issue. In fact, our analysis shows that for a given application, the metaspace is fixed, regardless of the rest of the memory regions, so if you think you don’t have enough (or have too much) metaspace, you should just set it directly via -XX:MaxMetaspaceSize
; you don’t have to worry that changing a container size will lead to unused memory the way you would if you set heap size directly.
stackThreads
is documentation of the maximum number of threads that your application will use at any time. Our 300 value is based on the fact that most applications on Cloud Foundry run Tomcat which is configured to max out at 200 threads by default. Add to that another ~25 for system threads and GC, we then leave 75 threads for things like connection pools, application thread pools, etc. If you’ve configured your container to use fewer threads (or more threads), if you know that you don’t have any connection pools or other application thread pools, then you can safely change this value. I view this, in combination with -Xss
to be the least risky way to make your container memory needs smaller. Given that with default configuration, each thread has 1M of memory space, shrinking the number of threads your application uses by 100 reduces your requirements 100M. Changing your stack size (if you can safely do so) by half you reduce your usage 150M. Given that almost all of the other memory configurations are essentially tinkering around the edges or are very dangerous to change (e.g. -XX:ReservedCodeCache
), this is the best bang for your buck.
Please note that for both of these values, you must run your application to max load to accurately document the values. It’s no good for you to start your application, see Tomcat using 5 threads and update your configuration based on that. The memory calculator must calculate the maximum amount of memory your application could ever use in order to ensure that the container won’t exceed its memory limit and be recycled.
from java-buildpack-memory-calculator.
Related Issues (20)
- Impossible to compute configuration for Boot application and 256M total memory HOT 1
- Getting java.lang.OutOfMemoryError: Java heap space when using Spring kafka to produce a message HOT 1
- Adjust ReservedCodeCacheSize HOT 1
- Getting way too low Xmx numbers with a regular Spring Boot app HOT 1
- Does option "--head-room" represents "native" memory HOT 2
- Heuristics to compute Xms (min heap size) value HOT 3
- Calculation Default Values: ReservedCodeCache is NOT 240MB? HOT 2
- Xms (minimum heap) is missing in new memory caluculator which is causing havoc in our applications.. HOT 3
- Cannot get latest version: module contains a go.mod file, so module path should be github.com/cloudfoundry/java-buildpack-memory-calculator/v4 HOT 6
- Take garbage collector into account HOT 1
- Calculated JVM memory configuration is propably wrong
- Taking into account frameworks like Dynatrace OneAgent HOT 1
- Allow to specify ratio of allocation of available memory between heap and direct memory HOT 6
- Allow to specify ratio of allocation of available memory to young generation in heap HOT 2
- Documentation link in readme is broken HOT 5
- Buildback-memory-calculator HOT 1
- Possibility to override memory instead of detection HOT 1
- Please, provide Windows compiled application HOT 1
- Question: Why is -XX:MaxDirectMemorySize set to 10M by default? HOT 1
- Provide Arm64 Executable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-buildpack-memory-calculator.