Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65564 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84670 invoked from network); 2 Feb 2013 16:12:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2013 16:12:25 -0000 Authentication-Results: pb1.pair.com header.from=ralph@ralphschindler.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ralph@ralphschindler.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ralphschindler.com from 209.85.214.181 cause and error) X-PHP-List-Original-Sender: ralph@ralphschindler.com X-Host-Fingerprint: 209.85.214.181 mail-ob0-f181.google.com Received: from [209.85.214.181] ([209.85.214.181:47720] helo=mail-ob0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/02-63259-7EA3D015 for ; Sat, 02 Feb 2013 11:12:24 -0500 Received: by mail-ob0-f181.google.com with SMTP id ni5so5124918obc.12 for ; Sat, 02 Feb 2013 08:12:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=M3Q85v4RkM13c9/U3S/4JRirclmt/7RJlRvdgfJaiQw=; b=ZREl+498Z8RbM/Mdi1iT4qT4sRyqeX+WLgodi9S+wTr01UcPq4q2byuLOAaiWLusKH oOhKcI/FshvrrytUAwj97mlvN8R477tb0b/N8dPe4ZdDNFQQlxwg9cq1mwk88dKK5rQX q7lofHzHBqi2t1PjzHugFgiiRxEQmeWk00qi+yPTbLEc4t+yRfpfKU7SMdpljspUcUD6 NWk/EO//5gI1GZnCywqe0gnHL55Wy9+HkmP2PD4hROOybgbVpkMr323cEiw4H6QHaPzO PutH06fiyLpK8H/DugmhT2YM/VTS95GLWsBAnRw2pVCL/ZjZbFblVItB4dsNTlleuERq 82cQ== X-Received: by 10.182.26.114 with SMTP id k18mr11558970obg.94.1359821541449; Sat, 02 Feb 2013 08:12:21 -0800 (PST) Received: from Ralphs-Mac-Pro.local (ip174-73-14-247.no.no.cox.net. [174.73.14.247]) by mx.google.com with ESMTPS id c4sm14132353oee.0.2013.02.02.08.12.19 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 02 Feb 2013 08:12:20 -0800 (PST) Message-ID: <510D3AE2.4050700@ralphschindler.com> Date: Sat, 02 Feb 2013 10:12:18 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: internals References: <50B8C8BB.7010409@ralphschindler.com> In-Reply-To: <50B8C8BB.7010409@ralphschindler.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQldWV9D0oFRl5I8akxipRT2EKp0TlcPt1XJqykILEYB6ZH2hoH+Z2LbMhG3LCR/2XizzpAw Subject: Re: APC + Phar Performance (x-post from pecl.dev) From: ralph@ralphschindler.com (Ralph Schindler) Hi all, After re-testing this scenario against Zend Optimizer+ on OS.X in 5.4 yesterday ... it's worth noting that Zend Optimizer+ *does not* suffer from the same file stat/include_path problems that APC does when dealing with phars. An unpacked phar to filesystem (with autoloader, using absolutely path with __DIR__) performs the same as phar (autoloader as stub using include 'phar://' . __FILE__ . '/' . $fileInPhar). -ralph On 11/30/12 8:54 AM, Ralph Schindler wrote: > Hey all, > > After reading this post ( > http://www.reddit.com/r/PHP/comments/13uwgk/phar_performance/ ), and > having my own curiosity of the current state of things, I wanted to dig > in an see what the performance of APC with phar files was. > > I've found some oddities in performance, and I am hoping before I do any > deeper investigation, someone might know something. > > The app is here: > https://github.com/ralphschindler/test-phar-performance-apc/ > > The library I am attempting to introduce to the app is Zend_Db.phar. I > chose this b/c I fully know the code base, and the phar clocks in at > 519844 bytes uncompressed. > > It breaks down like this: > /index.php - baseline app without addition of library > /index-with-filesys.php - Zend_Db library extracted to filesystem > /index-with-phar.php - Zend_Db as phar included > > Without APC, on my machine, I get a slight drop off, but acceptable. > With APC, the drop off in performance is very noticable. Even with > stat=0, only in a very specific usage scenario (described below) does it > actually nullify phar vs. filesystem. > > > Without APC (enabled=0) > ----------------------- > > $ ab -H "Connection: close" -n 500 http://test.dev/index-with-filesys.php > > Requests per second: 111.19 [#/sec] (mean) > Time per request: 8.994 [ms] (mean) > > > $ ab -H "Connection: close" -n 500 http://test.dev/index-with-phar.php > > Requests per second: 87.49 [#/sec] (mean) > Time per request: 11.429 [ms] (mean) > > > Then APC 3.1.13 (Beta) is introduced, the app is clearly faster on the > filesystem, but not nearly as fast one would expect in the phar version: > > > With APC (enabled=1, stat=1) > ---------------------------- > > $ ab -H "Connection: close" -n 500 http://test.dev/index-with-filesys.php > > Requests per second: 474.47 [#/sec] (mean) > Time per request: 2.108 [ms] (mean) > > > $ ab -H "Connection: close" -n 500 http://test.dev/index-with-phar.php > > Requests per second: 238.84 [#/sec] (mean) > Time per request: 4.187 [ms] (mean) > > > With APC (enabled=1, stat=0) > ---------------------------- > > $ ab -H "Connection: close" -n 500 http://test.dev/index-with-filesys.php > > Requests per second: 529.02 [#/sec] (mean) > Time per request: 1.890 [ms] (mean) > > > $ ab -H "Connection: close" -n 500 http://test.dev/index-with-phar.php > > Requests per second: 246.71 [#/sec] (mean) > Time per request: 4.053 [ms] (mean) > > > > > With APC (enabled=1, stat=0) (With include_path hack) > ----------------------------------------------------- > > If this line: > > require '../vendor/Zend_Db-2.1.0beta1.phar'; > > is swapped out with this (to ensure the require is relative to include): > > set_include_path('.:' . realpath(__DIR__ . '/../vendor')); > require 'Zend_Db-2.1.0beta1.phar'; > > I get the following: > > $ ab -H "Connection: close" -n 500 http://test.dev/index-with-phar.php > > Requests per second: 522.68 [#/sec] (mean) > Time per request: 1.913 [ms] (mean) > > > > Can someone help me make sense of all this? Here are my questions: > > * The phar files are listed in the apc_cache_info() with >1 hits, are > the stat's to those phar files really much slower than to filesystem files? > > * Why does the include_path trick affect performance with regards to > phar files? > > > > > -ralph