hasura / hasura/graphql-engine

Batched requests for remote schemas

Open
#10,288 0 comments 0 reactions 0 assignees View on GitHub
k/enhancement
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

We have a remote schema for a google distance matrix API to calculate the travel time to a list of locations, currently it calls this per location.

If there was an option to turn on batched requests to remote schemas we maybe able to reduce the number of calls to this service, for example from 10 (per page) to just 1.

I think the only way we could do this currently would be to have a direct query rather than it being contextual to the location which would mean two separate requests from the front end instead of one, one to get the locations and another to get their travel time.

Apollo server supports batch requests as [Query Batching](https://www.apollographql.com/docs/router/executing-operations/query-batching/).

This has also been mentioned here https://github.com/hasura/graphql-engine/issues/1812 but likely from a client context rather than via remote schema.

Contributor guide

Open the contributing guide

Research direction

Start by reading the remote schema behavior described in the issue and compare it with Apollo Server's Query Batching documentation. Use the Google Distance Matrix example to define how multiple contextual locations would be combined into one request, and review issue #1812 for related prior discussion. Done means remote schemas can optionally batch these requests without requiring separate frontend queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.