gritzko / swarm

JavaScript replicated model (M of MVC) library
http://swarmdb.net/
MIT License
2.68k stars 97 forks source link

Serverless p2p example? #82

Closed lewisl9029 closed 8 years ago

lewisl9029 commented 8 years ago

I'm looking to give Swarm a spin in a p2p app, but the example in the readme appears to be for client-server sync.

Is p2p sync in a working state at the moment? What would we have to do differently in a p2p sync scenario compared to the client-server example?

Thank you for your work on this amazing library by the way! =)

gritzko commented 8 years ago

1.0 syncs by a tree of replicas. That allows for some great optimizations. In other words, it is impossible to sync to a random node. For random topology gossip, state based CvRDTs are much better. Swarm is an op based CmRDT system.

lewisl9029 commented 8 years ago

Thanks for the clarification.

Does this mean the p2p sync capability mentioned in http://swarmjs.github.io/articles/1of5/ is no longer feasible, or is it still on the roadmap for a future release?

gritzko commented 8 years ago

Given that some server exists somewhere and is available periodically, it is possible to do "shortcut syncing" between any two replicas. That feature is on the roadmap. Fully p2p sync was available in .3, but that feature is too expensive.

synctext commented 8 years ago

@gritzko Will it scale in the serverless usecase?

From your docs:

There is a bunch of political, engineering and usability arguments in favor of P2P architectures. Unfortunately, building P2P systems is order of magnitude harder.

Impressive project! Could a few million smartphones sync a single "Swarm"?

Note this critical review of Swarm: https://news.ycombinator.com/item?id=11146230 [Delft greetings]

gritzko commented 8 years ago

It will.