-
Notifications
You must be signed in to change notification settings - Fork 30
Sharing IPFS deamon (by default) across all the embedders #390
Comments
Created issues for radicle radicle-dev/radicle-alpha#677 |
Created issue for Textile https://github.com/textileio/photos-desktop/issues/37 |
I also just verified that data does not seem to be accessible across my local nodes, specifically IPFS Desktop IPLD explorer does not seem to manage to resolve CID for the content in my textile IPFS node, which is surprising as I would imagine it would at least manage to do it across the public gateway -> textile cafe, but even then it would be ridiculous to have to go through the cloud to access blocks that are in the same device. |
I believe go-libp2p-daemon aims to address some of that:
ROADMAP.md mentions relevant medium-term goals:
Mentioning @bigs @raulk @Stebalien @vyzo here in case plan changed or anything related could be linked in this issue
I agree, if nodes share DHT, then when running on the same host they should see each other immediately. IIRC we don't have any other mechanism for local discovery than "MDNS" (which is an issue on its own):
|
I agree with @lidel in that the |
@jkarni from radicle shared some interesting thoughts on the subject
If sharing node negatively affects performance that suggests that node is doing a poor job at prioritizing tasks. If node is conceptually idle, as in, it's not acting on other applications behalf it should be making submitted task higher priority that just being idle peer in the network. I think argument about disjoint pinsets is interesting and sound, however IPFS becomes integrated into more and more tools we use daily I don't think it will hold as there will be more overlap across peers we converse with. And if we consider that one might wish to mirror all of own data somewhere (for backup or uptime) likely that mirror node will need to connect to all the peers and sharing connections would be more optimal resource management. |
If most applications should do that seems like a good argument in favor of making this a default behavior of go-ipfs which they all embed. Otherwise everyone needs to solve the same problem. |
That is something that they have to do on their side and can't be built into |
Can you elaborate a bit on this please ? I'm happy to challenge "can't be built", but I suspect you don't meant to say technically impossible but rather some specific constraint which I may be unaware of. |
If I may interject. The Dat community is currently going through some similar developments. We're planning on having a high level API provided to developers which will automatically spawn a daemon behind the scenes and talk to it over RPC. We might use some of it ideas from the auto-daemon node module for this use. A big worry we have is how people will deal with different versions of the daemon. In the Secure Scuttlebutt community some applications opt to embed the daemon into themselves so that they can take advantage of new features without being blocked by other applications, for example. Breaking changes are a pretty big deal when it comes to this stuff, too. https://github.com/andrewosh/hyperdrive-daemon |
Flow type-checker does something that I find to be a reasonable compromise. At startup it checks if service process is running. If server and lunched flow instance are compatible (same version) it just connects to it. If there is a mismatch it offers a user a choice to either use different version of flow (as one ruining) or abort (I think offer to just run embedded one might be a better option). |
I mean if you have a I think it would reasonable to write a library that applications can use to detect a running Also, there is a bunch of issues if each application wants a differently configured daemon, which currently can only be solved by running a separate daemon. |
I believe both textile and radicle just spawn That could be another library, however I’m inclined to think that making it part of go-ipfs and make it default behavior (with opt out flag) would be a better out of the box configuration. Yes it’s not trivial as configurations may not be compatible, same as daemon versions and likely some isolation per embedder will require thinking and coming up with a defaults with reasonable compromises. But I think that needs to be done either way. If IPFS will ever be a native component of the OS distribution or part of browser where to share and where to separate will have to be figured out. And longer we ignore harder it will be to migrate growing number of users |
As of today, IPFS has support for running as a daemon. With some environment variables, the IPFS CLI will connect to that existing daemon via the HTTP API. All an application wishing to re-use an existing IPFS daemon needs to know is the URL for its HTTP endpoint. Applications wishing to reuse IPFS daemons--a good idea for situations when, as @lanzafame hinted, the applications are okay sharing a peer identity and configuration options--should optionally accept a URL for the daemon (or a path to the IPFS configuration, if you wanted.) This is all doable today. If you wish to have multiple peer identities within a single process, things get more complicated. We've talked about doing this in the libp2p daemon, and are interested in the idea for testing purposes, but don't have a definite timeline for it. |
This issue seems related. https://github.com/ipfs-rust/rust-ipfs/issues/136 It discusses some problems with the pin api when used by multiple applications. Some of those issues are:
|
I don't have answers but would like to share some notes / ideas I had around this. I also would be spending time in coming months on reducing resource usage of js-ipfs in browser context so that every single tab does not spin new node with separate connections etc... and this is highly relevant to me.
This are good questions. I think a lot can be learned from how web browsers are going about these things. While there is no exact equivalent of pinning there resource cashing layer and multiple origins (web pages) can link to. I would suggest that application de-install is somewhat similar to closing a browser tab. Browser does not know if that website will ever going to be accessed again and it uses certain heuristics to do cache eviction. Browsers are also use some user interactions to guide those decisions. e.g. web page can store data into indexdb but it's subject to cache eviction. On the other hand webapp can request to keep storage permanent through API on which browser will obtain user consent that both informs user and guides decisions what data is not subject for eviction.
It is worth looking at what sqlite does to enable multiple process work with the same data base (quoting for convenience)
I think that quote also points out interesting point about large database engines that have client/server architecture that seem to have a pretty high throughput so maybe something can be learned from there as well. |
This works because it's just a cache. Imagine a block from the kernel or systemd is garbage collected, which you need to boot your system. It is not unreasonable that this could happen in the future and it's on the long term roadmap for ipfs.
This only works if all applications are both correct and trustworthy. How do you prevent an application from corrupting the database or removing the data from other applications? I think I outlined a possible solution in the issue I linked that could work. And be made reasonably performant. Please punch holes into it if you can think of some! |
Problem
At the moment I have 3 IPFS nodes running on my machine embedded by following applications
And when I'll start test driving anytype I'll likely end up with 4 nodes.
It is not ideal, because:
Proposal
ipfs daemon
andipfs
tool and library should by default should attempt to discover if IPFS service is already running and if so just act as a frontend to it, otherwise spawn a service and still act as a frontend to it. That would make all embedders by default share same IPFS node. Dealing with version incompatibilities is going to be an interesting challenge, but even if this would address problem for same versioned nodes that would be a good step forward IMO.The text was updated successfully, but these errors were encountered: