Running meteor in a cluster and real-time changes

前端 未结 2 1838
萌比男神i
萌比男神i 2021-02-07 21:29

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

相关标签:
2条回答
  • 2021-02-07 21:39

    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

    0 讨论(0)
  • 2021-02-07 21:45

    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.

    0 讨论(0)
提交回复
热议问题