Skip to content

Instantly share code, notes, and snippets.

@alanshaw
Last active December 10, 2018 11:08
Show Gist options
  • Save alanshaw/e8f49ff1875f0e256e7c45ddeef31498 to your computer and use it in GitHub Desktop.
Save alanshaw/e8f49ff1875f0e256e7c45ddeef31498 to your computer and use it in GitHub Desktop.
MOAR benchmarks

Benchmarks

Here's some suggestions for additional benchmark tests that might help us identify more performance bottlenecks for us to address. Feedback is welcome - are these good tests? Are there different things we should be testing? Are we missing tests?

JS IPFS in Node.js

Test js0 -> js0 js0 -> js1 go0 -> go0 go0 -> go1 js0 -> go0 go0 -> js0 js01234 -> js5 go01234 -> go5
Node initialization 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add small file (balanced) 🍏 n/a 🍎 n/a n/a n/a n/a n/a
Add many small files (balanced) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add large file (balanced) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add small file (trickle) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add many small files (trickle) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add large file (trickle) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Cat small file (local) 🍏 n/a 🍎 n/a n/a n/a n/a n/a
Cat small file (tcp, mplex) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (websocket, mplex) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (webrtc, mplex) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat small file (tcp, mplex, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (websocket, mplex, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (webrtc, mplex, secio) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat small file (tcp, spdy) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (websocket, spdy) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (webrtc, spdy) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat small file (tcp, spdy, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (websocket, spdy, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (webrtc, spdy, secio) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat large file (local) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Cat large file (tcp, mplex) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (websocket, mplex) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (webrtc, mplex) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat large file (tcp, mplex, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (websocket, mplex, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (webrtc, mplex, secio) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat large file (tcp, spdy) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (websocket, spdy) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (webrtc, spdy) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat large file (tcp, spdy, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (websocket, spdy, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (webrtc, spdy, secio) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
MFS write small file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write many small files (10k+) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write large file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write to dir with < 1,000 files 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write to dir with > 1,000 files 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write to deeply nested dir 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS read a small file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS read a large file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS cp a file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS mv a file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS rm a file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS stat a file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Pubsub publish & receive a message n/a 🍎 n/a 🍎 🍎 🍎 n/a n/a
Pubsub publish & receive 1k messages n/a 🍎 n/a 🍎 🍎 🍎 n/a n/a

key


  • 🍏 - test exists
  • 🍎 - test not exists

  • js0 -> js0 - A local test from one JS IPFS node to the same node
  • js0 -> js1 - A test between two JS IPFS nodes
  • go0 -> go0 - For comparison with js0 -> js0
  • go0 -> go1 - For comparison with js0 -> js1
  • js0 -> go0 - A test between a JS IPFS node and a Go IPFS node
  • go0 -> js0 - For comparison with js0 -> go0
  • js01234 -> js5 - A test from multiple JS IPFS nodes to a single JS IPFS node
  • go01234 -> go5 - For comparison with js01234 -> js5

JS IPFS in the browser

Test js0 -> js0 js0 -> js1 go0 -> go0 go0 -> go1 js0 -> go0 go0 -> js0 js01234 -> js5 go01234 -> go5
Node initialization 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add small file (balanced) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add many small files (balanced) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add large file (balanced) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add small file (trickle) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add many small files (trickle) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Add large file (trickle) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Cat small file (local) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Cat small file (websocket, mplex) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (webrtc, mplex) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat small file (websocket, mplex, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (webrtc, mplex, secio) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat small file (websocket, spdy) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (webrtc, spdy) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat small file (websocket, spdy, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat small file (webrtc, spdy, secio) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat large file (local) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Cat large file (websocket, mplex) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (webrtc, mplex) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat large file (websocket, mplex, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (webrtc, mplex, secio) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat large file (websocket, spdy) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (webrtc, spdy) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
Cat large file (websocket, spdy, secio) n/a 🍎 n/a 🍎 🍎 🍎 🍎 🍎
Cat large file (webrtc, spdy, secio) n/a 🍎 n/a n/a n/a n/a 🍎 n/a
MFS write small file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write many small files (10k+) 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write large file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write to dir with < 1,000 files 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write to dir with > 1,000 files 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS write to deeply nested dir 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS read a small file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS read a large file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS cp a file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS mv a file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS rm a file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
MFS stat a file 🍎 n/a 🍎 n/a n/a n/a n/a n/a
Pubsub publish & receive a message n/a 🍎 n/a 🍎 🍎 🍎 n/a n/a
Pubsub publish & receive 1k messages n/a 🍎 n/a 🍎 🍎 🍎 n/a n/a

Future test suggestions

  1. DHT (not yet in JS IPFS) - what would be a good way to test this?
  2. Tests via a relay node
  3. Tests for IPNS publish and resolve (not yet in JS IPFS)

Notes

IPFS nodes in benchmark tests should:

  1. Not connect to bootstrap nodes (https://github.com/ipfs/js-ipfs#optionsconfig)
  2. Have preloading disabled (https://github.com/ipfs/js-ipfs#optionspreload)
  3. Disable discovery

For connecting peers you'll need to use the ipfs.swarm.connect API.

TODO instructions for enabling different transports in both browsers - for JS IPFS see https://github.com/ipfs/js-ipfs#optionslibp2p

For browser tests you'll need to run a rendezvous server:

@jacobheun
Copy link

This is a good start, I think more benchmarks for moving the files around with the varying configurations will be helpful for seeing where things fall over. (I think there are some existing issues with go-libp2p-spdy failing with large data, for example).

For things like DHT and pubsub, we have some goals in libp2p land to get some scaling performance tests together. Vasco is working on some DHT stress testing (with js-ipfs) already https://github.com/vasco-santos/iptb-dht-test via IPTB. We're still a bit away from being able to benchmark the performance tests, but that's our end goal. Our goal is try to find out where libp2p itself has problems and so that we can compare various network states, such as: what happens when we turn relay on by default everywhere. I think that work will supplement this nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment