Spring Boot memory consumption increases beyond -Xmx option

后端 未结 1 1772
刺人心
刺人心 2021-01-02 17:28

I noticed Spring Boot application does not obey the amount of memory set via Xmx option. For example: java -Xss64m -Xmx64m -jar test.jar

I also printed on console th

相关标签:
1条回答
  • 2021-01-02 17:54

    After monitoring the Spring Boot application, I found out some possible reasons such as:

    1. Number of http threads (Undertow starts around 50 threads per default, but you can increase / decrease via property the amount of threads needed)
    2. Access to native routines (.dll, .so) via JNI
    3. Static variables
    4. Use of cache (memcache, ehcache, etc)
    5. If a VM is 32 bit or 64 bit, 64 bit uses more memory to run the same application, so if you don't need a heap bigger than 1.5GB, so keep your application runnnig over 32 bit to save memory.
    0 讨论(0)
提交回复
热议问题