Hello,
I have a website with backend code an everything works fine until two people load the site at the same time. Even though I do not get an error msg, I know the problem comes from the backend, because if I put the backend code to the frontend, everything works fine. I could imagine it is the 14 seconds timeout error…
Does anyone know the problem?
Is the backend not fast enough or is it overloaded?
I do not have the premium plan yet, might this be the reason?
What can I do?
You will need to provide more information so that the community can understand what it is that you are doing? What are you doing? How does it work? Share your relevant code here in a code block. Are you getting run-time errors? Have you tried using console.log() statements to see what’s happening?
Without code there’s no way to help. Most likely the problem is in your code.
You can use console.log() statements and they will appear (with a few exceptions) in the developers console. However, for your case, you will probably need the more advanced debugging options. See Debugging with Logs for powerful logging options of Live sites.
thank you for your great advice, it helped a lot !
Now I know I get a timeout from the backend and I optimized my code a bit, so that it should not happen so fast anymore.
Nevertheless I have one last question:
If a big amount of people loads the site at same time, the backend takes more and more time to respond, doesn’t it? So does it mean, that it is impossible to make sure that the timeout error does not appear?
The timeout is for each call to each instance of the server. It really shouldn’t be a problem. Sites can handle traffic - heavy traffic. Optimizing your code is the best way to handle this problem.
Client side server issues are not really a problem. If the API that you are reaching out to is overloaded with requests it might take longer to get a response back. If you are using axios you can account for this by defining a custom timeout in milliseconds. This will keep your request open without a response until the timeout is reached giving the server time to respond. To do this you just pass it as a parameter:
axios.post(url, {timeout: 2000}) // keeps request alive for a maximum of 2 seconds