Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65917 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76381 invoked from network); 19 Feb 2013 01:45:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2013 01:45:16 -0000 Received: from [127.0.0.1] ([127.0.0.1:19684]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 14/67-34654-C29D2215 for ; Mon, 18 Feb 2013 20:45:16 -0500 Authentication-Results: pb1.pair.com header.from=kevin@yungs.com.au; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kevin@yungs.com.au; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain yungs.com.au designates 209.85.128.178 as permitted sender) X-PHP-List-Original-Sender: kevin@yungs.com.au X-Host-Fingerprint: 209.85.128.178 mail-ve0-f178.google.com Received: from [209.85.128.178] ([209.85.128.178:34013] helo=mail-ve0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/66-34654-D95D2215 for ; Mon, 18 Feb 2013 20:30:05 -0500 Received: by mail-ve0-f178.google.com with SMTP id db10so5405022veb.9 for ; Mon, 18 Feb 2013 17:30:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:x-originating-ip:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=Qhs91IjuqRFJs5fx/Am87PkC1+mwpJvOihBit+Y99x0=; b=KTmrwd8U9QpAMw8YvxQskviRsBWvto/0XXKXXf0tXzviJTK/6zYkptfF93TKau7SzS hg93lFVYEBS4VHoGg8awvco/F6ZCPAAY4blxwqDuqN90Fu2KIInHJU6dqG1kdN9bMkS7 mOKtpuVDpFtH4l7GSEY7xv2XAur4zRUOu7YvcBZ859ip4vs22gs1B5JGNaK12KoDwyg8 qGYGOmjQCQGmB2tqam/CYK30VYV8J27yMzsP4p6nB5RM5nkRW8LCGfJvwO0vUFkFZG+J RC8bxqOSMQtwGUFhnLK12LXZKXQ7DWdR/jKUuDlwvMTPJ3LgKymC1p3OkqoecETW7M/j 5v1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:x-originating-ip:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:x-gm-message-state; bh=Qhs91IjuqRFJs5fx/Am87PkC1+mwpJvOihBit+Y99x0=; b=Ws2cyywp/6hqAVlX2SwoHaaKk0xkE0Ek3vz5gXZXDsEJ1fJm9Rj1sI6lzr/+THzaws au0sUFTOx4uwr1AUHdAkwdbUTxKQVyO5ASrHwZOkUsufpApRmMRgOtG2Agu1n4n/oU8y dfFLfRjmmqU9EaZTKYDm2O60cwbTjnGTi+ttlO68niE6b5cTOixaPPoDcNCNW+fZAwRU 8bac/DZqvIuKA0hJvait2JrINHMZhcD0Cn2VnYNnYdLWsn0n7OkDkaysiIGAvUuIOlti 1OYfMj1+dSxU4HgO6NGkiVYltBT3Wi1NNjVha8G8T4L0yap4qVfSnjSDNvkU8dVovUno x8iA== MIME-Version: 1.0 X-Received: by 10.58.233.210 with SMTP id ty18mr18504223vec.46.1361237402634; Mon, 18 Feb 2013 17:30:02 -0800 (PST) Sender: kevin@yungs.com.au Received: by 10.58.233.79 with HTTP; Mon, 18 Feb 2013 17:30:02 -0800 (PST) X-Originating-IP: [203.34.100.2] In-Reply-To: References: Date: Tue, 19 Feb 2013 12:30:02 +1100 X-Google-Sender-Auth: YuCbZfUvFt9K88A2sivswSmlQk0 Message-ID: To: Brendon Colby Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=089e0102ee7cd6cb2c04d609c789 X-Gm-Message-State: ALoCoQkuKdo/1FpTft0fB4zUf0gJlPdxm2tCcp7LY5UkiNAx5rWCJGFc9MtvwY/9LPEWxZef/xZD Subject: Re: [PHP-DEV] PHP causing high number of NFS getattr operations? From: jwrong@gmail.com (Kevin Yung) --089e0102ee7cd6cb2c04d609c789 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Brendon, In our environment, we use NFS for shared storage, we are using APC as well with stat=3D0. In our setting, we also experiencing high number of stat() calls on our file system. My initial finding of this problem is we enabled the open_basedir setting. And there is already a bug report for this, https://bugs.php.net/bug.php?id=3D52312 We tested the issue in 5.2.x, 5.3.x and 5.4.x, all of them experiencing same issue. I m not sure if this is a same problem as yours. But I do hope the community can find out a good solutions to handle the balance of better security and good performance. Cheers On Tue, Feb 19, 2013 at 7:26 AM, Brendon Colby wrot= e: > Greetings, > > This seemed like the appropriate list to discuss this - let me know if it > isn't. > > We have several Apache 2.2 / PHP 5.4 / APC 3.1.13 servers all serving > mostly PHP over NFS (we have separate servers for static content). I > have been trying to figure out why we're seeing so many getattr > requests from our Apache/PHP servers. I think I've narrowed it down to > how PHP/APC gets information about a file to see if it has been > changed since it was last cached: > > https://bugs.php.net/bug.php?id=3D59372 > > Rasmus said: > > "Just because you see an open() syscall doesn't mean the cache isn't > used. The open() is there because PHP by default does open+fstat for > performance reasons. If you look carefully you will see there is just > an open() and no read() calls. So it opens the file, uses the stat > struct from the open fd to get the inode and fetches the op_array from > the opcode cache. This can be made more efficient, but this report is > incorrect in assuming the cache isn't being used." > > This is exactly what I'm seeing when I strace an httpd process - > mostly open() and fstat() calls w/o any read() calls. This makes sense > to me, however, the problem with this is as far as I understand it, > that an open() on an NFS file system causes an automatic gettattr() > call to the server. Doing this completely bypasses the NFS attribute > cache, which is why we're seeing so many getattr requests to our NFS > server despite having an attribute cache timeout of 60 seconds. For > those familiar with NFS, we could just as well disable our attribute > cache at this point, which is almost never recommended because of > performance reasons. > > I found a good explaination of why this happens in this Redhat document: > > > http://www.redhat.com/rhecm/rest-rhecm/jcr/repository/collaboration/jcr:s= ystem/jcr:versionStorage/5e75391d7f00000110a97b91452f0cee/1/jcr:frozenNode/= rh:pdfFile.pdf > > "Avoid unnecessarily opening and closing of files. If you access a > file frequently, opening and closing that file triggers the > open=C2=ADto=C2=ADclose cache > consistency mechanism in the NFS file system. Triggering this > mechanism causes NFS getattr requests to be generated, which can slow > performance. By keeping the file open, traffic is kept to a minimum." > > I've tried doing apc.stat=3D0 and about every other combination of > options, but PHP still does an open()+3 fstat() commands on every > single page load no matter what I do. We have autoload set, so that > equates to several automatic open() (and subsequent NFS getattr()) > calls with every single PHP request. To give you an idea what kind of > load this is generating for us: > > -Out of 7,000 total NFS operations per second right now: > -About 45% are getattr calls > -Our Apache/PHP servers are generating 52% of all NFS calls > -An average of 82% of those calls are getattr requests > -As a comparison, our far busier content servers (many times the req/s > of the Apache/PHP servers) are generating half the number of NFS > requests our PHP servers are, and 98% or so of those requests are read > requests with just 1% getattr > > I am pretty proficient with patching/compiling/profiling, but sadly I > am no C coder. I've tried digging into this myself but I'm pretty out > of my element here. I'm curious if anyone on this list could give me > any pointers on what I can do to change this behavior and reduce the > load on our NFS server. If we can't change PHP behavior, we may have > to abandon NFS for our PHP files due to the load PHP appears to be > generating on our NFS server. I'd hate to do this, so please let me > know if any of you have any ideas as to what I can do to change this > behavior. > > Brendon > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --089e0102ee7cd6cb2c04d609c789--