[ 
https://issues.apache.org/jira/browse/FLINK-29465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17610891#comment-17610891
 ] 

Xin Hao commented on FLINK-29465:
---------------------------------

We currently set the pod resources request and limit the same base on the 
resource definition.

For example, if we add resource definition in the FlinkDeployment CR
{code:java}
taskManager:    
    resource:      
        memory: 2048m      
        cpu: 0.5 {code}
The TM's pod definition will be
{code:java}
resources:
    limits:
        cpu: 500m
        memory: 2Gi
    requests:
        cpu: 500m
        memory: 2Gi {code}
According to the Flink KubernetesConfigOptions docs. (For example TM)
{code:java}
TASK_MANAGER_MEMORY_LIMIT_FACTOR = 
ConfigOptions.key("kubernetes.taskmanager.memory.limit-factor").doubleType().defaultValue(1.0).withDescription("The
 limit factor of memory used by task manager. The resources limit memory will 
be set to memory * limit-factor."); {code}
With the limit factor, we can do this
{code:java}
taskManager: 
    resource: 
        memory: 512m
        memoryLimitFactor: 4 
        cpu: 0.1
        cpuLimitFactor: 2{code}
so that TM's pod spec should be
{code:java}
resources:
     limits:
         cpu: 100m
         memory: 512Mi
     requests:
         cpu: 200m
         memory: 2Gi{code}

> Supports limit factor in the resource definition
> ------------------------------------------------
>
>                 Key: FLINK-29465
>                 URL: https://issues.apache.org/jira/browse/FLINK-29465
>             Project: Flink
>          Issue Type: Improvement
>          Components: Kubernetes Operator
>            Reporter: Xin Hao
>            Priority: Minor
>
> Can we add limit factor supports in the resource definition?
> {code:java}
> public class Resource {
>     /** Amount of CPU allocated to the pod. */
>     private Double cpu;
>     private double cpuLimitFactor = 1.0;
>     /** Amount of memory allocated to the pod. Example: 1024m, 1g */
>     private String memory;
>     private double memoryLimitFactor = 1.0;
>     ...
> } {code}
> We can set the defaults as `1.0`, and update them to K8s config options
> {code:java}
> JOB_MANAGER_CPU_LIMIT_FACTOR
> JOB_MANAGER_MEMORY_LIMIT_FACTOR
> TASK_MANAGER_CPU_LIMIT_FACTOR
> TASK_MANAGER_MEMORY_LIMIT_FACTOR {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to