1. Default heap size varies: it can be 50% of the available memory for any amount of available memory up to 256mb; ~128mb for anywhere between 256 and 512; and then 25% for anything above 512mb;
2. The JVM will still do parallel threads even when CPU limit is 1,000 or below , which triggers CPU throttling much faster. Threads such as GC (even when it is SerialGC), ForkJoin pools, Database connection pools, HTTP server, and so on.
3. The JVM behaves MUCH better with 2,000 or more milicores, and a well sized heap. Having very small containers and dozens of replicas is worse than having slightly bigger containers (cpu/memory limits) and fewer replicas, even with a different ratio (e.g. 6 replicas will perform worse than 3 replicas, even when aggregated CPU and memory limits are the same).
I've been advocating on this for years [1].
But if you've not already looked at it for your usages, I suggest people check out both the parallel collector and ZGC. ZGC in particular has been getting a lot of very nice features. Semi recently getting fast heap freeing (to the OS). The parallel collector for small heaps can generally beat G1 pause times.
Where G1 really shines over the parallel collector is the fact that it regularly collects old gen. If your app has a lot of caches, then G1 is very good at keeping the VM from ending up with very long pauses.
They should make get.java point to the download page. Oh and docs.java would be very cool!
Serial will be your best choice if your app is constantly using 100% of that core or if you need to minimize the amount of memory overhead.
G1 is a better choice if you can be flexible with your memory and if you have a lot of periods in your app where it's below 100% CPU usage (maybe a lot of IO).
I don't think this is true.
Setting your CPU limit to 1 in Kubernetes does not mean the container sees a single logical processor. It only means the kernel allows it to use 1 core worth of CPU _time_.
If your k8s node is an 8 core node, Java will still see 8 logical processors. It just means you can only use 1/8th of each, or all of one, or some combination in-between.
I've never seen a k8s node running on a single core VM, as most of the cloud providers only use these for their free tier or shared core VM's for the lightest of light workloads.
that's incorrect, the jvm has been container aware for nearly a decade (https://bugs.openjdk.org/browse/JDK-8146115)
you are correct about the underlying scheduling. limits don't pin you to a core, you get quotas across all available
I have also seen customers wasting resources across Kubernetes because their developers would eventually tune JVMs with lowercase `-xmx` flag, which the JVM ignores, and thus by default, the JVM only sets heap size to 25% by default (for => 512mb of available memory).
There are other implementations.
edit: looks like you probably mean sth like this: https://openjdk.org/jeps/8359211
One great feature in Go (or Python, or Node JS) is that you don't have to care about setting the -Xmx. The runtime will just use more RAM as needed, and you can use normal mechanisms like cgroups to limit the maximum size.
GC is not memory efficient.
If a primary concern is optimizing memory usage, you will avoid GC languages.
Unless you want AI generated code to be single threaded and not take advantage of multiple cores, some form of collector is still required. If you want to avoid heap fragmentation issues, a compacting collector is generally recommended.
Hobby and domain specific languages may still use GC but getting rid of the concept of GC is the right direction, along with removing different ways of doing things in a programming language. Go was right when it forced developers to use only pattern for loops, one pattern for error handling, etc.
I don't think that making programs a lot more complicated because they have to prove a very specific memory management discipline is the right way to go.
With AI we don't need expressive programming languages for humans to read and understand at line-level details. Instead, we need stronger guardrails and fewer building blocks so that AI generates consistent solutions.
GC became poplar only because it was hard for programmers to keep track of memory management in languages like C and C++. And back then I was a huge proponent of GC based languages.
This is just a step along the same path that Go introduced. Many programmers switching from other languages complain about Go's restrictive and seemingly verbose syntax but once the benefits are realized the tradeoffs become worth it.
The `.zip` gTLD set a really bad precedent.