1

I'm just about to build a chat application and I'm keen to use node.js (would be my first time using it).

I'm using Amazon ELB (no stickyness) with Multiple Linux EC2 instances (apache) and one mysql database.

I have 3 questions:

  1. AWS ELB - are there any issues running node.js through an AWS Load Balancer - I've read a touch about others having issues but nothing that really said whether it could be done successfully or not.

  2. Can Node.js efficently listern to database tables for updates and then respond to these? Is this realistic? I've read its possible but it didn't sound like its a well used function.

  3. I understand node.js does event listening (like jquery). I'm concerned if I have several seperate webservers all running node.js that they will all respond to the same events. eg: some write some chat into the DB and they all web servers try to send this to the client. (this would be an issue with long polling as one web server would get the request and reply). Is this an issues?

thankyou

user1105192
  • 402
  • 5
  • 16

1 Answers1

0

to answer 1 + 3 (cant tell about 2):

  1. we are using aws elb's for more than a year now, and never had any issues. our application needs an uptime close to 100%

  2. node.js eventing is for events in the SAME process (unless you use a messaging-solution like axon). so this never should be an issue, even if you run multiple webservers. start your server listening on the some port, and the load-balancer will distribute the request to any server bound to the elb.

a request/response-cycle itself is atomic, which means that the same server that gets the request has to send the response when he is done with his work for this request (write the chat into the db). your code basically will look something like this:

http.createServer(function (request, response) {
   // do something with the request, save to db or whatever
   db.save ...

   // and now send the response

   response.write(200);
   response.end();
});
hereandnow78
  • 14,094
  • 8
  • 42
  • 48