Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115983 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73306 invoked from network); 7 Sep 2021 07:55:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Sep 2021 07:55:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C43121804C8 for ; Tue, 7 Sep 2021 01:33:09 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 ; Tue, 7 Sep 2021 01:33:09 -0700 (PDT) Received: by mail-ej1-f53.google.com with SMTP id bt14so18168646ejb.3 for ; Tue, 07 Sep 2021 01:33:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=H0u8T2JTen7mbGTjxB8pFE2yslJxnwUuxmn0UQvUQOI=; b=L7lD9lA8S5xTeTwFkYXSE1NfNc12VQXQjJYEYCA02enbB6AYeXIdBsANb5w/B4JSE/ rfLK+t7ttFCepJFpzcPAbXD5WKmmZCC5d2ixaPVPJQbljPy7+ttGSnlb8ZVX4t8gN0kg PTiLKprdoRHUP5SS2BvRmDReM2JrVJaQWodBXRjBk+Jd1VmmuccxmzuUntsEFBKFbHkf FuchdkVseYbTrUajOxtNeadZUGubF/Q8ff9Z8U3nN1h1UjPX+eC3sYsD07b+NIoJy+sP x7mcbhiut4ImuQK2mkeN2v7fDOe1BBwNptEL7Ov7VdNHIh8c7eywSZPme/Y3V724HIUM jOCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=H0u8T2JTen7mbGTjxB8pFE2yslJxnwUuxmn0UQvUQOI=; b=OqV5Ij96KzhZByoBgJs9y3L6gWYIlX2pROUBNclP7wG+sHHZi2olYVv3XsMibgOrwF vP0glax2MsFW7Lh2tMrSzxWeZdpvrlOdMc5AO/MHgpu1baBagiYX8P1+1yEWuDBC4TB4 04WJpe4NTW1bx51h6M/jBvxeMhn+tZy7FcGsHAdDmwt/SkUKNFT0VQH8Q02z9y69fqYF ftJfF0+L1mlN3O/aqqiSSe8i/yniBCt7J/FC/4lDjMLiqGm2IGFkJ3HLSo4kO4uUA2sn gH0UoGUrl2RQ6IPWmgEhxsFbQHP3lwm28leRzD88dty1uB+LE339iMY0dK6fwIekpv05 PL3w== X-Gm-Message-State: AOAM5315jIKm49pUmU5qRfXjBwtw7HBcTMbGrswQJwtEEQBrfDJLFYtc uEc0M9fitnoqjMJOAj4PaeEU2Z+Dkj3MBAKG5yc4oGPL X-Google-Smtp-Source: ABdhPJzXTSTcoQLyZvumVzxMfPgCx+qLIpPDvkIH/s10EKAyQr1MjfUTvr9fFFSn0J4zIHeVbU7CwNa+257MDH+/ogo= X-Received: by 2002:a17:907:50a1:: with SMTP id fv33mr17265335ejc.128.1631003588136; Tue, 07 Sep 2021 01:33:08 -0700 (PDT) MIME-Version: 1.0 References: <0A048A30-444F-4DB0-A79C-9EA9BD07B1EC@cschneid.com> <569E3A48-E3F5-46FA-BA08-D2493CE4FD33@cschneid.com> In-Reply-To: Date: Tue, 7 Sep 2021 10:32:52 +0200 Message-ID: To: Kevin Lyda Cc: Christian Schneider , PHP internals Content-Type: multipart/alternative; boundary="0000000000007f8fa205cb639d0c" Subject: Re: [PHP-DEV] Adding a way to disable the stat cache From: nikita.ppv@gmail.com (Nikita Popov) --0000000000007f8fa205cb639d0c Content-Type: text/plain; charset="UTF-8" On Fri, Sep 3, 2021 at 7:10 PM Kevin Lyda wrote: > [sent a second time, now to the list, sorry] > > On Fri, Sep 3, 2021 at 3:53 PM Christian Schneider > wrote: > > How can you say "it never was a problem" if we never had to live without > stat cache? > > Can you back up that claim with numbers? There are some of us who run > high-volume websites where system load increase could be a problem. > > Using this bash script: > > #!/bin/bash > echo "Without cache" > time ./sapi/cli/php -d enable_stat_cache=3DFalse "$@" > echo "With cache" > time ./sapi/cli/php "$@" > > To run this php script: > > $iterations =3D 1000000; > function all_the_stats($filename) { > @lstat($filename); > @stat($filename); > } > while ($iterations--) { > all_the_stats(__FILE__); > } > > I see this output: > > Without cache > > real 0m7.326s > user 0m5.877s > sys 0m1.448s > With cache > > real 0m5.010s > user 0m5.009s > sys 0m0.000s > > So that's 2 seconds slower to do 2 million uncached stat calls vs > cached with a 100% cache hit rate (minus the first stat/lstat calls). > > Technically, yes, it's slower, but I'd suggest that making 2 million stat > calls to a single file is a bad idea. And remember, the cache holds *one* > file. If you stat a second file it's a cache miss. > These numbers look pretty good to me. It would be great if someone on Windows and macos could repeat this experiment, so we have an idea of how other platforms fare in this worst-case scenario. Regards, Nikita --0000000000007f8fa205cb639d0c--