How resource reclaim works based on share ratio (feature enabled)

When resource reclaim based on share ratio is enabled, resources are reclaimed according to share ratio across the entire consumer tree.

Scenario: Three Consumers, 12 slots

Let us use the same example used for when the feature is not enabled.

Total share pool: 12 slots

There are three consumers: A, B, C. There are no subconsumers.

The lowest priority consumer is consumer B.

The share ratio is equal for all consumers (1:1:1).

Example 1: Demand exists for all consumers

All consumers have demand for 4 slots.

Behavior is exactly the same as when resource reclaim based on share ratio is not enabled.

Example 2: No demand for consumer C

Behavior is exactly the same as when resource reclaim based on share ratio is not enabled.

Example 3: Demand exists again for consumer C

Building on the previous example:

Consumer A has demand for 7 slots, allocated 7 slots.

Consumer B has demand for 5 slots, allocated 5 slots.

Consumer C now has demand for 1 slot.

To determine from which consumer slots should be reclaimed, the system looks at the share ratio across the entire consumer tree. The share ratio is 1:1:1.

So, to distribute slots according to share ratio, the sytem identifies which consumer is the most overallocated. In this case, consumer A is overallocated by 3 slots, consumer B is overallocated by 1 slot. As a result, the system reclaims 1 slot from consumer A to allocate to consumer C.



Scenario: Subconsumers, 100 slots

Total share pool: 100 slots

There are two top-level consumers: Consumer A and Consumer B. The share ratio is Consumer A: 1, Consumer B: 4

In Consumer B, we have leaf consumers B1 and B2. The share ratio is: Consumer B1:25, Consumer B2: 75.

Example 1: Only consumer A has demand

Consumer A has demand for 100 slots. Only consumer A has demand, so the total share pool is distributed 100% to Consumer A.



Example: B1 has demand for 500 slots

Building on the previous example, consumer A is now allocated 100 slots.

B1 now has demand for 500 slots.

Since consumer B1 has demand, consumer B is considered to have demand by the system.

The system considers the share ratio across the entire tree to reclaim slots. Consumer A’s ratio is 1, consumer B’s ratio is 4, so out of 100 slots, consumer A should get 20, consumer B, 80.

80 slots are reclaimed from consumer A and allocated to consumer B. Consumer B is a top-level consumer, so its leaf consumers are considered.

Consumer B1 has demand. Consumer B2 has no demand. As a result, consumer B1 gets 100% of the slots (80 slots).



Example 3: All consumers have demand for slots, B2 has demand for 100 slots

Building on the previous example, consumer A has demand for 500 and is now allocated 20 slots. Consumer B1 has demand for 500 and is allocated 80 slots.

B2 now has demand for 100 slots.

As a result, slots need to be reclaimed. The system evaluates the share ratio of the entire consumer tree. There is demand across all consumers.

Consumer A’s ratio is 1, consumer B’s ratio is 4, so out of 100 slots in the share pool, consumer A should get 20, consumer B, 80. Currently, consumer A and consumer B are allocated according to share ratio.

Consumer B1’s ratio is 25, Consumer B2’s ratio is 75. As a result, consumer B1 should get 20, consumer B2 60. Consumer B1 is allocated 80 slots. As a result, 60 slots are reclaimed from B1 and allocated to B2.