by phamilton · 7y ago · 0 comments
query {
user {
first_name
last_name
}
settings {
debug
paid
}
}
could be translated into:GET /user/first_name GET /user/last_name GET /settings/debug GET /settings/paid
And you could represent any gql query as a multiplexed http2 call. And you could then have the server use a persistent user scoped dataloader (or some other shared cache) to resolve all that data and respond to each of those queries.
That's roughly an isomorphism between graphql and http2.
If the data is not particular dynamic then you can cache the entire representation deriving a future benefit.
Graph base queries tend to lend themselves to adhoc query patterns and I would be concerned about unpredictable patterns of loading. If the backend store is distributed then graph QL looks more attractive to me. If the datastore stores related attributes in aggregate there seems to be little benefit since different parts of an adhoc graph would different levels of 'cachability'.
I have found an application for GraphQL in storing soft-defined triggers or other criteria on data.