Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112487 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 34933 invoked from network); 11 Dec 2020 10:29:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Dec 2020 10:29:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5D67F1804E1 for ; Fri, 11 Dec 2020 01:59:18 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 11 Dec 2020 01:59:14 -0800 (PST) Received: by mail-lj1-f181.google.com with SMTP id y16so10246705ljk.1 for ; Fri, 11 Dec 2020 01:59:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=oEm0sJplI/wTVUXnJw1VQ7MBeltevox2jA2FEA+o60A=; b=rZz3tMyXsWDUUljhzfit/cM2c8dLVoYSEcpwO6vkXpRfin5Xs0iGK4GukUeNhBdKns Wc8Dy01sOulYSx1zLN52b12onsdiJcgRW49hMqxLWQrz5egFSS4sLhSZCSXWQbMWTVSA 0b03oRSeSC1h4L3NRe9TzMDwoVGp220QjaVznQOqfFy7TEHYQsNquIxf4XL9naE1cEsA jQTNycvhd6r/+pLEscJ1tmkSO1rP1rzPYEZe3WUgJD+ANNuF+vjYs9IksZjtAMsYwwv6 afDbByhJO91BjnuaMdMBGFJkrgY1Pgwcn4oGjBy148HbOg64lyIPSrzxFdkGDr+CL91l 6exA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=oEm0sJplI/wTVUXnJw1VQ7MBeltevox2jA2FEA+o60A=; b=qcptyqOp4+2+VhkAPLpFH5ckS8azj/2ivI/LY2uy/k9FfYaZL48h1tufsxQn0eaQYi kp/bzxhlis6wsY/x0sTiCXa9ZmJeI6gh5Go7KAo37UU86o1Th6doBG9dgUxYqD96uQa3 5Ktts96Xchzx/MKEhzHYAHYjK0vH6ZgwD/phzjWnKwv1S1ea8NFX0/Z6cKOO7yedUtJb A5014CKYXjcQInBLM0Tr3hl+Xjmdtbcb34XFlHUrb6if/dqx/G94JXDVEyqOShQEPkMz wnTkOu3IuMxN5nwmXfa3Dfl+ZHadDFTCUJWlnU5FHpSG2ezuCKAqINx60XUDCKGeEHqS 5spA== X-Gm-Message-State: AOAM531eg4XTayA+v1F1uWNdrIzVkeyCbnGPRFzKOdPBZaSVtyFYhXGL 1EQDrcQfCC+U8wwkOePM8D4f1lHZnpKvNDW7n8siZ6fHkAE= X-Google-Smtp-Source: ABdhPJzAe/96sUA+VNZ/0zg7SxbSAMFVSsvLdo8xFrg6StPmn/ebLM7fPlTrpH166zJ5lLjOkcLVCjplZ1S8aFzx43k= X-Received: by 2002:a2e:9d89:: with SMTP id c9mr5052100ljj.220.1607680752289; Fri, 11 Dec 2020 01:59:12 -0800 (PST) MIME-Version: 1.0 Date: Fri, 11 Dec 2020 10:59:01 +0100 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000270b6e05b62d587a" Subject: [RFC] Measuring maximum execution time based on wall-time From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --000000000000270b6e05b62d587a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/9a9b42e3610cdf242f16ddb8936ce34adfa= 0be9e) 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=C3=A1t=C3=A9 --000000000000270b6e05b62d587a--