Setting execution timeout to infinity can affect server performance?

3

Generally, I see a lot of people (including myself I've had) run-time issues with a PHP script. This is because, by default, PHP sets a time limit for running a script in 30 seconds.

These problems usually occur when PHP is working on a lengthy request. Here the solution that is usually adopted is to increase the execution time limit of the script.

However, I have seen some cases where the programmer has chosen to set 0 to the script execution timeout (and 0 in PHP means without limits) since the wait time could vary (for example, if the script is waiting for an external request).

My question is: Should I set the timeout as 0 to make this timeout infinite, could it cause performance loss on my server?

For example, if I have multiple scripts running and waiting for an average of 1 minute, due to a time-consuming process (ie, database querying, etc.), can this lead to my application being affected in terms of performance?

Is it really safe to use set_time_limit(0) (or any other way that exists to set a wait time for a complete execution of a script to be infinite)?

The other question is: Is there any reasonable or recommended time-out so I can maintain good performance on my server?

Note : When I'm talking about setting 0 , I'm talking about the function named set_time_limit , used by many PHP programmers to increase execution timeout and a script.     

asked by anonymous 09.01.2017 / 19:20

2 answers

2

If I set the timeout to 0 to make this timeout infinite, could it cause performance loss on my server?

Regardless of the scenario, I think set_time_limit(0) is not good practice. That if your system gives some bug, the script will run and this will "end" with memory. That is, it will hurt the principle of efficiency, defined by ISO 9241 .

Is there a reasonable or recommended time-out so I can maintain good performance on my server?

As part of Documentation contribution says that your web server can catch you with an HTTP tax timeout (usually about 5 minutes). You should check the web server's tabs for more information about HTTP timeouts.

    
09.01.2017 / 20:06
3

It can compromise performance yes.

Setting the execution limit to ZERO can cause slowdowns or even crash your server.

See the maximum time required, then set a margin of clearance.

Is there any reasonable or recommended time-out so I can maintain good performance on my server? There is no rule for this, it depends on your environment, your server resources, system, clients, usage, etc.

See your time need and set a break. But I do not recommend that you leave WITHOUT LIMIT.

    
09.01.2017 / 19:41