At my company we're about to set up a new microservice architecture, but we're still trying to decide which protocol would be best for our use case.
In our case we have some services that are called internally by other services, but are also exposed via a GraphQL API gateway towards our clients.
Option 1: gRPC
gRPC seems to be a popular choice for microservice internal communication because of its performance and efficiency.
However, gRPC makes it more difficult to query relational data and requires more work to hook up to our API gateway.
Option 2: GraphQL
Another option is for each microservice to implement their own GraphQL schema so they can be easily stitched together using Apollo Federation in the API gateway.
This approach will make queries more flexible, but internal requests become less performant because of the lack of protocol buffers.
Option 3: Both?
Perhaps another alternative is to use the best of both worlds by implementing mutations in gRPC and queries in GraphQL. Or just creating two APIs, one facing the gateway clients and one for communication between services.
Questions
- How do we decide which approach to use?
- Are there any significant (dis)advantages we should consider? E.g. in terms of ease of use, maintainability, scalability, performance, etc?
- Are there better alternatives for this use case?