D
D
dalisoft2019-04-21 17:38:53
Node.js
dalisoft, 2019-04-21 17:38:53

Why is there a delay when requesting an API project on Heroku and how to fix it?

Good day to all!
I created and uploaded a Node.js (Fastify) backend to Heroku (free plan), locally it works even faster (about 2-100ms) because I did everything (cache(+ttl) + duplication check + checking) to speed up the backend.
But in Heroku, each request takes approximately 500ms-5 sec (sometimes up to 10 seconds), which is impossible to make a fast front for it.
Why might this be happening and how can it be fixed?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Shumov, 2019-04-21
@dalisoft

If your project is purely in the form of an API, then look at AWS, Azure. Everything is fine with them and at the start you are unlikely to pay anything at all (if you don’t climb where it’s not worth it)
Google Serverless

S
Sergey Gornostaev, 2019-04-21
@sergey-gornostaev

Switch to a paid plan.

R
Roman Mirilaczvili, 2019-04-21
@2ord

A small study showed that the server on Heroku gives content in 3-9 ms and from San Francisco receives a response in 140 ms.
I would recommend deploying the application somewhere in the Europe region to avoid network delays.
Hosting separately on AWS only makes sense if you choose a region closer to the user than the United States. Heroku is powered by AWS in select regions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question