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

feature: ability to override default bitswap max message size #152

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d1a13f2
feature: ability to override default bitswap max message size
ya7ya Sep 27, 2017
bd50ee3
setting a minimum msg size, tests for go-interop and variable msg siz…
ya7ya Oct 12, 2017
339503d
chore: update deps
daviddias Oct 24, 2017
751d436
fix: add missing multicodec dependency (#155)
pgte Nov 8, 2017
fa797a0
chore: update deps
daviddias Nov 8, 2017
1a62f49
chore: update contributors
daviddias Nov 8, 2017
ab69719
chore: release version v0.17.3
daviddias Nov 8, 2017
a8b1e07
feat: windows interop (#154)
richardschneider Nov 10, 2017
1eea363
chore: update contributors
daviddias Nov 10, 2017
91aaedc
chore: release version v0.17.4
daviddias Nov 10, 2017
f2c8ea2
chore: update deps
daviddias Nov 23, 2017
6886a59
chore: updating CI files (#157)
victorb Nov 27, 2017
17e15d0
feat: stats improvements (#158)
pgte Nov 27, 2017
519e2a9
test: port go tests (#159)
pgte Dec 15, 2017
095f467
chore: update contributors
daviddias Dec 15, 2017
349b3bc
chore: release version v0.18.0
daviddias Dec 15, 2017
8e91def
fix: getMany: ensuring we set the want list (#162)
pgte Jan 28, 2018
ff978d0
feat: per-peer stats (#166)
pgte Feb 6, 2018
b349085
feat: added getMany performance tests (#164)
pgte Feb 6, 2018
89b263a
chore: update deps
daviddias Feb 6, 2018
1fc73b4
chore: update contributors
daviddias Feb 6, 2018
f090590
chore: release version v0.18.1
daviddias Feb 6, 2018
37f19cf
feature: ability to override default bitswap max message size
ya7ya Sep 27, 2017
114c4cf
setting a minimum msg size, tests for go-interop and variable msg siz…
ya7ya Oct 12, 2017
f9d21c4
Merge branch 'feat/message-size' of github.com:ya7ya/js-ipfs-bitswap …
ya7ya Feb 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ test/test-repo-for*
docs

test/test-repo/datastore

*.flamegraph
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
sudo: false
language: node_js

Expand All @@ -14,7 +15,6 @@ script:
- npm run lint
- npm run test
- npm run coverage
- make test

before_script:
- export DISPLAY=:99.0
Expand Down
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
<a name="0.18.1"></a>
## [0.18.1](https://github.com/ipfs/js-ipfs-bitswap/compare/v0.18.0...v0.18.1) (2018-02-06)


### Bug Fixes

* getMany: ensuring we set the want list ([#162](https://github.com/ipfs/js-ipfs-bitswap/issues/162)) ([8e91def](https://github.com/ipfs/js-ipfs-bitswap/commit/8e91def))


### Features

* added getMany performance tests ([#164](https://github.com/ipfs/js-ipfs-bitswap/issues/164)) ([b349085](https://github.com/ipfs/js-ipfs-bitswap/commit/b349085))
* per-peer stats ([#166](https://github.com/ipfs/js-ipfs-bitswap/issues/166)) ([ff978d0](https://github.com/ipfs/js-ipfs-bitswap/commit/ff978d0))



<a name="0.18.0"></a>
# [0.18.0](https://github.com/ipfs/js-ipfs-bitswap/compare/v0.17.4...v0.18.0) (2017-12-15)


### Features

* stats improvements ([#158](https://github.com/ipfs/js-ipfs-bitswap/issues/158)) ([17e15d0](https://github.com/ipfs/js-ipfs-bitswap/commit/17e15d0))



<a name="0.17.4"></a>
## [0.17.4](https://github.com/ipfs/js-ipfs-bitswap/compare/v0.17.3...v0.17.4) (2017-11-10)


### Features

* windows interop ([#154](https://github.com/ipfs/js-ipfs-bitswap/issues/154)) ([a8b1e07](https://github.com/ipfs/js-ipfs-bitswap/commit/a8b1e07))



<a name="0.17.3"></a>
## [0.17.3](https://github.com/ipfs/js-ipfs-bitswap/compare/v0.17.2...v0.17.3) (2017-11-08)


### Bug Fixes

* add missing multicodec dependency ([#155](https://github.com/ipfs/js-ipfs-bitswap/issues/155)) ([751d436](https://github.com/ipfs/js-ipfs-bitswap/commit/751d436))



<a name="0.17.2"></a>
## [0.17.2](https://github.com/ipfs/js-ipfs-bitswap/compare/v0.17.1...v0.17.2) (2017-09-07)

Expand Down
117 changes: 117 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,94 @@ Loading this module through a script tag will make the `IpfsBitswap` object avai

See https://ipfs.github.io/js-ipfs-bitswap

### Stats

```js
const bitswapNode = // ...

const stats = bitswapNode.stat()
```

Stats contains a snapshot accessor, a moving average acessor and a peer accessor.

Besides that, it emits "update" events every time it is updated.

```js
stats.on('update', (stats) => {
console.log('latest stats snapshot: %j', stats)
})
```

#### Peer accessor:

You can get the stats for a specific peer by doing:

```js
const peerStats = stats.forPeer(peerId)
```

The returned object behaves like the root stats accessor (has a snapshot, a moving average accessors and is an event emitter).

#### Global snapshot accessor:

```js
const snapshot = stats.snapshot
console.log('stats: %j', snapshot)
```

the snapshot will contain the following keys, with the values being [Big.js](https://github.com/MikeMcl/big.js#readme) instances:

```js
// stats: {
// "dataReceived":"96",
// "blocksReceived":"2",
// "dataReceived":"96",
// "dupBlksReceived":"0",
// "dupDataReceived":"0",
// "blocksSent":"0",
// "dataSent":"0",
// "providesBufferLength":"0",
// "wantListLength":"0",
// "peerCount":"1"
// }
```

#### Moving average accessor:

```js
const movingAverages = stats.movingAverages
```

This object contains these properties:

* 'blocksReceived',
* 'dataReceived',
* 'dupBlksReceived',
* 'dupDataReceived',
* 'blocksSent',
* 'dataSent',
* 'providesBufferLength',
* 'wantListLength',
* 'peerCount'

```js
const dataReceivedMovingAverages = movingAverages.dataReceived
```

Each one of these will contain one key per interval (miliseconds), being the default intervals defined:

* 60000 (1 minute)
* 300000 (5 minutes)
* 900000 (15 minutes)

You can then select one of them

```js
const oneMinuteDataReceivedMovingAverages = dataReceivedMovingAverages[60000]
```

This object will be a [movingAverage](https://github.com/pgte/moving-average#readme) instance.

## Development

### Structure
Expand Down Expand Up @@ -83,6 +171,35 @@ src
└── index.js
```

## Performance tests

You can run performance tests like this:

```
$ npm run benchmarks
```

### Profiling

You can run each of the individual performance tests with a profiler like 0x.

To do that, you need to install 0x:

```bash
$ npm install 0x --global
```

And then run the test:

```bash
$ 0x test/benchmarks/get-many
```

This will output a flame graph and print the location for it.
Use the browser Chrome to open and inspect the generated graph.

![Flame graph](https://ipfs.io/ipfs/QmVbyLgYfkLewNtzTAFwAEMmP2hTJgs8sSqsRTBNBjyQ1y)

## Contribute

Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-bitswap/issues)!
Expand Down
29 changes: 29 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
version: "{build}"

environment:
matrix:
- nodejs_version: "6"
- nodejs_version: "8"

matrix:
fast_finish: true

install:
# Install Node.js
- ps: Install-Product node $env:nodejs_version

# Upgrade npm
- npm install -g npm

# Output our current versions for debugging
- node --version
- npm --version

# Install our package dependencies
- npm install

test_script:
- npm run test:node

build: off
2 changes: 2 additions & 0 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
javascript()
15 changes: 15 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
machine:
node:
version: stable

dependencies:
pre:
- google-chrome --version
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome.deb || true
- sudo apt-get update
- sudo apt-get install -f
- sudo apt-get install --only-upgrade lsb-base
- sudo dpkg -i google-chrome.deb
- google-chrome --version
74 changes: 44 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": "ipfs-bitswap",
"version": "0.17.2",
"version": "0.18.1",
"description": "Node.js implementation of the Bitswap data exchange protocol used by IPFS",
"main": "src/index.js",
"browser": {
"./test/utils/create-libp2p-node": false,
"./test/utils/create-temp-repo-nodejs.js": "./test/utils/create-temp-repo-browser.js"
},
"scripts": {
"test": "aegir test --target node --target browser",
"test:browser": "aegir test --target browser",
"test:node": "aegir test --target node",
"test": "aegir test -t node -t browser",
"test:browser": "aegir test -t browser",
"test:node": "aegir test -t node",
"lint": "aegir lint",
"release": "aegir release",
"release-minor": "aegir release --type minor",
"release-major": "aegir release --type major",
"bench": "node benchmarks/index",
"build": "aegir build",
"coverage": "aegir coverage -u",
"docs": "aegir docs"
"coverage": "aegir coverage --provider codecov",
"docs": "aegir docs",
"benchmarks": "node test/benchmarks/get-many"
},
"repository": {
"type": "git",
Expand All @@ -37,30 +38,35 @@
},
"homepage": "https://github.com/ipfs/js-ipfs-bitswap#readme",
"devDependencies": {
"aegir": "^12.0.6",
"aegir": "^12.4.0",
"benchmark": "^2.1.4",
"chai": "^4.1.2",
"dirty-chai": "^2.0.1",
"ipfs-repo": "~0.17.0",
"libp2p": "~0.12.3",
"libp2p-kad-dht": "~0.5.0",
"libp2p-multiplex": "~0.5.0",
"libp2p-secio": "~0.8.1",
"libp2p-tcp": "~0.11.0",
"lodash": "^4.17.4",
"multiaddr": "^3.0.1",
"ipfs-repo": "~0.18.7",
"libp2p": "~0.15.2",
"libp2p-kad-dht": "~0.6.3",
"libp2p-multiplex": "~0.5.1",
"libp2p-secio": "~0.9.1",
"libp2p-tcp": "~0.11.2",
"lodash": "^4.17.5",
"lodash.range": "^3.2.0",
"lodash.without": "^4.4.0",
"multiaddr": "^3.0.2",
"ncp": "^2.0.0",
"peer-book": "~0.5.0",
"peer-id": "~0.10.0",
"peer-info": "~0.11.0",
"rimraf": "^2.6.1",
"safe-buffer": "^5.1.1"
"peer-book": "~0.5.4",
"peer-id": "~0.10.5",
"peer-info": "~0.11.6",
"pre-commit": "^1.2.2",
"rimraf": "^2.6.2",
"safe-buffer": "^5.1.1",
"stats-lite": "^2.1.0"
},
"dependencies": {
"async": "^2.5.0",
"cids": "~0.5.1",
"debug": "^3.0.1",
"ipfs-block": "~0.6.0",
"async": "^2.6.0",
"big.js": "^5.0.3",
"cids": "~0.5.2",
"debug": "^3.1.0",
"ipfs-block": "~0.6.1",
"lodash.debounce": "^4.0.8",
"lodash.find": "^4.6.0",
"lodash.groupby": "^4.6.0",
Expand All @@ -70,25 +76,33 @@
"lodash.sortby": "^4.7.0",
"lodash.uniqwith": "^4.5.0",
"lodash.values": "^4.3.0",
"multihashing-async": "~0.4.6",
"protons": "^1.0.0",
"pull-defer": "^0.2.2",
"moving-average": "^1.0.0",
"multicodec": "~0.2.6",
"multihashing-async": "~0.4.7",
"protons": "^1.0.1",
"pull-defer": "~0.2.2",
"pull-length-prefixed": "^1.3.0",
"pull-pushable": "^2.1.1",
"pull-stream": "^3.6.0",
"pull-pushable": "^2.1.2",
"pull-stream": "^3.6.1",
"safe-buffer": "^5.1.1",
"varint-decoder": "^0.1.1"
},
"pre-commit": [
"lint",
"test"
],
"contributors": [
"David Dias <[email protected]>",
"Dmitriy Ryajov <[email protected]>",
"Friedel Ziegelmayer <[email protected]>",
"Pedro Teixeira <[email protected]>",
"Richard Littauer <[email protected]>",
"Richard Schneider <[email protected]>",
"Stephen Whitmore <[email protected]>",
"dmitriy ryajov <[email protected]>",
"greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>",
"greenkeeperio-bot <[email protected]>",
"npmcdn-to-unpkg-bot <[email protected]>"
"npmcdn-to-unpkg-bot <[email protected]>",
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <[email protected]>"
]
}
Loading