Top Banner
The Trickle Algorithm Analysis, Use, and Implementation Philip Levis Computer Systems Lab Stanford University
25

The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

May 13, 2018

Download

Documents

lythu
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

The Trickle AlgorithmAnalysis, Use, and Implementation

Philip LevisComputer Systems Lab

Stanford University

Page 2: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Trickle Summary

• An algorithm for establishing eventual consistency in a wireless network

• Establishes consistency quickly

• Imposes low overhead when consistent

• Cost scales logarithmically with density

• Requires very little RAM or code

• Makes no topology assumptions

2

Page 3: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Consistency

• Powerful primitive with many uses

• Routing tree maintenance

• Invariant: next hop has lower cost

• Network configuration

• Invariant: all have the most recent config

• Neighbor discovery

• Invariant: node is in all neighbor’s lists

3

Page 4: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Overview

• Trickle operates over time intervals

• No synchronization needed between nodes

• In each interval, node optionally transmits

• Transmits if it hasn’t heard transmissions that are consistent with its own

• Dynamically scales interval lengths to have fast updates yet low cost when consistent

4

Page 5: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Suppression

• Motivation: don’t waste messages (energy and channel) if all nodes agrees

• Interval of length τ

• At beginning of interval, counter c=0 • On consistent transmission, c++

• Node picks a time t in range [τ/2,τ]

• At t, transmit if c < k (redundancy constant)

5

Page 6: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 6

Example Execution

tA1 tA2

time

tB1 tB2

τtC1 tC2

B

C

transmission suppressed transmission reception

A

k=1c

0

0

0

Page 7: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 7

Example Execution

tA1 tA2

time

tB1 tB2

τtC1 tC2

B

C

transmission suppressed transmission reception

A

k=1c

0

1

0

Page 8: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 8

Example Execution

tA1 tA2

time

tB1 tB2

τtC1 tC2

B

C

transmission suppressed transmission reception

A

k=1c

0

2

0

Page 9: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 9

Example Execution

tA1 tA2

time

tB1 tB2

τtC1 tC2

B

C

transmission suppressed transmission reception

A

k=1c

0

2

0

Page 10: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 10

Example Execution

tA1 tA2

time

tB1 tB2

τtC1 tC2

B

C

transmission suppressed transmission reception

A

k=1c

0

0

0

Page 11: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 11

Example Execution

tA1 tA2

time

tB1 tB2

τtC1 tC2

B

C

transmission suppressed transmission reception

A

k=1c

1

0

1

Page 12: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 12

Example Execution

tA1 tA2

time

tB1 tB2

τtC1 tC2

B

C

transmission suppressed transmission reception

A

k=1c

1

0

1

Page 13: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 13

Example Execution

tA1 tA2

time

tB1 tB2

τtC1 tC2

B

C

transmission suppressed transmission reception

A

k=1c

1

0

1

Page 14: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

log(L)(k=1)

1 2 4 8 16 32 64 128 256

Nodes

0

2

4

6

8

10

12

Transmissions/Interval

0%

20%

40%

60%

14

Page 15: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 15

Logarithmic Behavior

• Transmission increase is due to the probability that one node has not heard n transmissions

• Example: 10% loss

• 1 in 10 nodes will not hear one transmission• 1 in 100 nodes will not hear two transmissions• 1 in 1000 nodes will not hear three, etc.

• Fundamental bound to maintaining a per-node communication rate

Page 16: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Intervals(exponential timers)

• Two constants: τl << τh

• One variable: τ

• Operate over time intervals of length τ

• At end of interval, double τ up to τh

• On detecting an inconsistency, set τ to τl

• Consistent network has large intervals

• Inconsistency leads to small intervals

16

Page 17: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74 17

Simulated Propagation

• Inconsistency at lower left corner

• 16 hop network

• Time to reception in seconds

• Set τl = 1 sec

• Set τh = 1 min

• 20s for 16 hops

• Wave of activity

Page 18: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Example: Routing(distance vector)

• Reset τ when

• Receive a packet with a higher distance• Distance drops significantly

• Use τl =32ms, τh =1 hour, compare with fixed beacons of 30s

• Reduces control traffic by 75%• Reduces latency to repair loops by 99.9%

18

Page 19: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Details

• Current implementations require

• 4-7 bytes of RAM• 30-100 lines of code

• Diversity addresses topology edge cases

• Node diversity• Spatial diversity• Temporal diversity

• Self-regulating and adapting

19

Page 20: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Summary

• Trickle: algorithm for eventual consistency in a wireless network

• Very simple, highly efficient

• Many uses

• Routing topology• Reliable broadcasts• Neighbor discovery

20

Page 21: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

References

• Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk, and Alec Woo. "The Emergence of a Networking Primitive in Wireless Sensor Networks." In Communications of the ACM, Volume 51, Issue 7, July 2008.

• Jonathan W. Hui and David E. Culler. “IP is Dead, Long Live IP for Wireless Sensor Networks.” In Proceedings of the 6th International Conference on Embedded Networked Sensor Systems (SenSys), 2008.

• Philip Levis, Neil Patel, David Culler, and Scott Shenker. "Trickle: A Self-Regulating Algorithm for Code Propagation and Maintenance in Wireless Sensor Networks." In Proceedings of the First USENIX/ACM Symposium on Networked Systems Design and Implementation (NSDI 2004).

• Omprakash Gnawali, Rodrigo Fonseca, Kyle Jamieson, and Philip Levis. "Robust and Efficient Collection through Control and Data Plane Integration." Technical Report SING-08-02.

Best starting point.

21

Page 22: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Questions

22

Page 23: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Draft Plans

• Precise algorithm specification

• Statement of how to reference algorithm in protocol specification documents

• Consistency criteria

• Constants: k, τl, τh

• Discussion of interoperability concerns and performance implications of inconsistent constant values

23

Page 24: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Experimental Data 1

24

0 5000

10000 15000 20000 25000 30000 35000

0 1 2 3 4 5Cum

ulat

ive(N

umbe

r of b

eaco

ns)

Time(hours)

CTPMultiHopLQI

Page 25: The Trickle Algorithm - IETF · IETF 74 References • Philip Levis, Eric Brewer, David Culler, David Gay, Samuel Madden, Neil Patel, Joe Polastre, Scott Shenker, Robert Szewczyk,

IETF 74

Experimental Data 2

25