Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43042 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16184 invoked from network); 14 Feb 2009 22:23:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2009 22:23:35 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:51936] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6B/B6-08422-56447994 for ; Sat, 14 Feb 2009 17:23:35 -0500 Received: from [216.145.54.158] (socks1.corp.yahoo.com [216.145.54.158]) (authenticated bits=0) by mail.lerdorf.com (8.14.3/8.14.3/Debian-6) with ESMTP id n1EMNS52017339 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 14 Feb 2009 14:23:28 -0800 Message-ID: <4997445F.9040700@lerdorf.com> Date: Sat, 14 Feb 2009 14:23:27 -0800 User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: Roland Mieslinger CC: internals@lists.php.net References: <1234649609.25689.26.camel@testbox> In-Reply-To: <1234649609.25689.26.camel@testbox> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] open_basedir performance issue, realpathcache vs. statcache From: rasmus@lerdorf.com (Rasmus Lerdorf) Roland Mieslinger wrote: > Hello, > > we're managing a shared hosting environment with about 600 virtual > servers. All content for the websites is stored on a NFS share. > > We're suffering from a huge amount of lstat calls, and identified > open_basedir as the reason for that. strace shows that each call > needs 40µs in average, this is due to NFS. > > A lot of questions arises from that, but some answers are still missing. > Maybe I can get them here. > > Did open_basedir rely on realpathcache? I haven't found a definitive > answer to that. We have changed realpath cache size, without any impact. > So I assume the answer is no. > >>From what I understand realpathcache is different from statcache. So > using clearstatcache should not flush the realpathcache. Am I correct? clearstatcache does flush the realpathcache in PHP 5.2. This has been turned off by default in 5.3 and is now an option on the clearstatcache() call. The realpathcache in 5.3 is also more efficient now in that it will cache partial paths. In 5.2 we relied on the system's realpath() call and only cached complete results from it. That also meant that there is no negative caching going on, so if you have a bunch of include_path misses, you are going to die a slow stat death in 5.2. In 5.2 make sure your main include_path dir is the first path in the order there. Put "." at the end and always use include './foo.php' when you include something relative to the script's directory. That should alleviate a lot of the stat issues. -Rasmus