Skip to content

[switch] Number of Stat objects created #434

@mcollina

Description

@mcollina

When running https://github.com/ipfs/benchmarks/blob/master/tests/local-transfer.js:

$ STAGE=local REMOTE=true FILESET=One64MBFile VERIFYOFF=true node local-transfer.js

That test uses only 2 peers.

I'm seeing around 44 Stats object being created, each one with their respective timer. Consider that at best (with libp2p/js-libp2p-switch#289), this means 44 events being fired every 2 seconds (the default). This is a lot of activity happening just to exists.

What is rationale behind keeping track of all those values? Are all these stats needed?

I've been looking at https://github.com/libp2p/js-libp2p-connection-manager/blob/0634c9116a3f708d3eb788ad7567022ec1f76195/src/index.js#L82, and the only Stats object that is needed is the global one https://github.com/libp2p/js-libp2p-switch/blob/f43084b93a1c048d68f7992357e3116029732ce2/src/stats/index.js#L40. Could the per-peer and per-transport stats be a) removed or b) put behind a flag?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions