Use -Xms and -Xms flags for machine resources?

I know that -Xmsthe JVM process flag should allow the JVM process to use a certain amount of memory to initialize its process. As regards the performance of a Java application, it is often recommended to set the same values ​​both for -Xmsand -Xmxwhen the application starts, for example -Xms2048M -Xmx2048M.

I am wondering if the flags mean -Xmsand -Xmxthat the JVM process makes a reservation for a certain amount of memory to prevent other processes from using it on the same computer.

Is it correct?

+4
source share
3 answers

Xmx . Xms () , .

, .

Windows (Xmx), overcommit (Xms). swap + . ( ), RAM.

Linux , vm.overcommit_memory sysctls , mmap syscall, JVM. a) Xms ram + swap b) Xmx RAM.

+3

JVM ?

, JVM , Xms, upto Xmx, , . JVM .


Xms Xmx?

. Xms Xmx , ( ). , .

:

JVM , Xms. - . JVM . , JVM , . gc .

:

, , . , . , , .

GC::

. gcs, - , . , gc. , , .

- , , , ?

0

: , .

Linux.

-Xms -Xmx JVM. VIRTUAL MEMORY, , .

JVM , -Xms . ( ), . JVM , , . , Xms , , , . -Xmx.

, , Linux . , , , , , , . , . - ( , ) , Linux.

Also note that these flags only affect heap sizes. The resident memory size you will see will be larger than the current JVM heap size. More specifically, the memory consumed by the JVM is equal to its HEAP SIZE plus DIRECT MEMORY, which reflects things coming from method stacks, native buffer allocations, etc.

0
source

Source: https://habr.com/ru/post/1674398/


All Articles