I'm currently working with DerbyJS because it fosters clean, DRY client/server code. The side-benefit (main reason why most people use the framework) is it uses Socket.IO to create realtime apps. In this case, I don't need realtime, but it is a nice addition.
My question is - am I sacrificing scalability/performance by using Socket.IO, and all those open connections it maintains? Would using Backbone + ExpressJS free up resources since there are no open connections?
Once you reboot your machine, you will now be able to happily go to 55k concurrent connections (per incoming IP).
As we saw in the performance section of this article, a Socket.IO server can sustain 10,000 concurrent connections.
Socket.IO is way more than just a layer above WebSockets, it has different semantics (marks messages with name), and does failovers to different protocols, as well has heartbeating mechanism. More to that attaches ID's to clients on server side, and more. So it is not just a wrapper, it is full-featured library.
Keeping a bunch of open connections obviously has some cost in terms of server overhead, but I wouldn't worry about concerns like this unless you have an obvious scaling problem. Once you have an obvious scaling problem, you should have enough income to buy more server resources. Servers are very cheap and your time is very expensive. Don't worry about optimizing the small stuff.
am I sacrificing scalability/performance by using Socket.IO, and all those open connections it maintains?
If you want update your page(dynamic page) immediately when new information is available. Then keeping the connection open using non-blocking io is the most efficient way to do this . Luckily node.js does use non-blocking io. That is one of the reasons that node.js is so popular(plus that you can code in JavaScript, which is the most popular programming language). If you really don't need it(also in the future) because your website is rather static(not realtime like you said) then closing the connection will save you resources.
Would using Backbone + ExpressJS free up resources since there are no open connections?
I would look at the cost(development time) to develop your website using backbone/express combination versus derbyjs.
Then again like Nate mentioned Socket.io can handle many(1000+) concurrent connections easily. If it is easier to developed using derbyJS then I would use that. When you cross that road you can always decide to add more servers or redesign(could hire extra programmers) your website to use express/backbone combination. First try to get at a point where users find your website valuable with the smallest amount effort(time to develop).
P.S: I think you should try to keep your system as modular as possible so that replacing Derby.js for something else can be done with the least amount of time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With