Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 01 Mar 2008 23:35:14 +0200
From:      Arkadi Shishlov <arkadi@mebius.lv>
To:        freebsd-performance@freebsd.org
Cc:        Stanislav Sedov <stas@FreeBSD.org>
Subject:   Re: PHP with open_basedir performance problem
Message-ID:  <47C9CC12.1090509@mebius.lv>
In-Reply-To: <20080227082605.GL51827@dracon.ht-systems.ru>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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).




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47C9CC12.1090509>