Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Node.JS node js sleep

taf

New Coder
Hi,
I deployed Node.js as a solution to return data from database for a React application. The live site works fine but Node.js seems to go to sleep when not in use after a few minutes. Once the site is "on" again - a page loaded (ex: homepage) which requires access to the database - Node.js seems to wake up and return the data, it takes a minute or two to occur. It then performs as expected serving other calls in a timely manner. I have looked everywhere for solutions but I have no answer. I'm posting it here in the hope that someone has an answer.
 
Solution
Question: what service are you using to host your nodejs app?
Thank you for your help, the problem is with the o2swicth server.
I asked the o2swicth tech team for application standby and here is their response:

"This is indeed how phusion passenger works. Your application does not run continuously in the background, but is launched from phusion passenger with us. As a result, your application stops after a few minutes if no request is not is made on it indeed."
Hi,
I deployed Node.js as a solution to return data from database for a React application. The live site works fine but Node.js seems to go to sleep when not in use after a few minutes. Once the site is "on" again - a page loaded (ex: homepage) which requires access to the database - Node.js seems to wake up and return the data, it takes a minute or two to occur. It then performs as expected serving other calls in a timely manner. I have looked everywhere for solutions but I have no answer. I'm posting it here in the hope that someone has an answer.
Hi there, not sure I myself understand what you are looking for? Let me see if I have it right, you would like to find a solution to keep your node application persistent, that does not shut down after it has produced the desired data?
 
Hi there, not sure I myself understand what you are looking for? Let me see if I have it right, you would like to find a solution to keep your node application persistent, that does not shut down after it has produced the desired data?
that's it, the data must persist even after a period of inactivity
 
The website is hosted by o2switch, a paid host. I didn't use a cloud server, I did it manually. I installed the "Node js setup" in the cpanel of the host and then I transferred the files via the fpt filezilla
 
Question: what service are you using to host your nodejs app?
Thank you for your help, the problem is with the o2swicth server.
I asked the o2swicth tech team for application standby and here is their response:

"This is indeed how phusion passenger works. Your application does not run continuously in the background, but is launched from phusion passenger with us. As a result, your application stops after a few minutes if no request is not is made on it indeed."
 
Solution

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom