Dear Internals, Currently, our company is migrating away from HHVM to PHP, and we are experiencing some performance regressions due to the fact that the max_execution_time ini setting has different semantics in the two languages.
By default, HHVM measures wall-time, but the behaviour can be controlled by an ini setting ( https://github.com/facebook/hhvm/commit/9a9b42e3610cdf242f16ddb8936ce34adfa0be9e) if compatibility with PHP is important. On the other hand, PHP measures the CPU time on most systems (with the most notable exception of Windows), which means that neither sleep(), nor network/system calls are counted towards the timeout. This is really a big pain for distributed systems with high traffic, where proper timeout settings prevent cascading failures. Even if all the external calls have their own timeout settings, the script itself has no control over the real execution time (e.g. there can be dozens/hundreds of such calls). That's why I'd like to add support for measuring the execution timeout based on the wall-time. There are a couple of ways to approach the problem though: - by measuring wall-time on all platforms - by adding a new "max_execution_time_type" or so ini setting for optionally changing the meaning of max_execution_time (this is what HHVM is doing) - by adding a new "max_execution_wall_time" ini setting for being able to timeout based on both the real execution time and the CPU time. My POC implementation at https://github.com/php/php-src/pull/6504 currently uses the third solution, but I would be okay with the other possibilities as well (especially with the first one). I would also be very curious if anyone is aware of the reasons why the CPU time metric was chosen back then? In my opinion, wall-time is much more useful, but maybe I'm just missing some technical limitations (?). Please note that wall-time timeouts would take into effect on a best effort basis, only after the network/system call exceeding the time limit is finished. Regards, Máté