DBILITY

linux tomcat heap size 본문

was

linux tomcat heap size

DBILITY 2021. 8. 31. 12:17
반응형

독거 가능성 100% 노후에 라면값이라도 하게 광고 한번씩 클릭하시오!

Please click on the ad so that I can pay for ramen in my old age!
老後にラーメン代だけでもするように広告を一回クリックしてください。
点击一下广告,让老后吃个泡面钱吧!

 

linux에서 운영 중인 tomcat의 heap memory size를 확인해야 했다.

[root@portal opt]# ps -ef | grep tomcat
instanc+  2555     1 99 12:11 pts/0    00:01:32 /usr/lib/jvm/java-1.8.0-openjdk/bin/java -Djava.util.logging.config.file=/opt/instance01/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Xms512m -Xmx4096m -XX:PermSize=128m -XX:MaxPermSize=256m -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/instance01 -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/instance01/temp org.apache.catalina.startup.Bootstrap start
root      2617  1793  0 12:12 pts/0    00:00:00 grep --color=auto tomcat
[root@portal opt]# ps -aux | grep tomcat
instanc+  2555  106 34.0 8119736 2022224 pts/0 Sl   12:11   1:32 /usr/lib/jvm/java-1.8.0-openjdk/bin/java -Djava.util.logging.config.file=/opt/instance01/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Xms512m -Xmx4096m -XX:PermSize=128m -XX:MaxPermSize=256m -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/instance01 -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/instance01/temp org.apache.catalina.startup.Bootstrap start
root      2619  0.0  0.0 112808   968 pts/0    S+   12:12   0:00 grep --color=auto tomcat
[root@portal opt]# jps -v
3537 Jps -Denv.class.path=:/usr/lib/jvm/java-1.8.0-openjdk/lib -Dapplication.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64 -Xms8m
2555 Bootstrap -Djava.util.logging.config.file=/opt/instance01/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Xms512m -Xmx4096m -XX:PermSize=128m -XX:MaxPermSize=256m -Djava.endorsed.dirs=/opt/tomcat/endorsed -Dcatalina.base=/opt/instance01 -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/instance01/temp

위와 같이 ps 또는 jps를 통해 pid를 확인하고,

jmap을 통해 확인할 수 있다.


[root@portal opt]# jmap -heap 2555
Attaching to process ID 2555, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.282-b08

using thread-local object allocation.
Parallel GC with 9 thread(s)

Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 4294967296 (4096.0MB)
   NewSize                  = 178782208 (170.5MB)
   MaxNewSize               = 1431306240 (1365.0MB)
   OldSize                  = 358088704 (341.5MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 1205862400 (1150.0MB)
   used     = 247446024 (235.98291778564453MB)
   free     = 958416376 (914.0170822143555MB)
   20.520253720490828% used
From Space:
   capacity = 112721920 (107.5MB)
   used     = 63251576 (60.32140350341797MB)
   free     = 49470344 (47.17859649658203MB)
   56.1129334915516% used
To Space:
   capacity = 112721920 (107.5MB)
   used     = 0 (0.0MB)
   free     = 112721920 (107.5MB)
   0.0% used
PS Old Generation
   capacity = 569901056 (543.5MB)
   used     = 244943104 (233.595947265625MB)
   free     = 324957952 (309.904052734375MB)
   42.97993509947102% used

32612 interned Strings occupying 3445352 bytes.
[root@portal opt]#

시작 시 CATALINA_OPTS에 max heap을 다음과 같이 4G로 줬던 것을 확인할 수 있다.

export CATALINA_OPTS="$CATALINA_OPTS -Xms512m -Xmx4096m -XX:PermSize=128m -XX:MaxPermSize=256m"

개발 시 intellij에서 tomcat서버를 실행하는데 이건 왜 4G나 할당되었을까? 기본인가?

반응형
Comments