I am using Strapi as my backend for two different domains, but the API response times for fetching city data are significantly different between the two servers. Despite the server at [API - colleges18] having more powerful hardware (4 vCPUs) compared to the server at [API - schools18] (2 vCPUs), the response time on the former is slower, with a TTFB of 714.24ms, while the latter delivers a faster TTFB of 103.67ms.
API Performance Discrepancy:
Faster API Response:
Server: 2 vCPUs Response Time (TTFB): 103.67ms Endpoint: [API - schools18]
Slower API Response: Server: 4 vCPUs Response Time (TTFB): 714.24ms Endpoint: [API - colleges18]
Even though the API running on the 4 vCPU server has more powerful hardware, it is returning much slower response times (1.69 seconds in production). The other API, running on a server with only 2 vCPUs, responds much faster with a TTFB of just 103.67ms. This discrepancy is confusing, especially considering the difference in server specifications.
Why is the API on the 4 vCPU server taking longer (1.69s) to respond, even though the hardware is more powerful?
What factors could contribute to a higher TTFB despite having more computing resources on one server?
What steps or tools can I use to effectively debug API latency in Strapi?
Any guidance on this matter, including common causes for latency issues or tools for diagnosing Strapi API performance, would be greatly appreciated. I’ve also attached images for reference that may help in visualizing the environment setup for both APIs.
colleges18 Image schools18 Image