Staged Simulation Improving Scale and Performance of Wireless - - PowerPoint PPT Presentation

staged simulation
SMART_READER_LITE
LIVE PREVIEW

Staged Simulation Improving Scale and Performance of Wireless - - PowerPoint PPT Presentation

Staged Simulation Improving Scale and Performance of Wireless Network Simulations Kevin Walsh Emin Gn Sirer Cornell University Wireless Simulation Simulation for networking research Ad hoc routing protocols Mobile applications


slide-1
SLIDE 1

Staged Simulation

Kevin Walsh Emin Gün Sirer Cornell University

Improving Scale and Performance

  • f Wireless Network Simulations
slide-2
SLIDE 2

Wireless Simulation

Simulation for networking research

Ad hoc routing protocols Mobile applications Sensor networks

Wireless simulation is often slow

and does not scale

Takes too long Works only for small networks

slide-3
SLIDE 3

How bad is it?

60 120 180 250 500 750 1000

Number of nodes (constant density)

Execution time (minutes)

Ns2 (14½ hours)

slide-4
SLIDE 4

How bad is it?

60 120 180 250 500 750 1000

Number of nodes (constant density)

Execution time (minutes)

Ns2 (14½ hours) Sns

slide-5
SLIDE 5

Insight

Redundant computations, due to

conservative structure of simulator

Can be highly dynamic Recompute state whenever inputs may

have changed

State recomputed more often than

strictly necessary

slide-6
SLIDE 6

Redundancy Across Simulator Runs

Simulator often used for large batch

runs

Nearly identical scenarios/parameters

Leads to redundancy across runs

Users can identify or predict

slide-7
SLIDE 7

Contributions

Identify problem

Redundant computations

Propose approach: Staging

Reduce time spent in redundant computations Intra- & inter-simulation staging

Demonstrate speedup with practical

simulator

No loss of accuracy or change in interface

slide-8
SLIDE 8

Staging: Approach

Basic approach: Result caching and reuse

Limited use, due to real valued and continuously

varying inputs: e.g. current simulation time

Restructure events within a discrete event

simulator to make them amenable to caching

Expose redundancy for caching and reuse Leads to small, time-independent computations

Use time-shifting where possible

Reorder events for maximum efficiency

slide-9
SLIDE 9

S0 S1

Simulator Model

Progression of states Si An event ei acts on Si and produces Si+ 1

  • Ex. Packet transmission, topology computation

e0 S2 e1 e2

slide-10
SLIDE 10

S0 S1

Simulator Model

Progression of states Si An event ei acts on Si and produces Si+ 1

  • Ex. Packet transmission, topology computation

Can view events as functions

Inputs taken from current state Output describes modifications to get next state

f0

inputs

  • utputs

S2 f1 f2

slide-11
SLIDE 11

Restructuring Events

Use currying

Decompose event into multiple events Group part of computation that depends

  • n slowly varying or discrete inputs

Example: node position nearly static

r = f(t, p1, p2, p3, …) time r’ = f(t’, p1, p2, p3, …)

slide-12
SLIDE 12

Restructuring Events

Use currying

Decompose event into multiple events Group part of computation that depends

  • n slowly varying or discrete inputs

Example: node position nearly static

r = f(t, p1, p2, p3, …) time r = f’(t, g(p1, p2, p3, …)) r’ = f(t’, p1, p2, p3, …) r’ = f’(t’, g(p1, p2, p3, …))

slide-13
SLIDE 13

Restructuring Events

r = f(t, p1, p2, p3, …) time

Use currying

Decompose event into multiple events Group part of computation that depends

  • n slowly varying or discrete inputs

Example: node position nearly static

r = f’(t, g(p1, p2, p3, …)) r’ = f(t’, p1, p2, p3, …) r’ = f’(t’, g(p1, p2, p3, …))

slide-14
SLIDE 14

Restructuring Events

Use incremental computation

Reuse results of similar computations Often relies on continuity w.r.t. an input Example: topology similar at nearby times

r = f(t, p1, p2, p3, …) time r’ = f(t’, p’1, p’2, p’3, …)

slide-15
SLIDE 15

Restructuring Events

Use incremental computation

Reuse results of similar computations Often relies on continuity w.r.t. an input Example: topology similar at nearby times

r = f(t, p1, p2, p3, …) time r’ = f(t’, p’1, p’2, p’3, …) r = f(t, p1, p2, p3, …) r’ = f(t’, p’1, p’2, p’3, …, r, t)

slide-16
SLIDE 16

Restructuring Events

Use auxiliary results

Compute and save additional information Example: bounded node speed

r = f(t, p1, …) time r’ = f(t’, p’1, …)

slide-17
SLIDE 17

Restructuring Events

Use auxiliary results

Compute and save additional information Example: bounded node speed

r = f(t, p1, …) time r’ = f(t’, p’1, …) { r,α,β} = f’(t, p1, …) { r’,α’,β’} = f’(t’, p’1, …, α, β)

slide-18
SLIDE 18

Time-shifting

Restructuring and caching provide

  • pportunities for changing the time at which

computations are performed

Smaller, time-independent events

Architectural benefits

Better working set and cache performance

using precomputation and event reordering

Algorithmic benefits

More efficient algorithms using batch processing

slide-19
SLIDE 19

Staging in Practice: Sns

Based on ns-2 wireless network

simulator

Ns-2 wireless is slow; scales poorly Implementation is typical

Inter- and intra-simulation staging No change in accuracy or interface

slide-20
SLIDE 20

Neighborhood Computation

During each packet send, compute

nodes in neighborhood of sender

Expensive in ns-2

Full scan of network on every packet Leads to redundant computations for

typical networks

Staging applied to neighborhood

computation

slide-21
SLIDE 21

1: Grid-based Neighborhood Computation

Use a grid to compute nodes within range

Reuse results for nearby nodes Share grid maintenance across calls

Reduces number of nodes examined Elementary form

  • f staging

Currying and

incremental computation

slide-22
SLIDE 22

r

∆r ∆r N U N L

2: Neighborhood Caching

Compute upper/lower bounds on

neighborhood set, with expiration time ?t

Refine bounds into exact result Many computations

share same bounds

Reduces number

  • f nodes examined

Staging by

auxiliary results

slide-23
SLIDE 23

3: Time-shifting

Precompute all neighborhood cache

entries together

Compute on schedule, every ?t epoch Reduces total work (batching) Improves memory locality May introduce new work

Perform only under heavy load

slide-24
SLIDE 24

4: Inter-simulation Staging

Reuse neighborhood sets across simulation

runs

All runs have same mobility scenario Other simulation parameters may differ

Generate phase: write neighborhood sets to

disk

First run in batch

Use phase: read sets from disk

No grid or topology needed if cache is complete Need only the previously computed result cache

slide-25
SLIDE 25

Execution Time Speedup

1000 nodes AODV routing Setup as in [Broch et al., 1998]

1x 5x 10x 15x 20x

Ns-2 Baseline Grid-based +Nbr.-caching +Time-shifting Inter-Simulation (Phase 2) (Phase 1)

Baseline is approx. 2x faster than stock ns-2 (using standard optimization techniques)

slide-26
SLIDE 26

Effect of Network Size

60 120 180 250 500 750 1000

Number of nodes (constant density)

Execution time (minutes)

Ns-2 Baseline Grid-based Nbr.-caching Time-shifting Phase 1 Phase 2

slide-27
SLIDE 27

Related & Prior Work

Existing instances of intra-simulation staging

NixVectors for wired networks [Riley et al. 2000] Selective packet transmission [Wu & Bonnet 2002]

Instances of inter-simulation staging

Splitting [Glasserman et al. 1996] Cloning [Hybinette & Fujimoto 1997] Updateable Simulations [Ferenci et al. 2002]

Staging in other domains

Compilation [Chambers 2002], iterative

programming, memoization

slide-28
SLIDE 28

Conclusions

Insight: Redundant computations are

main bottleneck for wireless simulation

Staging improves speed & scale by

eliminating redundant computation

No loss in accuracy Applicable to a variety of simulation

engines

O(n2) to O(n) speedup for ns-2

slide-29
SLIDE 29

Staged Simulation for I mproving the Scale and Performance of Wireless Network Simulations. Kevin Walsh and Emin Gün Sirer.

In Procedings of the Winter Simulation Conference. December 2003.

Staged Simulation: A General Technique for I mproving Simulation Scale and Performance. Kevin Walsh and Emin Gün

  • Sirer. In ACM Transactions on Modeling and Computer Simulation

(TOMACS). April 2004.

http://www.cs.cornell.edu/People/egs/sns/

slide-30
SLIDE 30

Grid Performance

60 120 180 1 10 100 1000 10000

Number of nodes (constant density)

Execution time (minutes)

Ns-2 Baseline Inter-Simulation (Phase 2)

slide-31
SLIDE 31

Sensitivity to Parameters

Initial application of staging (grid):

Very sensitive to granularity (both in memory

and CPU)

Poorly tuned grid much worse than baseline

Successive applications of staging:

Reduce sensitivity to granularity Less sensitive to other parameters 10% variation in execution time over wide range

  • f parameters
slide-32
SLIDE 32

Memory Use and Performance

Ns2 severely memory constrained

Artifact of simulator implementation

Grid-based staging adds:

Typical: 1-10 KB, many new events Poorly-tuned: 1-100+ MB, many new events

Other intra-simulation staging adds:

Typical: 20-200 KB, few to no new events Uses grid, but avoids worst-case scenarios

Inter-simulation staging:

Eliminates grid entirely