Skip to content

input-output-hk/hydra-sim

Repository files navigation

Simulations for Ouroboros Hydra

Head Protocol

See [exe/head][./exe/head/Main.hs] and [experiments][./experiments]

Tail Protocol

See [exe/tail][./exe/tail/Main.hs].

The tail protocol simulation works in two steps: preparation and run.

Preparation

The preparation generates clients events from a set of parameters. That is, one can create a simulation over a certain period of time, from a certain number of clients with certain behavior. For example:

$ hydra-tail-simulation prepare \
  --number-of-clients 1000 \
  --duration 60 \
  --online-likelihood 50%100 \
  --submit-likelihood 10%100 
  events.csv

PrepareOptions
    { numberOfClients = 1000
    , duration = SlotNo 60
    , clientOptions = ClientOptions
        { onlineLikelihood = 1 % 2
        , submitLikelihood = 1 % 10
        }
    }

The events can then be fed into the simulation for execution. Having both step separated allows for creating events from other sources (e.g. from a real network) while the prepare command can be used to establish some baseline on simple patterns. Note that the prepare command is fully deterministic. Same options yield exactly the same events.

Execution

To run a simulation, simply provide an events dataset with possibly some custom options for the server:

$ hydra-tail-simulation run \
  --slot-length 1s \
  --region LondonAWS \
  --read-capacity 102400 \
  --write-capacity 102400 \
  events.csv

RunOptions
    { slotLength = 1 s
    , serverOptions = ServerOptions
        { region = LondonAWS
        , concurrency = 16
        , readCapacity = 102400 KBits/s
        , writeCapacity = 102400 KBits/s
        }
    }
SimulationSummary
    { numberOfClients = 1000
    , numberOfEvents = 39254
    , numberOfTransactions = 19627
    , lastSlot = SlotNo 29
    }
Analyze
    { maxThroughput = 654.2333333333333
    , actualThroughput = 652.2456487218975
    , actualWriteNetworkUsage = 4906 KBits/s
    , actualReadNetworkUsage = 5385 KBits/s
    }

The simulation outputs two throughputs: a maximum throughput and a real throughput. The actual throughput is calculated by looking at the (simulated) time it took to run the simulation, compared to the max throughput which is the best that the server could achieve given the inputs (or said differently, the actual traffic generated by all clients). It also outputs the actual network usage, as a mean to compare that with the initial server's capacity.

Results

The simulations can take some time to run, so here below are some preliminary results computed from the main chain datasets:

Clients Compression Concurrency Network Usage (KBits/s) Traffic (Tx/s) Server Throughput (Tx/s)
1000 1000 16 Read: 824522
Write: 990515
17 17
1000 10000 16 Read: 824522
Write: 990515
166 166
1000 100000 16 Read: 824522
Write: 990515
1686 1635
1000 1000000 16 Read: 824522
Write: 990515
16353 2147

About

Simulations for the Hydra protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published