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

Yangze Guo commented on FLINK-15959:
------------------------------------

Hi, [~liuyufei]. I have basic some ideas from the perspective of SlotManager to 
share. Hope these could help you.

>From the perspective of SlotManager, the min/max limitation is mainly related 
>to the "slots" and "pendingSlots" of SlotManager. Thus, I want to first 
>summarize the scenarios in which we maintain these two collections:
 *Regarding the "slots"*:
 * The number of elements will be reduced when TaskExecutor closed because of 
heartbeat timeout, idle timeout, etc.
 * The number of elements will be increased only in the registration of new 
TaskExecutor.

*Regarding the "pendingSlots"*:
 * The number of elements will be reduced only in the registration of new 
TaskExecutor.
 * The number of elements will be increased only in the resource allocation.

The union of these two collections defines the total resource/slots the 
SlotManager expect, especially after the FLINK-14106. So, both minimum/maximum 
limitations should act on the total number of slots of both existing and 
pending.
 *Regarding the min limit*, the sum of the two collections would reduce only 
when TaskExecutor closed. We need the check the min limit and decide should we 
allocate new resources in that scenario.
 *Regarding the max limit*,
 * We need to check the max limit before we allocate resource in 
SlotManager#registerSlot
 * When TaskExecutor closed, we also need to check if there is pending 
SlotReuqest which not assign to a slot or pending slot. If there is, we need to 
allocate resources while respecting the max limit.

> Add min/max number of slots configuration to limit total number of slots
> ------------------------------------------------------------------------
>
>                 Key: FLINK-15959
>                 URL: https://issues.apache.org/jira/browse/FLINK-15959
>             Project: Flink
>          Issue Type: Improvement
>          Components: Runtime / Coordination
>    Affects Versions: 1.11.0
>            Reporter: YufeiLiu
>            Priority: Major
>
> Flink removed `-n` option after FLIP-6, change to ResourceManager start a new 
> worker when required. But I think maintain a certain amount of slots is 
> necessary. These workers will start immediately when ResourceManager starts 
> and would not release even if all slots are free.
> Here are some resons:
> # Users actually know how many resources are needed when run a single job, 
> initialize all workers when cluster starts can speed up startup process.
> # Job schedule in  topology order,  next operator won't schedule until prior 
> execution slot allocated. The TaskExecutors will start in several batchs in 
> some cases, it might slow down the startup speed.
> # Flink support 
> [FLINK-12122|https://issues.apache.org/jira/browse/FLINK-12122] [Spread out 
> tasks evenly across all available registered TaskManagers], but it will only 
> effect if all TMs are registered. Start all TMs at begining can slove this 
> problem.
> *suggestion:*
> * Add config "taskmanager.minimum.numberOfTotalSlots" and 
> "taskmanager.maximum.numberOfTotalSlots", default behavior is still like 
> before.
> * Start plenty number of workers to satisfy minimum slots when 
> ResourceManager accept leadership(subtract recovered workers).
> * Don't comlete slot request until minimum number of slots are registered, 
> and throw exeception when exceed maximum.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to