From owner-freebsd-performance@FreeBSD.ORG Sat Mar 1 22:15:15 2008 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60141106566C; Sat, 1 Mar 2008 22:15:15 +0000 (UTC) (envelope-from arkadi@mebius.lv) Received: from iklase.hosting.lv (iklase.hosting.lv [213.21.217.185]) by mx1.freebsd.org (Postfix) with ESMTP id D49E88FC25; Sat, 1 Mar 2008 22:15:14 +0000 (UTC) (envelope-from arkadi@mebius.lv) Received: from mail.hosting.lv ([62.85.37.83]:1894 "EHLO mail.hosting.lv" rhost-flags-OK-OK-OK-OK) by iklase.hosting.lv with ESMTP id S10031195AbYCAVgz (ORCPT + 1 other); Sat, 1 Mar 2008 23:36:55 +0200 Received: from [87.246.143.141] by mail.hosting.lv with esmtpsa (TLSv1:AES256-SHA:256) id 1JVZNS-000KXX-Hb; Sat, 01 Mar 2008 23:36:24 +0200 Message-ID: <47C9CC12.1090509@mebius.lv> Date: Sat, 01 Mar 2008 23:35:14 +0200 From: Arkadi Shishlov Organization: Mebius IT User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: freebsd-performance@freebsd.org References: <479B1185.8020604@quip.cz> <479D89C9.7060300@chistydom.ru> <479DD94C.7010409@mawer.org> <479DE578.7060202@quip.cz> <20080214163037.GA51014@dracon.ht-systems.ru> <47B478E6.8080902@mebius.lv> <20080227082605.GL51827@dracon.ht-systems.ru> In-Reply-To: <20080227082605.GL51827@dracon.ht-systems.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.2 (-) Cc: Stanislav Sedov Subject: Re: PHP with open_basedir performance problem X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Mar 2008 22:15:15 -0000 Stanislav Sedov wrote: > On Thu, Feb 14, 2008 at 07:22:46PM +0200 Arkadi Shishlov mentioned: >> Stanislav Sedov wrote: >>> Most basedir problems are linked with the fact it produce a lot of lstast/ >>> readlinks on every require, include or open command. On Linux it pereforms >>> even worse, as they implemented readlink there by hand, and, of course, >>> their implementation isn't particulry good. >> But there is no high sys cpu usage on Linux in contrary to FreeBSD, as >> reported by original author of the thread..? >> Do you have numbers or benchmark ready? I see the number of syscalls >> required is astonishing (on Linux) but doesn't cause any problem at first >> look. > > I don't have specific benchmark numbers, and it's true, that top on Linux > don't show such sys time usage, as on FreeBSD boxes. However, the overall > performance of boxes on FreeBSD is 30-40% higher, that Linux ones. This numbers > is empirical, but I'm pretty sure in them: in past I migrated Linux hosting > to FreeBSD-based, and after that, I was able to add a bunch of new users to > that boxes without performance impact. In fact, the load average on these > boxes are MUCH lower, that was on Linux. Also, I notices, that stat() costs > much more on Linux, that FreeBSD. I don't certainly know, why Linux shows low > sys time usage, probably it's just bugs in accounting. I can confirm the FreeBSD was significantly faster than Linux in the open_basedir test I just conducted. With open_basedir check enabled, FreeBSD throughput dropped 2x, Linux 3x, and FreeBSD is 2x faster than Linux in this situation. The test system is Pentium4 3.8GHz HT, 2MB cache, 2.5GB RAM. FreeBSD 7.0-RELEASE i386. Linux kernel 2.6.24.2 i386. Both kernels are SMP. Software is lighttpd 1.4.18, PHP 5.2.5 in FastCGI mode, without op-code cache. The index.php that was tested by ApacheBench is a do-nothing script, that just includes other scripts (in sub-dir.), that in turn include other scripts, bringing total count of includes to 25 - like in a typical PHP application. Website document root depth is 4 (/usr/local/www/data). I've varied test parameters and filesystem setup (tmpfs, mdmfs), but in overall the picture is: http | no open_basedir | with open_basedir response size> 25kB | 50B | 50B -------------+----------+----------+------------------ FreeBSD | 192/125 | 243/ 89 | 99/247 Linux | 165/116 | 152/126 | 50/382 [Requests per second / 99% of requests served within N ms] ApacheBench concurency level is 15. 10 FastCGI processes. TOP shows approximatelly 20% user / 80% system time split for both Linux and FreeBSD in all tests (so accounting is likely correct on Linux).