ipfs / js-ipfs-bitswap

JavaScript implementation of Bitswap 'data exchange' protocol used by IPFS
Other
69 stars 48 forks source link

Bitswap stats #90

Closed daviddias closed 7 years ago

daviddias commented 7 years ago

stats (exchanged byteCount and so on) kind of don't have any self-guards to overflowing

I believe that we should have a way for stats to be disabled and at the same time, make it so they are updated asynchronously, these are just shared values that are mutated with incrementations, which makes it very safe to defer.

Another things is to use a bignum library, otherwise it will get weird in long-running nodes.

dignifiedquire commented 7 years ago

I agree with using bignumbers for stats, I don't see any reason why we would want an option to disable them though.

pgte commented 7 years ago

On this note, to minimize polling, the stats object could be an event emitter, emitting an event when there is a change..

pgte commented 7 years ago

Also, regarding the counters (blocksReceived, dupBlocksReceived and dupDataReceived), I think we could have moving stats (1, 5 15 mins) - average and stddev. What do you say?

daviddias commented 7 years ago

Done with https://github.com/ipfs/js-ipfs-bitswap/pull/158