3 ms·
There's nothing to figure out. If you want to use all your ram (like in go) just set -Xmx<all_your_ram>.
by vips7L 6y ago
There's nothing to figure out. If you want to use all your ram (like in go) just set -Xmx<all_your_ram>.
- simtel20 6y agoIf you haven't done -Xmx=<all memory> before, you may not be aware that you're giving a bum steer here.
- thayne 6y agoThat is a terrible idea. The JVM basically never returns RAM to the OS, and in my experience, if you run a java process long enough, the max heap size ends up being the used heap size.
- vips7L 6y agoG1 the default allocator returns heap to the os only when you set -G1PeriodicGCInterval and both ZGC and Shenandoah do it automatically.
- bobbyi_settv 6y agoBut to know whether you want that, you need to understand the application. Elasticsearch, for example, recommends using at most 50% of physical memory for heap: https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html https://www.elastic.co/guide/en/elasticsearch/reference/curr... You also often want to stay below 32 gb to get compressed OOPs
- tbrock 6y agoWhy isn’t that the default? Unless I say otherwise, use it. Imagine launching every app and having to say ok you get 300mb but not more!
- rahilb 6y agoIt’s the default because Java has a history, and it was set when everyone was deploying war files to machines with 512mb total memory and the default worked for 95% of people for the past 25 years. In fact, it’s still good enough for the chocolate factory that has brainwashed you into drinking the static binary milkshake. Of course there are ways to use all the available ram when you deploy your kubernetes pods, you just have to consult the documentation. Honestly this criticism is ridiculous I can’t believe I even bothered to reply.