performance contracts for software network functions · performance contracts for nfs 4 performance...

48
Performance Contracts for Software Network Functions Rishabh Iyer , Luis Pedrosa, Arseniy Zaostrovnykh, Solal Pirelli, Katerina Argyraki, George Candea

Upload: others

Post on 25-May-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Performance Contracts for Software Network Functions

Rishabh Iyer, Luis Pedrosa, Arseniy Zaostrovnykh, Solal Pirelli, Katerina Argyraki, George Candea

Page 2: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

2

Software Network Functions – Pros and Cons o Increased flexibility ✓

o Reduced capital and operating expenses ✓

o Programming errors ✗

o Unexpected performance behaviour ✗

Page 3: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Dealing with unexpected NF performance

o Goal: Comprehensive understanding of NF’s performance profile

v Operators – capacity planning and anticipate attacks

v Developers – informed development decisions

o Previous work [NSDI’12, NSDI’18, SIGCOMM’18]

v Focus on narrow subset of input workloads

v Offer few completeness guarantees

3

Page 4: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Performance Contracts for NFs

4

Performance

Prediction

o Abstraction for users to parameterize arbitrary input workloads

o Predict performance for workload spec without running NF

o Performance predicted as function of Performance Critical Variables (PCVs)

o Per-packet metrics: Instruction count, memory accesses, latency (cycles)

Workload

Spec

Performance Contract

Page 5: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Outline

o What is a performance contract?

o How does Bolt generate contracts?

o Evaluation & Use-Case

5

Page 6: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Running example

6

Page 7: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Running example

7

Page 8: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Running example

8

Page 9: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Running example

9

Page 10: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Key A

Running example

10

Hash 0

Hash 1

Hash 2

Hash 3

Hash 4

Hash 5

Key B Key C

Key D

MACtable implementation

Page 11: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Performance Contracts Example

11

Performance Contract for MAC_bridge

Traffic Class Performance

Metric: Lines of pseudo-code

Page 12: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Performance Contracts Example

12

Traffic Class PerformanceInvalid Header

Valid, DestMAC knownValid, DestMAC unknown

Performance Contract for MAC_bridgeMetric: Lines of pseudo-code

Page 13: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Performance Contracts Example

13

! = Number of hash collisions

Traffic Class PerformanceInvalid Header 3

Valid, DestMAC known 3! + 20Valid, DestMAC unknown 3! + 100

Performance Contract for MAC_bridgeMetric: Lines of pseudo-code

Page 14: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Using performance contracts

14

Spec 1: Unconstrained traffic

! = Number of hash collisions

Traffic Class PerformanceInvalid Header 3

Valid, DestMAC known 3! + 20Valid, DestMAC unknown 3! + 100

Performance Contract for MAC_bridge

Metric: Lines of pseudo-code

Page 15: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Using performance contracts

15

Predicted performance:

3 max _&'(()*)'+* + 100

⇒ 0 = max _&'(()*)'+*

0 = Number of hash collisions

Traffic Class PerformanceInvalid Header 3

Valid, DestMAC known 30 + 20Valid, DestMAC unknown 30 + 100

Spec 1: Unconstrained traffic Performance Contract for MAC_bridge

Metric: Lines of pseudo-code

Page 16: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Using performance contracts

16

! = Number of hash collisions

Traffic Class PerformanceInvalid Header 3

Valid, DestMAC known 3! + 20Valid, DestMAC unknown 3! + 100

Predicted performance:

100

⇒ ! = 0

Spec 2: No hash collisions Performance Contract for MAC_bridge

Metric: Lines of pseudo-code

Page 17: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Using performance contracts

17

! = Number of hash collisions

Traffic Class PerformanceInvalid Header 3

Valid, DestMAC known 3! + 20Valid, DestMAC unknown 3! + 100

Predicted performance:

20

⇒ ! = 0

Spec 3: Valid, no collisions,

DestMAC known

Performance Contract for MAC_bridge

Metric: Lines of pseudo-code

Page 18: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Using performance contracts

18

! = Number of hash collisions

Traffic Class PerformanceInvalid Header 3

Valid, DestMAC known 3! + 20Valid, DestMAC unknown 3! + 100

Predicted performance:

20

⇒ ! = 0

Spec 3: Valid, no collisions,

DestMAC known

Contracts quantify performance for all traffic classes of the NF Users query contract for performance of specific input workloads

Performance Contract for MAC_bridge

Metric: Lines of pseudo-code

Page 19: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Outline

o What is a performance contract?

o How does Bolt generate contracts?

o Evaluation & Use-Case

19

Page 20: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

20

Firewall NAT Bridge

NF chain

Generating performance contracts recursively

+ + =

Page 21: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Generating performance contracts recursivelyIndividual NF

Stateful NF data structures

Stateless Code

MACtableput(), get()

21

Page 22: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Generating performance contracts recursively

22

Individual NF

Stateful NF data structures

(Hard to analyze)*

Stateless Code(Simple to analyze)*

MACtableput(), get()

*A.Zaostrovnykh, S.Pirelli, L.Pedrosa, K.Argyraki, G.Candea “A Formally Verified NAT” SIGCOMM 2017

Page 23: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Generating performance contracts recursively

23

o Well defined separation between stateful and stateless NF code*

o NFs typically have well defined, isolated state

o Encapsulate NF state using a library of data structures

o Stateful data structures – Base case of recursive process

o Analyze once, reuse across NFs

*A.Zaostrovnykh, S.Pirelli, L.Pedrosa, K.Argyraki, G.Candea “A Formally Verified NAT” SIGCOMM 2017

Page 24: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Analyzing stateful data structures

24

!"#$%#&'()"*+ = $ -(./0 .')1"0, *+ 30'0", )%($-4, . .

o Cannot account for all possible packet histories -> Path explosion

o BUT, performance of MACtable depends ONLY on number of hash collisions

Page 25: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Performance Critical Variables (PCVs)

25

o Abstract away NF state specificities

o Succinctly summarize impact of packet history, configuration on performance

o Tailor legibility and detail to audience

Traffic Class PerformanceUnconstrained 1! + 2

Contract for MACtable_put Contract for MACtable_get

Traffic Class PerformanceKey present 2! + 12Key absent 2! + 7

! = Number of hash collisionsOnly PCV required to summarize perf in terms of lines of pseudo-code

Page 26: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Generating Performance Contracts for NFs

26

o Symbolically execute stateless code to traverse all execution paths

o While traversing each path

v Keep track of performance metrics for stateless code

v Plug in contracts for stateful code using path constraints

Page 27: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Generating Performance Contracts for NFs

27

3

Invalid Valid

1

Page 28: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

28

Traffic Class PerformanceUnconstrained 1! + 2

Contract for MACtable_put

Generating Performance Contracts for NFs

3

Invalid Valid

1

1C + 2

Page 29: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

29

Traffic Class PerformanceKey present 2" + 12Key absent 2" + 7Contract for MACtable_get

Generating Performance Contracts for NFs

3

Invalid Valid

1

1C + 2

DestMAC known DestMAC unknown

2C + 12 2C + 7

Page 30: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

30

Generating Performance Contracts for NFs

3

Invalid Valid

1

1C + 2

DestMAC known DestMAC unknown

2C + 12 2C + 75 90

Page 31: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

31

3

Invalid Valid

1

1C + 2

DestMAC known DestMAC unknown

2C + 12 2C + 7

5 90

Generating Performance Contracts for NFs

Performance Contract for MAC_bridge

! = Number of hash collisions

Traffic Class PerformanceInvalid Header 3

Valid, DestMAC known 3! + 20Valid, DestMAC unknown 3! + 100

Page 32: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Performance Contracts for NF chains

32

o Generate performance contracts for individual NFs in chain

o Pair together traffic classes from communicating NFs

o For each pair - AND respective constraints together

v Equate packet sent by first NF to packet received by second

Page 33: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Performance Contract for NF chains - Example

33

FirewallTraffic Class Perf

IP opt 20No IP opt 50

Router

Firewall

Drops packets with IP options

Fast path – No IP options

Slow path – IP options

Router Traffic Class PerfIP opt 500

No IP opt 60F1F2

R1R2

NF chainTraffic Class Perf

IP opt 20No IP opt 110

<F1><F2, R2>

Page 34: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Outline

o What is a performance contract?

o How does Bolt generate contracts?

o Evaluation and Use-Case

34

Page 35: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Evaluation setup & methodologyo 4 NFs - NAT, Maglev-like LB, MAC bridge, LPM router

o Analyze NF logic + DPDK + NIC driver*

o Metrics – instructions executed, memory accesses, execution cycles

o Testbed - Intel Xeon E5-2667v2 3.3GHz, 82599ES 10Gb NICso Compare predicted vs measured performance for various packet classes

35

Tester Device under Test *S.Pirelli, A.Zaostrovnykh, G.Candea “A Formally Verified NAT Stack” KBNETS Workshop - SIGCOMM 2018

Page 36: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Predictions for Instruction Count, Memory Accesses

36Max prediction gap – 7.5% (IC) and 7.6% (MA)

Class Description

LB1 Unconstrained traffic

LB2 Client packet, new flow

LB3Client packet, existing flow,

unresponsive backend

LB4Client packet, existing flow,

existing backend

LB5 Heartbeat packets

Results for Maglev-like Load Balancer

Pre

dic

tio

n G

ap

(%

)

Class

0

2

4

6

8

10

LB1 LB2 LB3 LB4 LB5

Instruction Count (IC) Memory Accesses (MA)

Page 37: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Why is there a prediction gap?

37

o Source 1: Trade-off between precision and legibility in PCVs

v Can be overcome by exposing more detail

o Source 2: Differences between analyzed and production code

v Disabled link time optimizations in analyzed code

Page 38: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Use Case – Informed cost-benefit analysis

38

o Example: Bridge with randomized hash table

v Incorporates random key into hash function

v Rehashes all entries with a new key when collisions greater than a threshold

o Question: Where to place threshold?

v Avoid rehashing under normal operation

v Should rehash under attack

Page 39: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

39

Use Case – Informed cost-benefit analysis

0.001

0.01

0.1

1

1 2 3 4 5 6 7 8103

104

105

106

CCDF

Pred

icted

IC

Number of hash collisions

Predicted IC

Page 40: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

40Bolt allows operators to visualize the consequences of their decisions

Use Case – Informed cost-benefit analysis

0.001

0.01

0.1

1

1 2 3 4 5 6 7 8103

104

105

106

CCDF

Pred

icted

IC

Number of hash collisions

Predicted ICCCDF

Page 41: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Performance Contracts for NFso Abstraction for users to parameterize arbitrary input workloads

o Predict performance for workload spec without running NF

o Performance predicted as function of Performance Critical Variables (PCVs)

bolt-perf-contracts.github.io41

Page 42: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

42

o Distiller

o Results – IC, MA

o Results – NF chains

o Results – Latency

o Full Blown Contract

Backup Slides

Page 43: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

The Bolt Distiller

43

Back

o Users need to know which traffic classes are likely

o Bolt is a static analysis tool, cannot know probabilities of each traffic class

o The Bolt Distiller

v Input – A representative packet trace

v Output - Execution path taken by each packet & values of PCVs

v Users can then extrapolate the likelihood and query contract accordingly

Page 44: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Predictions for Instruction Count, Memory Accesses

44

Class Description

NAT1 Unconstrained trafficNAT2 Client packet, new flow NAT3 Existing flow NAT4 External, dropped packetBR1 Unconstrained trafficBR2 Broadcast trafficBR3 Unicast traffic

Results for NAT, Bridge

Pred

ictio

n Ga

p (%

)Class

0

2

4

6

8

10

NAT1 NAT2 NAT3 NAT4 BR1 BR2 BR3

Instruction Count (IC) Memory Accesses (MA)

Bolt predicts IC & MA accurately, irrespective of NF/Traffic Class

Back

Page 45: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Predictions for NF chains

45

o NFs chained together v Firewall – drops packets with IP options v Router – Fast path (No IP options), Slow path (packets with IP options)

Class Description

C1 Packets with IP optionsC2 Packets without IP options

0

2

4

6

8

10

C1 C2

Instruction Count (IC) Memory Accesses (MA)

Pred

ictio

n Ga

p (%

)

Class

Back

Page 46: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

Predictions for Latency (Execution Cycles)

469x for pathological traffic, 3x for typical traffic

Class Description

LB1 Unconstrained trafficLB2 Client packet, new flow

LB3 Client packet, existing flow, unresponsive backend

LB4 Client packet, existing flow, existing backend

LB5 Heartbeat packets

Results for Maglev-like Load Balancer

Ove

r-est

imat

ion

Ratio

Class

0

2

4

6

8

10

LB1 LB2 LB3 LB4 LB5

Execution Cycles

Back

Page 47: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

47

Predictions for Execution CyclesResults for LB,NAT, Bridge,LPM

Back

Page 48: Performance Contracts for Software Network Functions · Performance Contracts for NFs 4 Performance Prediction oAbstraction for users to parameterize arbitrary input workloads oPredict

48

Full Blown Contract

Back