Running meteor in a cluster and real-time changes

ぃ、小莉子 提交于 2019-12-20 18:33:04

问题


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?


回答1:


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.




回答2:


Guys this is what you should look at

Meteor Cluster - https://github.com/arunoda/meteor-cluster

I blogged about this here too: http://goo.gl/2aHJ2



来源:https://stackoverflow.com/questions/13201269/running-meteor-in-a-cluster-and-real-time-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!