Docker service Limits and Reservations

前端 未结 1 1939
半阙折子戏
半阙折子戏 2021-02-19 04:52

Docker v1.12 service comes with four flags for setting the resource limits on a service.

--limit-cpu value Limit CPUs (default 0.000)

--limit-memory v

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-19 05:27

    Reserve holds those resources on the host so they are always available for the container. Think dedicated resources.

    Limit prevents the binary inside the container from using more than that. Think of controlling runaway processes in container.

    Based on my limited testing with stress, --limit-cpu is percent of a core, though if there are multiple threads, it'll spread those out across core's and seems to attempt to keep the total near what you'd expect.

    In the below pic, from left to right, was --limit-cpu 4, then 2.5, then 2, then 1. All of those tests had stress set to CPU of 4 (worker threads).

    0 讨论(0)
提交回复
热议问题