Running meteor in a cluster and real-time changes


I was planning on deploying Meteor to my Amazon AWS EC2 servers but I would like to also run multiple instances of the server at the same time to serve more clients. Is there a proper way to do this in Meteor without breaking the ability for clients to updated about updates to their collections?

11/2/2012 8:20:38 PM

Accepted Answer

There are two main issues to consider when running multiple Meteor server processes.

  1. Client session affinity. Clients use the SockJS library to connect back to the Meteor server, usually by using a long polling strategy that reconnects to the server every so often. The server process holds state associated with each client. So it is important that a given client's connection not bounce between servers, or else the server will think it's talking to a new client and resend all of the subscription state.

  2. Coordinating database invalidations. Anytime a client issues a database write, the server process runs a recalculation and pushes updates to any other affected client. But clients connected to a different server won't see the change until that server process runs the 10 second Mongo polling loop. For some applications it's okay to have most clients lag 10 seconds behind. If your application requires something more real-time, then you'll have to implement your own interprocess communication between Meteor server processes.

12/5/2012 4:00:43 AM

Guys this is what you should look at

Meteor Cluster -

I blogged about this here too:

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow