Limiting java application's memory and cpu usage

后端 未结 8 696
南笙
南笙 2020-12-18 21:45

Say, \"run myApp.jar with cpu=800 and memory=1024\"

Ive been doing java programming for many years and it is an embarrasment to ask this question. I don\'t even know

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-18 22:39

    The JVM has no control over CPU usage nor priority.

    JVM has control over max/min Memory usage.

    There is a workaround. It is possible to run each JVM in a separate [Docker container][1]. And control the resource (Memory, CPU, Network, IO) allocation for each container. That is exactly the added value of the Docker containers.

    [1]: The JVM has no control over CPU usage nor priority. Yet you can run each JVM in a separate Docker container. And control the resource allocation foreach container. That is exactly the added value of the Docker containers.

提交回复
热议问题