Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getMany performance tests #164

Merged
merged 1 commit into from
Feb 6, 2018
Merged

getMany performance tests #164

merged 1 commit into from
Feb 6, 2018

Conversation

pgte
Copy link
Contributor

@pgte pgte commented Jan 27, 2018

Preparing benchmarks to then try solving #163

@ghost ghost assigned pgte Jan 27, 2018
@ghost ghost added the status/in-progress In progress label Jan 27, 2018
@pgte
Copy link
Contributor Author

pgte commented Jan 27, 2018

My performance results for .getMany():

10 nodes, 10 blocks, 5 iterations
started
all nodes connected to each other
..........++++++++++..........++++++++++..........++++++++++..........++++++++++..........++++++++++
stopping
stopped
stats:
---------
mean: 3601.06
median: 3827.5
variance: 3656466.8163999994
standard deviation: 1912.189011682684
85th percentile: 5596

@pgte
Copy link
Contributor Author

pgte commented Jan 27, 2018

Click to view flamegraph (Chrome only):

Flamegraph

@pgte
Copy link
Contributor Author

pgte commented Jan 27, 2018

A hot part is on the keypair dependency, which is used by libp2p-crypto:

→ npm ls keypair
ipfs-bitswap@0.18.0 /Users/pedroteixeira/projects/ipfs/js-ipfs-bitswap
└─┬ libp2p-kad-dht@0.6.0
  └─┬ libp2p-crypto@0.10.4
    └── keypair@1.0.1

@pgte
Copy link
Contributor Author

pgte commented Jan 29, 2018

By following the thread of the keypair hint, above, I found out that the DHT is making heavy use of the unmarshalling of the public key to validate records.
A significant performance boost can be found if I turn the DHT off.

For comparison, with DHT:

------------------------
10 nodes, 10 blocks, 5 iterations
started
all nodes connected to each other
..........++++++++++..........++++++++++..........++++++++++..........++++++++++..........++++++++++
stopping
stopped
stats:
---------
mean: 3605.32
median: 3811.5
variance: 4057299.777599999
standard deviation: 2014.2740075769234
85th percentile: 5777

without DHT:

------------------------
10 nodes, 10 blocks, 5 iterations
started
all nodes connected to each other
..........++++++++++..........++++++++++..........++++++++++..........++++++++++..........++++++++++
stopping
stopped
stats:
---------
mean: 874.7
median: 963.5
variance: 93265.29000000004
standard deviation: 305.39366398142585
85th percentile: 1091

It signifies a x6 improvement without DHT..

@pgte pgte changed the title WIP: added getMany performance tests getMany performance tests Jan 29, 2018
@pgte
Copy link
Contributor Author

pgte commented Jan 29, 2018

This PR adds some benchmarking infra and a getMany benchmark test.
We can continue the improvements on a different PR.

@pgte pgte requested a review from daviddias January 29, 2018 10:41
@daviddias daviddias merged commit b349085 into master Feb 6, 2018
@daviddias daviddias deleted the feat/benchmarks branch February 6, 2018 10:22
@ghost ghost removed the status/in-progress In progress label Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants