Giter Club home page Giter Club logo

netsim-cookbook's Introduction

netsim cookbook

A place to collect various netsim test scripts.

Guidelines

These guidelines aim to provide recommendations for the test scripts that get added to this repository:

  • Name the test file descriptively (according to what it does or the scenario)
  • Use the comment command to provide additional context at the top of the test file
    • Optionally: outline the expectations of a successful test run
  • Unless important for the test, provide ssb-server as the implementation puppets will run in the test (keeps scripts uniform)

License

All test scripts added to this repository are licensed under the MIT license.

netsim-cookbook's People

Contributors

arj03 avatar cblgh avatar mycognosist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

netsim-cookbook's Issues

Initial multi-implementation netsim test results

Sharing the report here for discussion before I make a PR with test scripts etc.

Netsim Replication Benchmarks

Full Sync Two SSB Nodes

All tests were run with the same fixtures consisting of 100,000 messages from 20 unique authors. Two identities were chosen: one is labelled as server and the other as peer. The skipoffset peer netsim command was used to ensure the peer starts with 0 messages. The peer is connected to the server and we time how long it takes for peer to replicate the full feed of server (4219 messages). A mutual follow is established before connecting the peer to the server (hence the 4220 message count in the test output). Replication rate is calculated as the total peer messages divided by the run time.

See the bottom of the page for the full test script.

Summary

server peer messages time messages / second
go go 4220 0.509 8291
js js 4220 2.65 1592
go js 4220 2.831 1491
go js (db2) 4220 3.948 1069
js (db2) js (db2) 4220 7.239 583
js go 76 160.596 0.5
js (db2) go 1 160.597 0

JS - JS (db)

# Total time: 16.891932964s
# Active time: 4.391932964s
# Puppet count: 2
# Puppet         Total time  Active time   # messages
# server            16.291s       3.791s         4220
# peer              14.203s       3.703s         4220
# 
# Started timers & final elapsed time
# Label                Time
# run                 2.65s

Replication rate (msgs / second): 1592

JS - JS (db2)

# Total time: 21.009802043s
# Active time: 8.509802043s
# Puppet count: 2
# Puppet         Total time  Active time   # messages
# server            20.668s       8.168s         4220
# peer              18.328s       7.828s         4220
# 
# Started timers & final elapsed time
# Label                Time
# run                7.239s

Replication rate (msgs / second): 583

Go - Go

# Total time: 14.898761001s
# Active time: 2.398761001s
# Puppet count: 2
# Puppet         Total time  Active time   # messages
# server             13.78s        1.28s         4220
# peer              12.799s       2.299s         4220
# 
# Started timers & final elapsed time
# Label                Time
# run                 509ms

Replication rate (msgs / second): 8291

Go - JS (db)

server : go ... peer : js

# Total time: 16.877485387s
# Active time: 4.377485387s
# Puppet count: 2
# Puppet         Total time  Active time   # messages
# server            16.332s       3.832s         4220
# peer              14.767s       4.267s         4220
# 
# Started timers & final elapsed time
# Label                Time
# run                2.831s

Replication rate (msgs / second): 1491

server : js ... peer : go

# Total time: 2m54.868505121s
# Active time: 2m32.368505121s
# Puppet count: 2
# Puppet         Total time  Active time   # messages
# server          2m53.837s    2m31.337s         4220
# peer            2m52.303s    2m31.803s           76
# 
# Started timers & final elapsed time
# Label                Time
# run             2m40.596s

Replication rate (msgs / second): 0.5

Go - JS (db2)

server : go ... peer : js

# Total time: 17.870999912s
# Active time: 5.370999912s
# Puppet count: 2
# Puppet         Total time  Active time   # messages
# server            17.577s       5.077s         4219
# peer              15.767s       5.267s         4220
# 
# Started timers & final elapsed time
# Label                Time
# run                3.948s

Replication rate (msgs / second): 1069

server : js ... peer : go

# Total time: 2m54.645813867s
# Active time: 2m32.145813867s
# Puppet count: 2
# Puppet         Total time  Active time   # messages
# server          2m53.614s    2m31.114s         4220
# peer             2m51.95s     2m31.45s            1
# 
# Started timers & final elapsed time
# Label                Time
# run             2m40.597s

Replication rate (msgs / second): 0


Test Script

The only changes to this script between runs are the start server go-sbot and start peer go-sbot commands; go-sbot is substituted for ssb-server or ssb-server-db1 when required.

comment [ configuring peer ]
enter peer
hops peer 3
load peer @sWJqvI4hdv96aRMk1pQOJo1frXRFr7oBB5/r/jBMcxw=.ed25519
skipoffset peer

comment [ configuring server ]
enter server
hops server 3
load server @NZpjhmgTaHOHFZI6G6dIuWwa3UqwSpfRpMbY5ue6vAI=.ed25519

start server go-sbot
start peer go-sbot

follow server peer
wait 4000
follow peer server
wait 4000

timerstart run

connect peer server
waituntil peer server@latest

timerstop run

disconnect peer server
stop server
stop peer

Initial partial replication netsim test results

Netsim Partial Versus Full Replication Benchmarks

Goal

The motivation behind this batch of tests was to ascertain the efficacy and efficiency of partial replication (using index feeds), as compared with full replication.

Dataset

All tests were run with the same fixtures consisting of 100,000 classic messages and 10,935 index messages (about & contact) from 100 unique authors. The complete fixtures comprise 500 feeds. The following command was used to generate the fixtures:

npx ssb-fixtures@latest --progress --messages=10000 --authors=100 --followGraph=true --allkeys=true --indexFeeds=100 --seed=ritual11 --outputDir=100k-100auth-indexed-fixtures

Note: ssb-fixtures@latest was 3.0.0 at the time of command execution.

Run Command

netsim run --spec fixtures-output/netsim-test-js-db2-indexes.txt --fixtures 100k-100auth-indexed-fixtures/fixtures-output ssb-server-db2

Note: the exact test file and implementation(s) passed to netsim differ slightly for each test variant. In the above command, we are testing full replication using a JS db2 implementation.

Simulation Setup

Two identities were chosen: one is labelled as server (@fa+bdOd11etLngOjltjPx/wtQTbCX6lE9vhnQY7zGX8=.ed25519) and the other as peer (@pqRSz6qLrlPo8TH4txzSxcXwtlEUj6pkkrJ066+Xfpg=.ed25519). The peer instance started with 562 messages and 1 feed. The alloffsets server netsim command was used to ensure the server started with all 110935 messages and 500 feeds. The peer was connected to the server and we measured how many messages were replicated from server to peer in 6 seconds and 25 seconds respectively. A mutual follow was established before connecting the peer to the server. The disconnect command was used at the end of the test script to ensure the peer instance was disconnected from server before netsim performed the message count; failing to pass this command can result in inaccurate counts, since replication may continue after the timed window.

Each test was run three times and averages were calculated for run time, feed counts and message counts. Replication rates are calculated as (the total peer messages minus 562 & the total peer feeds minus 1) divided by the run time (either 6 or 25 seconds).

Summary

All values are calculated as an average across three test runs for each implementation.

Six Seconds of Replication

server peer partial time messages messages / second feeds feeds / second
js (db2) js (db2) yes 7.03 12801 1818 374 53
js (db2) js (db2) no 7.03 69820 9932 79 11
js (db) js (db ) no 6.543 36255 5541 81 12
go go no 6.507 32101 4933 19 3

Twenty Five Seconds of Replication

server peer partial time messages messages / second feeds feeds / second
js (db2) js (db2) yes 26.04 18978 729 453 17
js (db2) js (db2) no 26.018 75321 2895 77 3
js (db) js (db ) no 25.538 80164 3139 83 3
go go no xxxx xxxxx xxxx xx xx

Test Script

comment [ six second sync two js db2 ssb servers with indexes 100k msgs ]

comment [ configuring peer ]
enter peer
hops peer 3
load peer @pqRSz6qLrlPo8TH4txzSxcXwtlEUj6pkkrJ066+Xfpg=.ed25519

comment [ configuring server ]
enter server
hops server 3
load server @fa+bdOd11etLngOjltjPx/wtQTbCX6lE9vhnQY7zGX8=.ed25519
alloffsets server

comment [ starting ssb-server instances ]
start server ssb-server-db2
wait 10000

start peer ssb-server-db2
wait 5000

follow server peer
follow peer server

comment [ connecting peer to server ]
timerstart index_run
connect peer server
wait 6000
timerstop index_run

comment [ disconnecting peer instance ]
disconnect peer server

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.