You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have initialized an IPFS node in my browser using the Helia package with persistence enabled. As the peerstore grows (currently over 5,000 peers), the memory consumption has reached 1GB. Despite spending dozens of hours reviewing the Helia and js-libp2p documentation, I haven't found an effective way to manage these resources. Specifically, I am struggling with reducing the number of storage peers and managing the current memory usage.
Environment:
Browser version: Google Chrome 123.0.6312, Microsoft Edge 123.2420
I have continued to monitor the memory usage impact of the peerStore, and through some debugging, I've noticed a significant decrease in memory usage when I remove the following monitoring code:
setInterval(async()=>{constpeers=awaithelia.libp2p.peerStore.all();console.log(`Total number of store peers: ${peers.length}`);console.log('Connected peers count:',helia.libp2p.getPeers().length);},5000);
I guess this may be due to the fact that the relevant functions will create new objects and the timing of GC... Continuous monitoring may not be advisable?
Despite this improvement, I remain concerned about the peerStore's potential continuous growth without explicit limits or clear options for management.
@orwithout If you have a very large peer store, your setInterval is loading the entire content of the peerstore, that you have configured to store in new IDBDatastore('/datastore2'), every 5 seconds. So it makes sense that memory would show as consistently "high" in this case.
In order to not load all peers into memory, there are a few options:
I have initialized an IPFS node in my browser using the Helia package with persistence enabled. As the peerstore grows (currently over 5,000 peers), the memory consumption has reached 1GB. Despite spending dozens of hours reviewing the Helia and js-libp2p documentation, I haven't found an effective way to manage these resources. Specifically, I am struggling with reducing the number of storage peers and managing the current memory usage.
Environment:
Attempts to Resolve:
Documentation Reviewed:
Configurations Tried:
I am seeking advice on how to automatically clean up the number of stored peers or set a cap on it.
The text was updated successfully, but these errors were encountered: