Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126162 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 1D72C1A00BD for ; Sun, 22 Dec 2024 04:09:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1734840398; bh=uVZlxDb8ONDcKPYf7g01TrR+tfLwm/uYsexLswo1ZrQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=BUgExNB09uFR7mGOhjcTVH7JkAhhg0zQtmajwUPNcguYfAfQ0ORUUowKRU1rFuuUP xb/HLrfejqpESXaO3mrIf79jPXYdTA/iY0kR6lkci11QQjcc/vWDacJKpmYmglssBB H2zj7rsp3zwE+1siLj94H0eAu4mxUmwPFo3Ffeokk2ME3XjTGmM+14TMlw5jeexVQR Y8Y+9tT2HNN2tCW/b4BRXltV4u3qSDusBF1aMO/R9ATEqpIbuYfnvy9QQex3ACTr1W m3E/b+9y1Ma7iOa8kouFulHrji6tSMhez+HBzLK77h6D7l4ymEBhFT9aaAA4U+Mj09 n8zEq5jBuUeUQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5F3DA180072 for ; Sun, 22 Dec 2024 04:06:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout-b7-smtp.messagingengine.com (fout-b7-smtp.messagingengine.com [202.12.124.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 22 Dec 2024 04:06:38 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id E1E2411400FB for ; Sat, 21 Dec 2024 23:09:39 -0500 (EST) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-01.internal (MEProxy); Sat, 21 Dec 2024 23:09:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1734840579; x=1734926979; bh=h30y+1Ux4t5Akll2NS+dY xH74dtPFYtZy3TDPw2vSpw=; b=a8NtTr9RcU2oJa8hOO5dxF6dN3WlTbY36sw6E chnky5tAWUC2DXaq00f4eiVmVFyByHJX9ZvA//s8HlY/fIhfRq31U8tu3jg4mGCD LMh/FkP4AgjlwkUgiu2VyH9xpkiC/qU13cF5rBp4THk90A8ooWzLgHtw7GanOCuA 3VQhTFG+KjSYPdsoWb3NvOaxgZYuc7+ZpnlFjQ5KvhjNA0dYO3PmWrYmnFhp1UZM wSVVa74fUvBbZ8Fwt3jm9MOab2+5DGRptJ5ITylvWws4ZNQM74lBbwIEWVkD/bw/ ciR5UyomoSUPwLwQOps9WH5rqHZFK1EnUHE4YzOOakwB8mC7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1734840579; x=1734926979; bh=h 30y+1Ux4t5Akll2NS+dYxH74dtPFYtZy3TDPw2vSpw=; b=HXHIGjhLqMYI46l6/ J50dFj5BuzCbeBG2Kqiv+fKnCYIWaTykgrLHGMagnXLGVDnYIdPJgQ067QTkm0Bq Wp1xr3r9kZ0Lo811ecTIJ7dO96Ad+JVR7spq1CqSq12+7xzFtVJEFjeUfvyhSmu6 X3Bzc5AHGDmHTILKYtyg/X2Wmd1xZR20a/wGg7HF2mrobuISmep5Hzt6+/g/Ks/z Md2PvR8AVeZyUZimdLsUFxdK7AC4hn1WAvQSeZcG/UhUF/XwmQ5087x0zifN9Z5l nKuykTkAKJXpgEaMFS1O2pY0DHbRWs5MpXKSib79O4Q0kuuyRqAHRVTmZgYrEYQ1 py98w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtiedgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtgfesthhqredtredtjeen ucfhrhhomhepfdfnrghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfih gvlhguthgvtghhrdgtohhmqeenucggtffrrghtthgvrhhnpeffieeivdfhvdeguddttdeg teeiueegvefhteehfeeffeetudeitdehtdegjeeuieenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggt hhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 86D5329C006F; Sat, 21 Dec 2024 23:09:39 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Sat, 21 Dec 2024 22:09:19 -0600 To: "php internals" Message-ID: In-Reply-To: References: <27531d9d-9bfe-4acc-b9ab-80b1017e3038@app.fastmail.com> Subject: Re: [PHP-DEV] Discussion: Remove file statcache? Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Sat, Dec 21, 2024, at 10:43 AM, Jakub Zelenka wrote: > On Fri, Dec 20, 2024 at 8:29=E2=80=AFPM Larry Garfield wrote: >> Background: PHP has a not-often-considered feature, the stat-cache. = That is, the runtime caches the OS stat() call for files, so that subseq= uent reads on the same file can be faster. However, it's even less real= ized that it's a single-file cache. It literally only applies when you = try to do two file-infomation operations on the same file in rapid succe= ssion, without any other file reads in between. > I would prefer to disable it by default but keep some option (INI) to=20 > re-enable it. I think that for most users the perf impact will be=20 > negligible. However, it is quite likely that there are some user=20 > workflows and platforms where benefiting from the stat cache can be=20 > still significant in terms of performance. So those users should have=20 > the option to re-enable it if they see some significant regression=20 > rather then force them to update their code to make it faster or=20 > implement their own cache which would just make their migration to the=20 > next version much harder / potentially impossible. There is not such a=20 > huge maintenance that we would really need to get rid of it completely= .=20 > I would really prefer having such option and tell to users to re-enabl= e=20 > it rather than not be able to deal with potentially reported future=20 > perf regressions.=20 > > I think the main issue with the cache is that is just not convenient=20 > for use cases where it doesn't get flushed during some different acces= s=20 > methods that don't trigger flush. We could probably improve the stream=20 > situation a bit but it still leaves external (e.g. shell) access=20 > problem in place which we just cannot fix. On the other hand it is=20 > possible to use it in a way that users can profit from it but they=20 > really need to know how it works. That's way it should be an optional=20 > feature IMO. We should also improve documentation in that regards. > > In terms of voting, if there was no option to re-enable it, I would=20 > probably vote against this proposal as I'm a bit worried about those=20 > possible regression reports. I really don't like the idea of another ini toggle. That actually creat= es more work, as people writing code that works with the file system now= have one more invisible context they have to think about. Which means = they probably won't, until it bites them. (They'll either never bother = clearing the cache, so their code may malfunction on the rare system whe= re it's enabled, or always clear it, which 99.9% of the time will actual= ly be slower as we have to invoke the function for it to do nothing. Bo= th are bad.) I suppose a possible alternative would be to modify all file system muta= tion functions (file_put_contents(), touch(), etc.) to flush the cache, = which for whatever reason doesn't happen now. That would be above my sk= ill level, though, so someone else would need to do it. Also, I don't k= now if there's a good reason those functions don't clear the cache curre= ntly or if it was just an oversight. --Larry Garfield