Search code examples
performancerestresponse-time

How to improve/minimize varying response time of api


I created a rest api and I am not very happy with the performance of it. I spent some time to investigate and stumbled across a tool to easily track the performance of my api (www.apiscience.com).

They split the overall response time in 4 categories- connect, resolve, processing and transfer. The resolve part often takes about 150ms while the processing of the call itself only takes about 18ms which results in an average response time of 160ms (the call i tried here is really simple so the average would be higher normally).

Response Time Result

My question is how can I improve/minimize the resolve time for my calls?

(side info: my servers are placed in Ireland and I chose Ireland as location for the tests too)

Thanks in advance!

Edit - What do they mean with Resolve Time? (https://www.apiscience.com/blog/what-do-api-sciences-curl-based-timings-mean/)

API Science’s “Resolve Time” is the equivalent of Ken’s “DNS Lookup.” DNS stands for Domain Name System. A URL consists of text (and sometimes numbers); however, the communication addresses that compose the Internet are formulated as IP (Internet Protocol) addresses, for example, 208.80.152.2. Before a request can be routed between the requesting client and the server that will process the request, the IP address that the URL refers must be looked up. A request is sent to a DNS resolver by curl, and the resolver returns the correlated IP address. API Science’s “Resolve Time” is the time in milliseconds that it took this operation to complete.


Solution

  • As the documentation mentions, the DNS resolution time is the amount of time an API consuming client waits before finding out where to route the actual calls to your API server - the mapping between your server's name and IP address.

    Where you host your DNS can be completely independent from both where you host your API service, and where your domain name is registered, and there are multiple choices in the market for DNS hosting service. DNSPerf (of which I have no affiliation) does a comparison of services and is probably a good starting point for further research if you'd like to select a new DNS provider.