I want to check the backends' healthy condition, I use the ThreadPool start a Thread to check backend per10s. In this times, this will query mysql 6 times per 10s and not use the database connection pool. When I deploy this app in the cloud platform, I received message that the usage of memory is continued growth.
At first, I use the top
command to watch the usage of Java Heap.
In this picture, I find this app use about 3.2GB memory.
And then I exec the jmap -heap 9
,but i find the heap usage of memory is only 1053MB.
I guess the reason of this is the number of thread. I exec the pstree -p | grep java | wc -l
. I find only 70 threads.
Finally, I exec the jcmd 9 VM.native_memory scale=MB
. I see the Heap usage of memory is 4096MB. This confused me.
enter image description here
I want to decrease the usage of memory in this app. But I don't know how to solve it.