Re: Understanding hard CPU limits
The current logic looks a little bit too complicated. Wouldn't it be simpler if it was not using CPU shares in calculation and just using memory share (container memory / cell memory) for this? In that case we could just specify CPU FACTOR which is easy to understand.
# Maximum CPU time is proportional to Memory share # In this example scaling factor is 2 CPU_MAX_FACTOR = 2 CELL_CPU = 8 CELL_MEMORY = 16 * 1024^3 # 16 GiB CONTAINER_MEMORY = 4 * 1024^3 # 4 GiB PERIOD = 100000 # 100 ms (default) QUOTA_RATIO = ( CONTAINER_MEMORY / CELL_MEMORY ) * CELL_CPU * CPU_MAX_FACTOR = 1/4 * 8 * 2 = 4 # i.e. 4 CPUs time at max QUOTA = QUOTA_RATIO * PERIOD = 400000 # in ms
PERIOD could also be made configurable so that we could adjust this to our latency requirements if needed.