When it comes to scaling GraphQL subgraphs , (with Apollo’s federation), is it advisable to connect multiple nodes of the same Subgraph to some sort of load balancer like REST APIs connecting to a transporter such as NATs etc.?
If so, what sort of mechanisms are out there for connecting 5+ versions of the same subgraph together so the API gateways see them as one, or is it bad practice to have multiple nodes of the same Subgraph type like multiple “User” subgraph nodes running?
What does your current infra look like? I think for a lot of teams that are using kubernetes this is pretty straightforward but it sounds like you might have a unique infra that makes this a bit more challenging
Well let’s take a gateway and 2 subgraphs for example.
Subgraph 1: Users
Subgraph 2: Products
In our example, over time, we notice Users gets hit 50,000+ requests a minute. We then notice Products only gets hit 10,000+ requests a minute.
Ideally, it would make sense to spawn (docker or kube) multiple instances of Users, aka scale it horizontally, to load balance the Users subgraph.
However, it’s almost as if the gateway, we need to set a load balancer in front of the Users subgraph.
Another unique, but reasonable example. would be running the same subgraph in multiple DataCenters across the world. So, having multiple spawns of our Users subgraph in let’s say Europe, South America, Asia etc.
Just trying to get a general idea of how to actually scale, instead of only one Apollo Gateway and One Apollo Server per subgraph.
I guess this wouldn’t be an Apollo question, it makes me believe this becomes a Docker or Kubernetes question.
But reasonable to pose the question to see what solutions have been used to solve this if any.