2

I am currently using Linode to deploy my application. I have 2 servers, 1 database server with 1 Load Balancer in front.

I am using Redis as the Database and NowJS to implement chat rooms. Everything works fine using Pub/Sub. Now, I want to use cluster to take advantage of multi-core server. However, when applying cluster, I ran into weird situation. Sometimes, the app works, sometimes it does not it is about 25% working and 75% not working (I ran 4 processes). Therefore, I can assume that cluster causes the nowJS to not working properly. Now, I have to make the decision

1.Switch to SocketIO and use RedisStore (can I still use pub/sub along with RedisStore for SocketIO ? or switch completely to RedisStore)

2.Forget about clustering and add more server if needed (Is it a waste of resources since multiple cores are not utilized)

P/s: I am sorry for my bad English, I am not native.

Tan Nguyen
  • 3,354
  • 3
  • 21
  • 18
  • I have recieved an email from the NowJS programmers and it said "While we do have a distributed version of NowJS already done and in use, we've got a new, bigger release called "Now" coming up early next year. You'll hear more on the www.flotype.com website soon, and a big launch in January. Check it out. – BRampersad Dec 11 '11 at 12:28
  • That would be great, since using nowjs is easier than dealing directly with socket.io. – Tan Nguyen Dec 11 '11 at 16:39

1 Answers1

0

I'm not sure what you were saying about 25% and 75%, but if you are referring to cpu / memory you should know that Node is very efficient when it doesn't have stuff to do, so that can explain the situation.

Also, the only way to use multiple cores is to spawn more processes (thus use cluster).

The fact that you are using RedisStore (so Socket.IO can keep connection data in memory instead of a single process => to scale outside one process) and Redis for pub/sub is excellent, you can use these standalone with Socket.IO also (NowJS is another layer of abstraction above Socket.IO).

So you should use multiple processes and then try to scale horizontally (upgrade your machine) and only after try to scale vertically (adding more machines).

alessioalex
  • 62,577
  • 16
  • 155
  • 122