SLObudget = Initialize() while (SLObudget > SLOunit){ bestcandidate =…
- User
SLO_budget = Initialize() while (SLO_budget > SLO_unit){ best_candidate = find_candidate_with_highest_cost_saving() best_candidate.increase_SLO(SLO_unit) update_total_cost() SLO_budget = SLO_budget-SLO_unit }
The algorithm first initializes all microservices by allocating a single SLO unit to them. This step ensures the algorithm starts with a finite total cost, so the cost saving can be calculated at each step. As a result, the algorithm starts with an SLO budget that is smaller than the end-to-end SLO, since a fraction of the budget is allocated during initialization. Then, the algorithm finds the microservice that yields the highest cost savings if allocated one marginal SLO unit. The cost saving of a particular microservice node for allocating one marginal SLO unit is formulated in Equation 8 (Δ𝑠 denotes the marginal SLO unit). The algorithm continues allocating SLO units one at a time until the entire end-to-end SLO budget is exhausted. Cost savings decrease as the algorithm progresses since the LLP graphs are usually steeper at higher loads, as shown in Figure 2(b). The computational complexity of the algorithm is linear in the number of incremental SLO units and the number of microservices in the chain. Finding the best microservice for each incremental SLO unit can be optimized to logarithmic complexity via a priority queue-based implementation, wherein the cost saving for all microservice nodes is stored in the priority queue, and only the entry for the highest cost-saving node is updated every iteration for the next SLO unit. 使用python复现这个算法,并给出中文注释
我的入参是总共可分配的SLO,阶段数,以及每个阶段的函数(x坐标是GPU数量,y坐标是延迟),每个阶段的SLO初始化为100ms,你需要确保总共可分配的SLO>阶段数*100ms,接下来每次将100ms分配给能够节省最多GPU数量的阶段,你可以把分配后的SLO作为y坐标的值传给一个阶段,根据入参的函数得出该阶段所需的GPU数量,加100ms后所需的GPU数量-加之前的GPU数量=节省的GPU数量
- Assistant