Scaling via Routing


#1

Hi, I am fairly noob when it comes to Meteor or JavaScript for that sake. I wanted to understand a bit about horizontal scaling that is possible in Reaction. Is it possible in Reaction to route certain type of requests (Let’s say product search) to only certain instances in a pool based on some load balancer/routing configuration?

If there are working examples of this, it would be superb but not a necessary requirement.


#2

There are a couple ways to approach this. There are quite a few articles out there, I suggest a starting post to read is http://joshowens.me/but-does-meteor-scale/.

Specifically right now, you’d have to make some alterations, but whenever a Meteor method is used, we could be using alternate endpoints for these, as this is essentially a remote method (when local, it’s localhost, but using ddp.connect we can use these methods from a remote location). With a wrapper around Meteor.methods, you could add this logic in the startup of the app and specify where each method should connect to.

This is partial answer, but this is really a temporary state overall, we’re planning to a move to a more robust api /microservices driven architecture and are working on docs and details that we’ll be sharing soon in an upcoming “Reaction Action” (online meetup.). We’ve not been able to complete this change as we’re waiting on some necessary updates from Meteor and the maturation of the Apollo Stack project as well.

In the meantime though, adding additional app instances behind a proxy (this is how we have our Docker examples setup) is a reasonable setup as well.


#3

Thanks a lot Aaron, the article is a one of really good once I have come across lately. It also clarifies a lot of my questions. My doubt was more geared towards if routes could be used to split traffic among different instances but I think instances behind the proxy is simple and scalable solution for me, for now. Thanks again.