-2

we are currently developing a chat (like facebook, with stored messages). at the moment, theres a minimum of 500 online users (its a dating website) and at the peak there is a max of 3000 users simultanously online.

switching to websockets is "the thing" for us, but while using the gem "websocket-rails" we fear a little the performance.reading articles like https://www.igvita.com/2008/11/13/concurrency-is-a-myth-in-ruby/ is causing some doubts.

so our question is:

does websocket-rails is killing our application or not? the other choice would be running a jsnode server and switch to faye which shouldnt be a problem in our scalabitliy. does somebody is having any expereince with the scalability of websocket-rails?

Arvind
  • 2,671
  • 1
  • 18
  • 32
Tim Kretschmer
  • 2,272
  • 1
  • 22
  • 35
  • It might be a little tedious, but it might be best if you create a small simulation in which you have a few VMs/clients smashing your server with 3000 + concurrent connections while measuring the real-world server load. Articles like the one you posted do point out one of rails' big weaknesses--blocking io--but you might find that your servers will survive fine. Having a simulation script might also allow you to measure the "breaking point" on your rails system, which might be significantly above your expected customer throughput – Adam Kewley Aug 23 '15 at 11:11
  • can you give me any input where i can read more about how to create such a simulation? never did before :( – Tim Kretschmer Aug 23 '15 at 11:12

1 Answers1

0

The GIL is still here, but should not be the main issue. The main problem is that the Rails approach does not fit well in a massive chat approach.

My suggestion is to switch to event machine for this specific part, and still use websocket (or others push mechanism, like pusher), and use this kind of WebSocket EventMachine Client.

You will be then event driven, with a single ruby thread and you still can use all the others rails existing libraries (that's the node.js model)

tomsoft
  • 4,448
  • 5
  • 28
  • 35
  • we wont use external stuff, we want to save that money. so you recommend to have a try with an own node.js server? – Tim Kretschmer Aug 23 '15 at 11:27
  • node, I recommend you to use EventMachine, which is a ruby event based approach + a websocket connection (you can do it by yourself ). It's the best approach in my opinion to do a chat in a rails based environment . – tomsoft Aug 23 '15 at 11:29