Question

How does server-server communication compare to client-server communication?

I'm wondering if there are any performance benefits when putting a GraphQL layer in between my client-side app and my rest-server. For arguments sake, let's say an endpoint on my rest api returns a response with 500kb of data. My client only needs about 5kb of that 500kb. Is it quicker if...

  1. My client requests the 5kb from my graphql server, which then fetches the 500kb data from my rest api server?

or

  1. My client fetches the entire 500kb from my rest api server?

Caching considerations are definitely welcome.

Was it helpful?

Solution

Server-server communication is client-server. One server is the client.

The real question becomes, who is the client? A blade server with 16 processors and a truck load of RAM, or the crappy mobile phone I'm writing this answer on? And what is the network like? Is it a local gigabit ethernet, or a spotty 3g/4g connection in a commuter train where 1,000 mobile devices simultaneously disconnect from one cell tower and simultaneously connect to the next tower as the train wizzes by at 40-60 mph?

Knowing the client and its expected capabilities (including network capacity) will answer your question. Sometimes it is better to just fetch the 5kb and have another server crunch 500kb of data. Sometimes it is the other way around.

Licensed under: CC-BY-SA with attribution
scroll top