rule-placement algorithm概述
主要介紹了一種規則放置算法(rule-placement algorithm)以達到“One Big Switch”的抽象。由於switch容量有限,將所有規則放入一組switch 集羣中,以抽象成一個 big switch。
- input:①端點策略(end-point policy)和②路由策略(routing policy),以及③網絡拓撲(network topology)和④交換機容量
- synthesize by:規則放置算法(rule-placement algorithm)
- output:規則(forwarding rule)
其中:
- Network topology:
- location (loc) 端口
- exposed locations 與外界相連的端口
- ingress loc (入口) 和 egress loc (出口)
某個流F最終到哪個出口端點O(網絡交通的終點)
Endpoint policy (E):
- 一個端點策略就是一組相同源端口(入口)的規則集。其形式r:dst ip = 00∗, ingress = H1 : Permit, egress = H2
- a prioritized list of rules E :[r1, …, rm] ,其中m = ||E||
規則集由大到小分爲:整個端點規則E——>劃分成部分不重疊的流空間(flow space)D
i ——>打包到switch的規則集Eq (用在Path algorithm的cover階段)- 其中Di(Ei)是怎麼來?——>通過路徑策略確定Di
- 爲方便描述分別定義爲:整塊矩形E;大矩形D
i (Ei );小矩形Eq
- Routing policy (R):
- R(loc1, loc2, pkt) = s
i 1 si 2 …si k ,其中si 1 si 2 …si k 就是一條路徑(path) - (?)packet和path的關係?
- R(loc1, loc2, pkt) = s
Our rule-placement algorithm helps raise the level of abstraction for SDN by shielding programmers from the details of distributing rules across switches.
讓控制平臺管理規則的放置,而不需要應用程序或程序員來實現。他們只需要定義高水平的策略。
- 注:不存在規則依賴問題,因爲一組有依賴的規則都全部放入一組交換機集羣中——one big switch
rule-placement algorithm分析
算法分爲三個階段:
- Decomposition (component 1):將問題分解成多條路徑
- Resource allocation (component 2):估計每條路徑上的交換機總容量,LP問題
- Path algorithm (component 3):在每條路徑上安裝對應的端點策略E
i
一、Decomposition
we decompose the general rule-placement problem into smaller sub-problems.
輸入條件:implementing {E, R} as implementing the routing policy R and a union of endpoint policies over the paths.
- 通過routing policy可以找出所有τ個路徑。
- a union of endpoint policies是某個源端口的端點策略E
過程:E劃分——>由P
More formally, we can associate path P
i with a flow space Di (i.e., all packets that use Pi belong to Di )and the projection Ei of the endpoint policy on Di
首先,在E(整個規則集中)劃出一塊相應的流空間D
怎麼劃分?
- 由路徑策略Pi確定Di
- 根據路徑策略Pi的數據包包頭劃出規則空間D
i 。如二維規則,提取指定的src_ip和dst_ip部分組成Di - 注意任意兩個不相同的規則空間總是不相交的
- 確定D
i 後,可以分別找到E中所有對應的實際部分規則集Ei ,如下圖所示
怎麼對應路徑?首先Ei在路徑中已經確定。再怎麼確定路徑P
- 涉及到階段二,如下
二、Resource allocation
①The goal of “allocation” phase is to find a global rule-space allocation,such that it is feasible to find rule placements for all paths.
②the feasibility of a rule-space allocation depends primarily on the total amount of space allocated to a path, rather than the portion of that space allocated to each switch.
③we estimate the threshold value for the L
i -hop path Pi with endpoint policy Ei .
我們首先定義一個閾值η作爲估計D
其中α
可知,影響規則空間的兩個因素:
- The size of endpoint policy ||E
i || - The path length L
i :每個switch都需要至少一個小矩形,小矩形越多開銷越大
rule-space allocation分爲兩步:
- 估計D
i 中的規則數量:η=αi ||Ei || - 通過LP,判斷這條路徑P
i 是否合適
LP問題:
- 每個節點switch
i 在所有路徑Pj 上的容量之和不超過100% - 每條路徑P
j 的所有switchi 之和要≥ηj - i代表節點,j代表路徑
- X
i, j 代表switch中可用容量佔比。如交換機容量C4 =1000,X4, 3 =0.4,則表示在P3 上S4 中可以放最多400個規則。
當檢測失敗時,增大η
三、Path algorithm(path-wise endpoint policy)
概述:
- 對於每一條路徑,該算法分別(並行)將一塊規則(小矩形)放入路徑上的某個switch
- 每個規則在路徑上只需要一個(i.e. 每個packet在路徑上只需要執行一次的r.a)——>規則在路徑上可以靈活地移動
- 注意放置規則之前,路徑上的每個節點(switch)都要安放一條默認規則(優先級最低),用於當packet沒有相對應規則(i.e. packet不在D
i 中)時,轉發到路徑的下一跳節點
該算法分爲三步:
- Cover:在打矩形中找到小矩形E
q 。如何找? - Pack:將大矩形和小矩形重疊部分的規則打包到switch
- Replace:用一條新規則(優先級最高)qFwd = (q, Fwd)代替小矩形中的規則集
注意兩點:
- 放入的實際規則總是不少於E
i 的規則集 - 規則放入switch不能有遺漏
接上,如何找小矩形?——>
如何找到最好的candidate rectangles?即在大矩形E
——>轉換成兩個子問題:怎麼選擇小矩形?;如何找到小矩形?
(1)問題1:Rectangle selection
- internal rules是完全與q重疊
- overlapping rules是部分與q重疊
- 規則數量相同,選擇utility最優的
(2)問題2:Top-Down search
- To limit the search space, our algorithm avoids searching too deeply,
preferring larger rectangles over smaller ones. - we only consider those rectangles q such that there exists no rectangle q¹ which satisfies both of the following two conditions:(i) q is inside q¹ and (ii) E
q¹ can be packed in the switch. We call these q the maximal feasible predicates. - q規則數量要滿足≤switch的容量c
i - 搜索的矩形塊由大到小,直到收縮到規則的邊
補充:一維規則的放置
- If the root of this subtree has no action, the root inherits the action of its lowest ancestor(即4b圖中矩形中的根節點r.a取自他的上一層節點)
- 算法是貪心的。每次pack的subtree subject(矩形內)都是逼近switch容量的
☆(3)算法僞代碼:
- 2、找到所有≤d
i 的最大可行矩形Q【Top-Down search 】 - 3、在Q中選出最好效率的q【Rectangle selection】
- 5和6、移除internal rules(注意:在新的E¹中不需要改overlapping的規則)。如下
- 7、在E¹添加新的規則qFwd = (q, Fwd)
算法優化
對一些不需要的數據包(丟棄操作的)還傳入下一跳節點將會增加不必要的成本
充分利用入端口的switch容量
節點越靠前,權重越大轉變打包順序
This motivates us to reverse the order we place rules along a chain:here, we shall first pack the most refined rules at the last switch,and progressively pack the rules in upstream switches, making the ingress switch responsible for the biggest rules.
INCREMENTAL UPDATES
- Local Algorithm:不需要改變Path,只插入、刪除、改變規則
- Global Algorithm:Path改變
Rule-Space Utilization
開銷問題:額外規則的ovehead
- 定義:(C-||E
i ||)/ ||Ei || 其中,C爲實際的規則數量 - 開銷主要由LP問題和Path algorithm構成
- 多個路徑的開銷——一個規則在多個路徑上(情況較少)
- 單個路徑上的開銷。隨路徑上節點數量的增加而線性增加
引用:
- Kang N, Liu Z, Rexford J, et al. Optimizing the “one big switch” abstraction in software-defined networks[C]// ACM Conference on Emerging NETWORKING Experiments and Technologies. ACM, 2013:13-24.
- Kang N, Reich J, Rexford J, et al. Policy transformation in software defined networks[C]// ACM SIGCOMM 2012 Conference on Applications, Technologies, Architectures, and Protocols for Computer Communication. ACM, 2012:309-310.