Home > database >  My node application takes 10x response time on heroku than local?
My node application takes 10x response time on heroku than local?

Time:06-17

I don't know many things about hosting, and i hosted my node app on heroku, but when i fetch api from postman i noticed that it takes 1-2 second if app is sleeping, but even after it takes 500-600 ms. The same api on localhost only takes 50ms. Am i missing something?

CodePudding user response:

Network I/O is one of the most un-reliable and time expensive operations in API calls.

Even if it's not a CPU intensive task the network speed can tank down the response time of your application.

So, I don't think that you are missing anything.

You just need to keep in mind the factors that might affect the response time of your application:-

  1. Variable Network Speeds.
  2. Geographical location of the server hosting your application.
  3. The cloud platform managing your Database and it's geographical location.
  4. If you are making a bunch of network I/O calls from your application. E.g Multiple calls/requests to the Database or other 3rd party API(s)

CodePudding user response:

If you are using free tier of heroku then, it would take that much time.

And in case of localhost your server and client are inside the same machine.

But server is located many kilometers or 1000's of kilometeres away from your system. So, it generally takes that much time.

  • Related