java - 使用 java -server 选项

标签 java jvm

Oracle documentation说:

-server

Select the Java HotSpot Server VM. On a 64-bit capable jdk only the Java HotSpot Server VM is supported so the -server option is implicit. This is subject to change in a future release.

For default VM selection, see Server-Class Machine Detection

因为它在 64 位 JDK 中是隐式的,我们不需要在运行命令 java 时添加这个参数,对吗?

更多文档 here说服务器级机器至少有 2 个 CPU 和至少 2GB 的物理内存。这仍然适用/适用于 JDK7u25 吗?

从文档中了解到,如果将 -server 选项与服务器级机器一起使用会提高性能,我想知道是否还有其他具体优势?

最佳答案

Since, it is implicit with 64-bit JDK, we don't need to add this argument while running command java, am I right?

正确。如果您运行的是 64 位 JVM,那么即使用户传递了 -server 选项也没有区别。

Further documentation here says that server-class machine is one with at least 2 CPUs and at least 2GB of physical memory. Is this still true/applies with JDK7u25?

根据您关于 64 位 JVM 的第一个引述,此标准将仅用于 32 位运行时。

As from the documentation it is understood that it improves the performance if -server option is used with server-class machine, I would like to know is there any other specific advantage?

正如您提到的第一句话,-server 启用了 Java HotSpot Server VM。这意味着 JVM 将进行更积极的即时 (JIT) 编译优化。这对于非服务器级机器是禁用的,因为进行优化可能会大大降低程序的速度,但对于现代机器,您通常有备用内核,因此优化 JIT 可能会在您的程序插入时停止在自己的线程中运行.

关于java - 使用 java -server 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17608639/

相关文章:

java - 不再设置时,Eclipse 仍在使用 http.proxyHost 设置

java - 测量代码单元的内存使用情况

java - Java中如何在公共(public)方法中声明私有(private)方法?

java - sqoop 与 hadoop 集成抛出 ClassNotFoundException

java - 在java Rest服务中获取json

java - 内存不足错误 : Java heap space error when start solr

java - 使用 MethodHandles 和 invokedynamic 链接方法调用

java - 读取枚举时出现空指针

java - 如何让 slider 自动移动

java - JVM 如何在内部处理竞争条件?