Managed federation with service discovery

I’m trying to wrap my head around how this is going to work with Apollo federation. Currently we have a monolithic GraphQL service which kind of acts like an aggregator to aggregate data from different upstream services. The way we talk to our upstream service is through service discovery.

I’m trying to picture this is my head how this is going to work if i were to migrate over to a federated graphql. If i were to deploy my subgraph as a microservice with 10 instances. How can Apollo Studio (managed federation) route to a subgraph and do a service discovery to pick 1 out of the 10 instances to use?

Seems like if i were to leverage apollo studio to manage my graphql registry, it would be 1 subgraph to 1 url mapping than 1 subgraph to multiple urls (service discovery).

Not sure if this is the right approach to using Apollo federation, would love to hear how people approach this especially if we want to be able to scale the individual subgraphs.

Hi, excellent question!

Do you have a load balancer running in front of the 10 instances of your subgraph service? That’s what I see most often.

For instance, in a Kubernetes scenario, you’d have a 10 pods in your Deployment, and a single Service that load balances requests to those pods. The gateway routes requests to the Service, so it doesn’t even know that there are multiple pods.

Hope this helps!

1 Like