Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64121 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4529 invoked from network); 30 Nov 2012 14:55:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2012 14:55:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=ralph@ralphschindler.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ralph@ralphschindler.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ralphschindler.com from 209.85.214.170 cause and error) X-PHP-List-Original-Sender: ralph@ralphschindler.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:54422] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/91-23831-1C8C8B05 for ; Fri, 30 Nov 2012 09:54:58 -0500 Received: by mail-ob0-f170.google.com with SMTP id wp18so487570obc.29 for ; Fri, 30 Nov 2012 06:54:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=QGs2S2OFmVktp7q+0upYW6P/md+/gqT0Nei0Qx1RIjg=; b=XqNSxkAMNpvU8JD2tEF4PO5Mp41u6eRfJ1Q12Izv/KX0xk6NFepnTwAZ6tfpJSCEoU 5aUeLcMyny8nKTIURF5XvgIpkhteqs4fpyMRcEbc1Ll3QOa8uyIFK7BK4AFh6lQfo7oF +oSv45cBHaBLveZ6LKVTs3qNFDmc1s+NEIJ+DhxaxJmoXMf55GCLEwe67SXCw8TdyTw8 9L03PhqgOab0s3Ra9YLalMfSUiRSubSPfNVpLCUR+IgjLifKgEvBIPfuCCabUjPOMmee 1CCX+XsEnGS2rmRUpqv3ckVa0PUyzoCjUpDd0dexF3oXiOmTpE/Q1IEnKwo4zbUG8dnO YgEA== Received: by 10.182.52.105 with SMTP id s9mr1202802obo.25.1354287294215; Fri, 30 Nov 2012 06:54:54 -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 c18sm5014316obc.17.2012.11.30.06.54.52 (version=SSLv3 cipher=OTHER); Fri, 30 Nov 2012 06:54:53 -0800 (PST) Message-ID: <50B8C8BB.7010409@ralphschindler.com> Date: Fri, 30 Nov 2012 08:54:51 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: internals Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlEuajWEO5zgp9O4dOFqC3w5nq/47Xwm2w59PR35pQ8x1UMUx4fFCqvbVZM7Fsp0HxV0+Uy Subject: APC + Phar Performance (x-post from pecl.dev) From: ralph@ralphschindler.com (Ralph Schindler) 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