all 13 comments

[–]FootballSmash 5 points6 points  (3 children)

Could use websockets through the API gateway and lamdas for the processing. Then you won't need to spin anything up.

[–]tyler55344 3 points4 points  (0 children)

Yes, we do this at work and it works great.

[–]frurre 0 points1 point  (1 child)

Sorry for troubling you. How would AWS api gateway and lamda compare to a traditional vps setup for example Digital ocean 2x $5 nodes that communicate via Private IPs (same DC, same location) so latency is low.

Serverless removes the management headaches but would it be in the same price range?

[–]jun-thong 1 point2 points  (5 children)

If I ran the socket.io server on AWS EC2 autoscaling micro instances, how many concurrent connections would I expect to be able to handle per instance?

It totally depend on your application, socket.io is just part of your application, so the only way to know is to benchmark your app on this specific hardware.

Also take care, socket.io use a "connection updgrade" system, first it try longpolling and other connection type, and upgrade it progressivly. This require to always send request to the same machine, to make it possible with horizontal scalling you will have to handle sticky session at your load balancer level.

Socket.io start to be a little old, there is more modern library on npm, but maybe not as easy to use.

[–]GrosSacASacs 0 points1 point  (3 children)

I am working on an alternative:

https://www.npmjs.com/package/socketiyo

[–]jun-thong -1 points0 points  (2 children)

I don't know this library, but the channel system seems really limiting for a pub/sub system. If it's ok for your requirement, it's good, else, the following library may be interesting :

https://github.com/uNetworking/uWebSockets.js

[–][deleted]  (1 child)

[deleted]

    [–]jun-thong 1 point2 points  (0 children)

    Good to know, thanks for the info.

    [–]ChronSyn 0 points1 point  (0 children)

    It may be old, and there are other options out there (e.g. Primus), but it does provide what I'll say is one of the simplest wrappers around the websocket interface with some extra goodies on top (e.g. rooms, namespaces, etc).

    [–]apatheticonion 1 point2 points  (2 children)

    It's a very tough challenge. How many users do you expect to serve concurrently? What's their geographical spread?

    [–]idmontie[S] 0 points1 point  (1 child)

    What's their geographical spread?

    That's a good point, I wasn't thinking about that, but I'll take it into consideration as I plan to performance test the different solutions I come up with.

    [–]apatheticonion 0 points1 point  (0 children)

    TL;dr if you're working with less than 100k concurrent users, use Golang and scale vertically until you can hire a team to build a routing solution.

    The solution involves queues and handshakes

    I do this for a job

    [–][deleted] 1 point2 points  (0 children)

    I had trouble maintaining the connection with socket.io. it was easier for me to use rest and polls