gritzko / swarm

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

Scuttlebutt vs swarm? #41

Open nwmcsween opened 9 years ago

nwmcsween commented 9 years ago

What are the major differences between https://github.com/dominictarr/scuttlebutt and swarm?

chicoxyzzy commented 9 years ago

@nwmcsween thank you for link I'll take a look! I just found out bunch of bad js practices in swarm sources. People behind scuttlebutt are respectable by GitHub js community. I think @gritzko also should take a look at scuttlebutt and possibly collaborate with scuttlebutt team.

nwmcsween commented 9 years ago

scuttlebutt is effectively done as the developer(s) has said CRDT's cannot prove authorship and instead moved to a signed log of messages style protocol (secure-scuttlebutt) which removes all use of it client side.

gritzko commented 9 years ago

@chicoxyzzy Sergey, can you please detail on bad practices you noticed?

gritzko commented 9 years ago

@nwmcsween Is Scuttlebutt gossip-only? Swarm builds dynamic spanning trees. Swarm is op-based, not state-based CRDT. Swarm's use case is syncing in web&mobile apps.

chicoxyzzy commented 9 years ago

@gritzko sure. I'll make a PR soon. BTW can I contact you in some messenger?

gritzko commented 9 years ago

Sure. My Skype handle is gritzko.

jeregrine commented 9 years ago

I'm not sure scuttlebut is an effective alternative. To use scuttlebut safely you need to use scuttle-ssb to use that you need to use scuttle-bot to use that you need to use their phoenix framework. SO :grimacing: not sure if they are even

jeregrine commented 9 years ago

also @chicoxyzzy I am interested in helping with the cleanup as well. Wanna try to break it up into tasks and we can pick them off?

chicoxyzzy commented 9 years ago

@jeregrine sounds cool. I'll try to post my list of things to improve soon. @gritzko what do you think about some huge refactoring of swarm and decoupling it into some (possibly independent i.e. #37 for example) modules? P.S. still waiting for your accept of contact request in Skype

gritzko commented 9 years ago

@chicoxyzzy We had some ideas of decoupling, just considered it too early at the time. For example, each kind of storage should be a package, etc. What is your Skype handle? Ironically, Skype sync sucks, so your request may be blinking somewhere on an iPad on a shelf in a different city.

jeregrine commented 9 years ago

Might be easier to setup a #swarmjs irc channel on freenode :)

On Wed, Jan 7, 2015 at 10:27 AM, Victor Grishchenko notifications@github.com wrote:

@chicoxyzzy We had some ideas of decoupling, just considered it too early at the time. For example, each kind of storage should be a package, etc.

What is your Skype handle? Ironically, Skype sync sucks, so your request may be blinking somewhere on an iPad on a shelf in a different city.

Reply to this email directly or view it on GitHub: https://github.com/gritzko/swarm/issues/41#issuecomment-69047292

gritzko commented 9 years ago

OK, grabbed #swarmjs on freenode

qfox commented 9 years ago

Maybe gitter will be easier to access with github account? It's free for opensource. https://gitter.im/gritzko/swarm

jeregrine commented 9 years ago

@zxqfox @chicoxyzzy We are on #swarmjs on freenode http://webchat.freenode.net/?channels=swarmjs couple folks on right now :)

chicoxyzzy commented 9 years ago

+1 for gitter instead of irc

riston commented 9 years ago

I like the idea of using gitter.im more than using IRC. The reason is that the gitter allows reading the chat history easily, also it's free but only the owners(@gritzko) are allowed to create chat.

ile commented 9 years ago

@gritzko - you said that swarmjs is op based CRDT, which sounds great (i'm thinking about the op basedness now), but just I took a look (on http://ppyr.us/) what goes on the wire (Chrome developer tools/Network and check the frames in websocket connection).

And it seemed like it sends the whole "data item" at the same time, not just the operation like in OT. As in OT there would only be one character sent (+ the required overhead). Here I saw the whole line of text in TodoMVC sent.

So I'm thinking about the efficiency, i.e. when editing a large document. Would it send the whole document every time I make one character edit? Does op in CRDT mean sending the "whole data item"?

Hope my question is clear and hope it's ok to ask here.

Thanks.

gritzko commented 9 years ago

@ile In the TodoMVC demo, text entries are handled as plain Strings. Hence, those are sent all at once. The reason is that todo entries are short and the overhead of maintaining versioned text simply does not worth it. Although from the UX perspective, it makes some sense to use mergeable strings (lib/Text.js). It was a small simple demo, after all.

When using versioned text, it sends something like this:

{"/Host#A002M8!0.on":""}    24  10:15:40.414
{"/Host#swarm~nodejs!2kmMS+swarm~nodejs.reon":46077340478}  58  10:15:40.468

{"/SlimText#2kmM6+A002M8!2kmMS+A002M8.on":"!2kmMB03+A002M8"}    60  10:15:40.522
{"/SlimText#2kmM6+A002M8!2kmMS+A002M8.reon":"!2kmMB03+A002M8"}  62  10:15:40.615

{"/SlimText#2kmM6+A002M8!2kmMW+A002M8.in":"2kmMB03+A002M8\t1"}  62  10:15:

Here you can see an actual 0.3 handshake (host to host) then an object sync handshake (no data passed, the object is in the local cache already) then one actual insert op:

2kmMB03+A002M8 1

"1" is inserted after symbol 2kmMB03+A002M8 The id for the new symbol is 2kmMW+A002M8 A002M8 is the current user (some numbered anonymous) 2kmMW is seconds since epoch in Base64 (which is 1.1.2010 in that version, AFAIR)

ile commented 9 years ago

Ok, thanks @gritzko! Looks good then.

I will have to play with Swarm.js more then, and see if I will integrate it with Derby (http://derbyjs.com/), thus replacing OT in ShareJS. I got the feeling that CRDT offers some advantages over OT that may make this a good move.

Seeking for the even holier grail, as there are some nice features in Derby :)

gritzko commented 9 years ago

@ile that is very interesting to know, actually. What Derby features do you consider the nicest?

vmakhaev commented 9 years ago

Compared to Swarm, RacerJS (Derby's model, based on ShareJS) has two pros: 1) Ability to subscribe to db queries (Mongo queries mostly). Btw, is it planed in Swarm? 3) General JSON-type, which has object ops, array ops, string ops, number ops. What it lacks is offline, which is tricky to implement in OT.