AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Jvm vs java compiler11/4/2023 ![]() Especially popular in this respect are pre-installed JVMs on various Linux distributions, even though I have to admit that things have become better over the years. How do we know which Java installation and which JVM type is used when we call java? With more than one Java installation on a system there is always a slight risk of running the wrong JVM without noticing it. A common gotcha: On 32-bit systems, a HotSpot JDK is required to be able to run the server VM at all – the 32-bit JRE only ships with the client VM. My recommendation is to choose the server VM by setting the -server flag whenever performance in the sense of shorter execution time is important for an application. Even though the server VM was originally targeted at long-running server processes, nowadays it often shows superior performance than the client VM in many standalone applications as well. If we are not happy with the pre-selected JVM, we can use the flags -server and -client to prescribe the usage of the server and client VM, respectively. From the criteria table, we also see that the client VM is only available on 32-bit systems. Thanks to a concept called “JVM ergonomics”, the type of JVM is chosen automatically at JVM startup time based on certain criteria regarding the available hardware and operating system. The client VM is more conservative, resulting in shorter startup time and lower memory footprint. The server VM uses a larger default size for the heap, a parallel garbage collector, and optimizes code more aggressively at run time. There are two types of the HotSpot JVM, namely “server” and “client”. We will focus on the Sun/Oracle HotSpot JVM as of Java 6, though in most cases similar flags exist for the other popular JVMs. The goal of this blog series is to highlight the most relevant flags for everyday use and explain what they are good for. Some JVMs provide several hundreds of these flags, and it is easy to get lost without proper knowledge in this area. ![]() Of particular interest are the command line flags that can be passed to the JVM at startup. Incidentally, aside from all the magic that happens under the hood, a wide range of manual tuning knobs is one of the strengths of modern JVMs as well. ![]() In case of errors or low performance, it must be possible for experts to intervene. At run time, the JVM optimizes the way it handles the application or parts of it, based on continuous measurements and profiling.Įven with such a level of automation (or rather, because of so much automation, as one might argue), it is important that the JVM still provides adequate facilities for external monitoring and manual tuning. Adaptive memory management, garbage collection, just-in-time compilation, dynamic classloading, lock optimization – just to cite some of the magic that happens between the scenes but rarely affects the average programmer directly. Modern JVMs do an amazing job at running Java applications (and those of other compatible languages) in an efficient and stable manner. ![]()
0 Comments
Read More
Leave a Reply. |