i have a centos server with 32 g RAM
and the state of it, is (free -m):
total used free shared buffers cached
Mem: 32071 31488 583 0 244 19329
-/+ buffers/cache: 11914 20157
Swap: 17399 287 17112
the cached size is growth
(between every restart app and clear cache)
after 5 hours that i post my question the memory status is :
total used free shared buffers cached
Mem: 32071 31850 221 0 194 20124
-/+ buffers/cache: 11530 20541
Swap: 17399 299 17100
my java options is :
-Xms12g -Xmx12g -XX:MaxNewSize=6g -XX:NewSize=6g -XX:+UseParallelOldGC -XX:+UseParallelGC -XX:+UseTLAB -XX:MaxTenuringThreshold=15 -XX:+DisableExplicitGC
as you see, cache size is too high and in the high load time on my server, the swap is used and the server is too slow (Unlike https://www.linuxatemyram.com/ , the memory is full and swap is used and my app is too slow)
i used java for service.
what can i do?
Best Answer
Reasons by which a Java application in a server can be slowed are only limited by our imagination (and sometimes by Providence). Memory greedy processes are part of them, the memory exhaustion they cause implies swapping and the interaction with disk kills the performance.
However, in this case, the memory usage does not show symptoms of swapping (see comment of @Sven). It is more plaussible an explication based on the behaviour of the application.
Java applications are very sensitive (among other things) to memory configuration. Programmers are very happy in Java (and in almost all of modern languages) because they do not have to call free functions to avoid memory leaks, as that is done by the Garbage Collector. However, the Garbage Collector can freeze the application when it enters. There are various types of garbage collections. The ones acting on the new zone are less invasive, those in the old zone are worse and full gc are the worst.
In general (and of course in this case) it would be necessary to study the memory evolution in order to optimize its configuration. Anyway, we can see some points upon which to reflect:
Anyway, the use of other resources (threads, pools, connections, etc.) should not be dismissed.