Hello everybody recently i have hosted website with ens and ipns. Everything is great except speed. I pinned my ipns from my desktop client. Also i tried services like pinata and temporal that offer pinning for content but they only work with ipfs hashes. Of course i can change ens to host ipfs hash but with recent gas prices it cost me 8$ to update hash everytime… So my question is what can i do to make ipns be faster served? Will starting ipfs cluster help? Connecting my node to more peers? It would be great if someone can point me to some article that addresses that or documentation where i can learn more!
IPNS hash shouldn’t change when the content changes… just publish the new content to whichever key you used.
Check out the help option via command line for an example:
ipfs name --help Examples: Publish an <ipfs-path> with your default name: > ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy Publish an <ipfs-path> with another name, added by an 'ipfs key' command: > ipfs key gen --type=rsa --size=2048 mykey > ipfs name publish --key=mykey /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy Published to QmSrPmbaUKA3ZodhzPWZnpFgcPMFWF4QsxXbkWfEptTBJd: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
I would try starting your IPFS daemons (both the record publisher and the retrievers) with
--enable-namesys-pubsub that should make things much faster (see https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#ipns-pubsub for more information)
If you want to stick with DHT based resolution there are number of options you can use to make your IPNS resolution faster. In particular you can do
ipfs name resolve --stream to get the results as they arrive and
ipfs name resolve --dht-record-count=X to reduce the number of DHT records your node needs to receive before assuming it has the latest version of the record. (Note:
--dht-record-count currently has a bug that is fixed in the upcoming go-ipfs v0.7.0 release https://github.com/ipfs/go-ipfs/pull/7580)
i know it doesen’t change i just said that to make it faster i can just add ipfs hash insted of ipns but then i would have to pay 8 bucks everytime i update site…
thank you! i will dig into pubsub and dht deeper !
I have found that, rather than fetching everything with /ipns/[PeerID]/path, if I resolve the name to the root CID and access everything with /ipfs/[rootCID]/path it goes much faster. That way I can publish via the name for the mutability, but the app first resolves the name to the CID and uses /ipfs/[rootCID] from that point forward.
That has the added advantage that the app will get a consistent view of whatever ipns was published when it started and not get a mixed bag of files if a new version is published while the app is running.