Does the server option still exist? [duplicate] - openjdk-11

The help menu for java command says that -server option is to select the "server" VM. It also states that 'server' is the default option. Why so redundant?
edit:
If it is of any help, "java -version" yields:
java version "1.8.0_191"
Java(TM) SE Runtime Environment (buil 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

-client and -server are ignored on modern JVMs, as easy as that. There are two JITcompilers C1 and C2, but there are 5 tiers, all the details in the entire glory are here in the comments.
These flags used to control how C1 and C2 would act - disable or not; this is now controlled by two other flags : XX:-TieredCompilation -XX:TieredStopAtLevel=1

I don't know your java version, IMHO, in java8 or older versions, for different platforms(different architecture and OS, or even different cup cores and memory), there are different default JVM(server or client).
This picture is taken from https://docs.oracle.com/javase/8/docs/technotes/guides/vm/server-class.html, we can see the situation for java6.
(Note: For Java SE 6, the definition of a server-class machine is one with at least 2 CPUs and at least 2GB of physical memory. )
Update:
I can only confirm that these options are also provided by java8(1.8.0_121). Not sure for java9 or later.

The -server mode might be default in most JVM versions but there are exceptions. As per Where do I get the server and client systems? docs:
Client and server systems are both downloaded with the 32-bit Solaris and Linux downloads. For 32-bit Windows, if you download the JRE, you get only the client, you'll need to download the SDK to get both systems.
For 64-bit, only the server system is included. On Solaris, the 64-bit JRE is an overlay on top of the 32-bit distribution. However, on Linux and Windows, it's a completely separate distribution.
At the end of the day you can use -client to switch back to client mode and sacrifice JIT optimization for faster startup time.

Related

OpenJDK 64-Bit Server VM warning: forcing TieredStopAtLevel to full optimization because JVMCI is enabled

I'm using Spring Boot and I've just upgraded from OpenJDK 8 to GraalVM GraalVM CE 20.1.0 (OpenJDK 20.0.7) so that I can use the Polyglot features.
I get this worrying message:
OpenJDK 64-Bit Server VM warning: forcing TieredStopAtLevel to full optimization because JVMCI is enabled
Can someone please explain to me what it means or point me to a resource where I can read more about it? Is it of concern?
It's a warning, so it's not critical. At most you'll have the top tier optimizing compiler enabled which might manifest in a bit longer startup/warmup times.
When you run your application something (maybe it's the docker image configuration, maybe you pass it manually) passes it the TieredStopAtLevel option.
Most probably something like -XX:TieredStopAtLevel=1.
This option will tell the JVM not to use more advanced tiers of JIT compilation:
level 0 - interpreter
level 1 - C1 with full optimization (no profiling)
level 2 - C1 with invocation and backedge counters
level 3 - C1 with full profiling (level 2 + MDO)
level 4 - C2
where C1 and C2 are JIT compilers included in OpenJDK.
Now on GraalVM, the top tier JIT (level 4) is replaced with the GraalVM compiler, which is plugged into JVM using JVMCI - the JVM compiler interface, specifically created for plugging it other JIT compilers.
When you run GraalVM's java it by default enables JVMCI to be able to use the GraalVM JIT compiler.
This doesn't make a lot of sense if you stop at tier 1, because you won't reach JVMCI which is also enabled. But I think it's a bug, which if you can reproduce, can you please submit to https://github.com/oracle/graal.
I tried with JDK8 based GraalVM 20.1.0 CE (because you mention OpenJDK 8):
❯ java -XX:TieredStopAtLevel=1 -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 25.252-b09-jvmci-20.1-b02, mixed mode)
And it doesn't print the warning, maybe it's the OS or some other factor in play.
While you run application for IDEA,Run configuration have a button is "Enable lanunch optimization" .If you enable it,maybe print this warning.

Is it possible to start a Java Runtime Image with prunsrv using jvm mode?

Background: Since Java 9 it is possible to create custom runtime images (JRE+program) using jlink.
It is possible to install Java programs as Windows service using prunsrv.exe (part of Apache Commons Daemon).
prunsrv can be used in three start modes: java, jvm and exe.
I managed to start a custom runtime image using the exe mode and a traditional Java program (classpath + normal JDK) using jvm mode, but I was not able to use the jvm mode (which doesn't start a new process) with the image.
prunsrv has a "JvmOptions9" parameter, which could be a hint that this scenario may be supported, but I am not sure.
I had the same issue at first, but managed to solve it. While this is an old issue it was the first I found when I searched, so I will provide my answer for others.
I could install the service without problems, but when I tried to start it in jvm mode it would fail and complain that "%1 is not a valid Win32 application". The keyword here is Win32.
There are two versions of the prunsrv executable: one in the installation directory and one in the amd64 subdirectory. The version in the installation directory only supports 32 bit, while the one in amd64 is for 64 bit code. The prunsrv and the Java version must both be 32 bit or 64 bit; I was trying to start a 64 bit Java VM from a 32 bit prunsrv service.
In other words, make sure that the correct version of prunsrv for the intended Java VM is used. With that I can run a modular Java 9 (or actually 12) application with a stripped down runtime image without problems.

What do I need to do to install and run Code Sourcery on an x86 64-bit Windows host system?

I have seen this question asked for a Linux host system but not for Windows.
I have a Windows 7 64-bit host system. I am running into a 32 bit issue I think and I see this vague phrase in the Code Sourcery documentation.
"Therefore, even when running on a 64-bit host system, Sourcery CodeBench requires 32-bit host libraries. Consult your operating system documentation for more information about obtaining these libraries."
I can't find any documentation because I don't know what "these" libraries are.
Thanks,
Seth M King
That sentence is really only for Linux users; a lot of Linux distributions don't include the basic system libraries (the equivalent of the stuff in c:\Windows\System) needed to run 32-bit applications.
Windows includes everything that's needed as far as this is concerned.

Why is H2 1.1.117 performance inferior on Mac OS X?

When running the same query (SELECT with a couple of INNER JOINs) on a table with 400k rows, it takes almost 30 times longer on Mac OS X, than on Linux or Windows 7. Granted, the hardware configurations are different, but not different enough to warrant such a big difference. I was able to reproduce the performance issue on several computers running Mac OS X 10.6. The weird thing is, that I got the expected performance once after killing H2 in the middle of the long query execution, and letting H2 repair the database on next startup. However, I wasn't able to consistently reproduce this.
What I noticed on Mac OS X was that a couple of seconds after submitting the query, both CPU and disk usage falls to almost zero, and only goes back up right before returning the query results.
The test computers had the following versions of Java installed:
Mac OS X: Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
Linux: Java(TM) SE Runtime Environment (build 1.6.0_20-b02), Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode))
Windows: Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
All computers were running H2 1.1.117. While I know that this version is quite old, I would prefer to stick with it for now, but I need to sort out this apparently platform-specific performance issue. I have googled around for bug reports, but haven't found anything related.
It's very unlikely this is related to the operating system.
If both CPU and disk usage are zero, I suggest to get a full thread dump (jps -l, and then jstack -l <pid>) to find out what the process is doing.
Did you run ANALYZE? On newer versions of H2 (1.3.x) this is no longer required by the way.
If this isn't the problem, I suggest to have a look at the Database Performance Tuning documentation. I know, a lot of it is generic, but it might still help. If this still doesn't solve the problem, please see Application Profiling and update the question with the results you found.

What is run time environment?

Can some one explain what it means in simple terms. Does it mean the environment (DOS, Windows, Linux, etc) where the application codes are run?
Distinguish this from Development Environments and Build Environments.
You will tend to find a hierarchy here.
Run time environment - Everything you need to execute a program, but no tools to change it.
Build environment- Given some code written by someone, everything you need to compile it or otherwise prepare an executable that you put into a Run time environment. Build environments are pretty useless unless you can see tests what you have built, so they often include Run too. In Build you can't actually modify the code.
Development environment - Everything you need to write code, build it and test it. Code Editors and other such tools. Typically also includes Build and Run.
Yes, including all the settings (like environment variables), common libraries(!), directory structure, network neighbors e.t.c
The runtime environment can also be a virtual machine, such as the JRE (Java Runtime Environment) or CLR (Common Language Runtime) for .NET framework.
What is the target of your program? Does the program run on top of the JRE, CLR? Or are you compiling into a binary file that is run by your operating system?
The main question is what is that target of your program. How will your program be executed?
As soon as a software program is executed, it is in a run-time state. In this state, the program can send instructions to the computer's processor and access the computer's memory (RAM) and other system resources.
RTE allows the program to be run in an environment where the programmer can track the instructions being processed by the program and debug any errors that may arise.
While developers use RTE software to build programs, RTE programs are available to everyday computer users as well,e.g software such as Adobe Flash Player
Source
To add to the other answers given, I would say that Runtime environment is an environment, which supports the execution of a program/process. A program, for being able to execute, requires runtime environment. Runtime environment provides following services to the program/process :-
Resident Memory
Resources such as File, Sockets, etc.
Environment variables
Proper initialization
Proper disposal.
In short, Runtime environment is for the program, what physical environment is to us. Program/process can't sustain without runtime environment.
I am working on compilers and the Runtime environment means ,it is the structure of the target computers registers and memory that serves to manage memory and maintain information needed to guide the execution process.
infact, almost all programming languages use one of three kinds of runtime environment,whose essential structure does not depend on the specific details of the target machine.
These three kind of runtime environmenta are
fully static environment( example FORTRAN77)
stack-based environment(C,C++)
Fully dynamic environment(LISP)
It refers to the collection of software and hardware resources that enable a software program to be executed on a computer system. The runtime system is a composite mechanism designed to provide program execution services, regardless of the programming language being used
Simple and Generic definition
Let's not make it so complicated, in context of software engineering a runtime environment is simply an environment that a piece of software needs to run.
For example you might have Googled PC Requirements for GTA-V and you found the following answer:
Minimum System Requirements:
OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1
Processor: Intel Core 2 Quad CPU Q6600 # 2.40GHz (4 CPUs) / AMD Phenom 9850 Quad-Core Processor (4 CPUs) # 2.5GHz
Memory: 4GB
Video Card: NVIDIA 9800 GT 1GB / AMD HD 4870 1GB (DX 10, 10.1, 11)
Sound Card: 100% DirectX 10 compatible
HDD Space: 65GB
What are these? These are the environment variables which you need to run GTA-V, another way to say the same thing is:
This is runtime environment for GTA-V.
Take example of Node.js, when you say Node.js is JavaScript runtime environment you simply mean that Node.js provides everything (from software perspective) to run JavaScriptic code on the hardware (Mobiles, Laptops, etc). That everything includes interfaces to the Operating Systems of that particular hardwares.
Note: Both of the below statements are correct:
Node.js is JavaScript runtime environment (RTE).
Node.js and OS on which Node.js is installed makes Runtime Environment for JavaScript.
Technical definition
Runtime environment, primarily implements portions of an execution model.
The execution model specifies the behavior of elements of the language. By applying the execution model, one can derive the behavior of a program that was written in terms of that programming language.
Ok I know that console.log("Hi") shows me hi on the console, but how this behaviour of that particular string (console.log) is achieved?
Some or all the underlying steps which were taken between the execution of code and logging of the output constitue runtime environment.

Resources