Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12924 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39545 invoked by uid 1010); 21 Sep 2004 19:04:12 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 36818 invoked from network); 21 Sep 2004 19:03:12 -0000 Received: from unknown (HELO mail.zend.com) (80.74.107.235) by pb1.pair.com with SMTP; 21 Sep 2004 19:03:12 -0000 Received: (qmail 23034 invoked from network); 21 Sep 2004 19:03:11 -0000 Received: from localhost (HELO AndiNotebook.zend.com) (127.0.0.1) by localhost with SMTP; 21 Sep 2004 19:03:11 -0000 Message-ID: <5.1.0.14.2.20040921115703.02d197a0@localhost> X-Sender: andi@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Tue, 21 Sep 2004 12:02:15 -0700 To: internals@lists.php.net In-Reply-To: <5.1.0.14.2.20040920192353.0448d210@localhost> References: <5.1.0.14.2.20040920182416.04a8cdd0@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] realpath() caching From: andi@zend.com (Andi Gutmans) I was asked to provide some more info about this patch. In general, PHP does a realpath() on files (most importantly included files) so that when include_once() and other PHP functionality needs to know if two file paths are identical it will give a definite answer. realpath() itself is quite a slow function (especially on some specific OS) and therefore should be saved when possible. As it is rare that a realpath() for a certain file path + cwd combination ever changes, it's a perfect candidate for caching (actually a realpath() can only really change if you are adding/changing symlinks). Therefore, this patch implements caching of realpath() calls. There are two INI settings which can be changed: realpath_cache_size - Size of cache (default's to 16K; if set to 0 it turns of caching). realpath_cache_ttl - Time to live for cache entry (default 120 seconds; if set to 0 then doesn't refresh). On a loaded side even a small TTL should do the trick, although it might make sense to raise the TTL to something much higher than 120 seconds because as I said, it doesn't usually change. Hope that's enough info. Andi At 07:24 PM 9/20/2004 -0700, Andi Gutmans wrote: >Thanks for pointing out that the attachment didn't make it through. You >can find it at: >http://snaps.php.net/~andi/realpath_cache2.diff > >Andi > >At 06:28 PM 9/20/2004 -0700, Andi Gutmans wrote: >>Hi, >> >>Attached is the promised patch to do realpath() caching. >>You can set cache size and TTL via the php.ini (default is 2 minutes TTL >>and 16K memory). >>It doesn't use the SAPI time() but uses the syscall time() because it >>seemed to be slightly faster but we can adjust it to use the SAPI one if >>anyone measures a difference in performance (might depend on the OS). >> >>Feedback welcome. >>Also any feedback on the VM patch? I'd like to commit it soon but I >>haven't heard anything from this list (people were saying they wanted to >>review it). >> >>Thanks, >>Andi >> >> >>-- >>PHP Internals - PHP Runtime Development Mailing List >>To unsubscribe, visit: http://www.php.net/unsub.php > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php