Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider a move from socket.io to sockjs #1798

Closed
konklone opened this issue Jun 7, 2013 · 9 comments
Closed

Consider a move from socket.io to sockjs #1798

konklone opened this issue Jun 7, 2013 · 9 comments

Comments

@konklone
Copy link

konklone commented Jun 7, 2013

I want to know if there's enough community support to merit me submitting a PR porting Etherpad Lite from socket.io to sockjs.

I've had a couple of bad experiences running Etherpad Lite during public events now. It crumbles under pressure, even following best practices, instructions, using a beefy EC2 instance. The answer to this is surely multi-part, but I'm interested in starting this by switching to sockjs.

socket.io is not in a good place. It has hundreds of open issues and dozens of open PRs, and some of the open issues suggest terrifying performance problems. The team is working on engine.io as a replacement, but it's not clear what state that's in, and there's no community activity around it yet.

sockjs is a much lighter library - it's the bare minimum necessary on top of the raw WebSockets API that stil lets you fall back to older browsers. It uses streaming XHR instead of Flash for IE. It doesn't give you named events, or channels, or any sort of abstracted persistence store, but this means that the code surface for bugs is much, much smaller. It's maintained by one guy, @majek, who is responsive and smart and keeps things under control. Because sockjs is so small, there also really just isn't as much to maintain.

I haven't found many detailed benchmarks out there, just an occasional small one. Anecdotally, I recently did an ephemeral but high-traffic experiment at isitchristmas.com, and during development I experienced these performance and memory issues myself - I literally couldn't run a high traffic real-time site with socket.io. Switching to sockjs abated this and kept memory under control.

So I'd like to know if people think this is a good idea. I'm interested in doing the porting work, either alone or with help, but not if the PR is likely to be rejected.

@JohnMcLear
Copy link
Member

Simple answer. Do a stress test on socket.io, do the same stress test on sockjs and engineio and paste the results. Whichever performs and supports the most amount of edge cases wins.

We provide a C based load testing tool, just FYI :)

@kradan
Copy link

kradan commented Jul 3, 2013

Hey Eric,
I would like to test your code with sockjs.

Recently with around 20 participants we ran into issues with a 200 kb pad.
For my slow connection (40KB/s) SocketIO.js just took 90% of the cpu (assumingly waiting for data).

So I would love to help improving the performance of etherpad.

Thanks for all your great work!!!

@konklone
Copy link
Author

konklone commented Jul 3, 2013

@JohnMcLear Good to know about the load testing tool, I may ask you questions about that. (Didn't see that til now, since I think you added that via Edit, so I didn't get an email.)

@kradan Thanks! I was hoping to hear a little bit more from the community here, but I may as well go ahead. If/when I do, I'll let you know and point you to my fork.

@kradan
Copy link

kradan commented Jul 3, 2013

Great! To keep you motivated, i will send some friends here to cry for performance improvements from time to time.

I did some auditing some time ago and found that socketIO.js takes most of the cpu:

dp -> 80%
dk
br
bs
(anonymous function)
Ace2Inner.a.withCallbacks
I.applyChangesToBase
Ace2Inner.z.ace_applyChangesToBase
pad.js:22 (anonymous function)
pad.js:22 g -> 79%
pad.js:22 (anonymous function)
pad.js:22 (anonymous function)
pad.js:25 I -> 74 %
pad.js:3 (anonymous function)
socket.io.js:2 c.emit
socket.io.js:2 c.onPacket
socket.io.js:2 d.onPacket
socket.io.js:2 c.onPacket
socket.io.js:2 c.onData
socket.io.js:2 b -> takes 74% cpu load (389s/390s)

The used version was something around 1.2.10.

@vid
Copy link

vid commented Jul 5, 2013

in case this is helpful: https://medium.com/the-build/22af5c94a922

@konklone
Copy link
Author

konklone commented Jul 5, 2013

That is really interesting. And very new...and sockjs is extremely tiny. Offhand, I think that along with a socket.io->sockjs refactor, ensuring that all module-specific syntax stays as encapsulated as possible would take care of a lot of what Primus does. But I'm definitely open to it, especially if anyone can describe their experience using it.

@v0lkan
Copy link

v0lkan commented Aug 7, 2014

Hey, just jumping out of nowhere, to give my 2c:

Using engine.io might be another option; it looks like the whole socket.io team has focused their efforts on it; and it also looks like sock.js doesn't have too much activity for the last 3-4 months.

I'm also in between engine.io and sock.js for a high-throughput realtime project; and still haven't decided yet.

@JohnMcLear
Copy link
Member

Not migrating to Sock.JS, sorry.

@JohnMcLear
Copy link
Member

We upgraded to SocketIO 1+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants