Response time- API

What is the accepted response time while making an API call against a service? 100ms?
Thanks.

There is no set answer. The time it takes to respond is dependant on what exactly is happening.

However, I would advise this. You should always make the user aware that something is happening in terms of spinners or progress bars. If it takes 5 seconds for your API to respond, and there is nothing you can do about it, accept it and implement a progress bar so the user knows something is happening.

If you gave more detail about what the API is doing, I could maybe give you some ideas of the response times I would expect.

I hope this helps.

3 Likes

Agree with @froberts’ comment that it depends on the activity.

I’d suggest starting by figuring out your target latency for the overall action from the end user’s perspective then working backwards, assigning a “budget” to each operation required to complete it.

For instance, let’s assume we’re rendering a page containing 10 currency exchange rates and you want the page to load in <1s (and for some reason we can’t fetch in parallel). You’d want each call to take substantially less than 100ms (80ms, say) so that 10 calls + any rendering and delivering could be completed in that timeframe.

Conversely, if the API call is e.g. completing a credit card payment, it’s probably the only call required as part of the user action, and most users are pretty tolerant of a few seconds’ wait at the last step of a checkout. So in that instance a 2s target might be totally fine.

One further thing - ensure you’re setting targets and measuring in terms of a high percentile e.g. the 90th, rather than median or mean. Or alternatively, measure the % of requests in your test that meet or exceed your threshold. Either of these two approaches will give you a much more meaningful measurement - good-looking averages can still hide poor performance in the top half of the distribution.

3 Likes

Imo, the answer to this question should be " check the requirements ".

As mentioned above, it all depends on the tech you are using, what the size is of your api and how much load you are generating.

What I would like to add is that if there are no requirements for performance testing. Then you are obliged to tell the people that the response time is nor fast nor slow but it is “100ms” at X time. Since you have no requirements to compare your results too, you cannot say if it’s good or bad. You have to make sure that it’s not your call to tell if the API is slow or not. You should advise them to set up some requirements, in which you can also guide them.

Kind regards
Kristof

1 Like

Also, check out this recent question, which covers some of the surrounding quality possibles: Acceptance criteria without specified time

All I can say is that 100ms is an eternity if you end up having to call the API to pull data for 150 accounts at the same point. It quickly becomes a design problem, and then things like maximum possible query size become interesting.

1 Like

Any answer to “is X acceptable?” without taking in consideration context is a wrong or poor answer.

Quality is not an absolute characteristic of a product, but it relates to the value it provides to someone - and usually there are many someones.

2 Likes