We are working with a performance metric that all API requests should respond within 50ms when running locally. I am taking this from the average response time of Githubs API.
I have an object called Foo. A single Foo might contain 6KB of text when serialized as json.
Foo has a sub object which makes up about 3KB called Bar.
There is an endpoint in my API which returns a page of Foos at a time eg:
The response for a single page of 25 Foos is then ~150KB. This takes 75ms to respond when running locally.
There is a design option to take the Bars out of the Foos object, and make them available as a sub object like this:
This would bring the response for a single page of 25 foos is then down to 75KB. With an extra request needed to get the bar for that foo. This brings the avg response time closer to the goal of 50ms.
When designing a RESTful API and it's object definitions, what is the ideal response size if 50ms is an ideal response time?
What other considerations should I have when designing API objects and sub objects?