Re: PHP with open_basedir performance problem
- From: Thomas Hurst <tom.hurst@xxxxxxxxx>
- Date: Sun, 27 Jan 2008 11:29:11 +0000
* Miroslav Lachman (000.fbsd@xxxxxxx) wrote:
I found a painful performance problem with Apache + PHP 5 when
open_basedir directive is enabled.
Looks like it's lstat()/readlink() overhead. I wrote a simple bit of
PHP similar to yours, but doing 10 * 1000 require "foo/%d/%d.php" calls
from the command line:
-% time ktrace php main.php
Real: 0:09.61 CPU: 99.8% (3.725/5.885) Page: 0 Swap: 0 I/O: (0/0) Mem:
13704
-% time ktrace php -d open_basedir='/home/freaky/openbasedir/foo'
main.php
Real: 0:16.21 CPU: 86.4% (8.185/5.840) Page: 0 Swap: 0 I/O: (0/0) Mem:
13696
Without open_basedir, a simple script to parse the kdump syscall times
produces:
lstat : 1.147s/70065 calls = 0.000s per call. Max=0.000s Min=0.0000s
fcntl : 0.408s/60007 calls = 0.000s per call. Max=0.000s Min=0.0000s
sigprocmask : 0.229s/40311 calls = 0.000s per call. Max=0.000s Min=0.0000s
open : 0.223s/10085 calls = 0.000s per call. Max=0.000s Min=0.0000s
With open_basedir:
lstat : 4.182s/270065 calls = 0.000s per call. Max=0.005s Min=0.0000s
readlink : 2.142s/10006 calls = 0.000s per call. Max=2.020s Min=0.0000s
fcntl : 0.421s/60007 calls = 0.000s per call. Max=0.002s Min=0.0000s
close : 0.295s/10085 calls = 0.000s per call. Max=0.115s Min=0.0000s
sigprocmask : 0.237s/40311 calls = 0.000s per call. Max=0.000s Min=0.0000s
open : 0.222s/10085 calls = 0.000s per call. Max=0.000s Min=0.0000s
The top two syscalls seem to account for most of the 6.mumble seconds of
additional runtime; presumably these are much cheaper on Linux.
--
Thomas 'Freaky' Hurst
http://hur.st/
_______________________________________________
freebsd-performance@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-performance
To unsubscribe, send any mail to "freebsd-performance-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: PHP with open_basedir performance problem
- From: Miroslav Lachman
- Re: PHP with open_basedir performance problem
- References:
- PHP with open_basedir performance problem
- From: Miroslav Lachman
- PHP with open_basedir performance problem
- Prev by Date: Re: Performance Tracker project update
- Next by Date: Re: PHP with open_basedir performance problem
- Previous by thread: PHP with open_basedir performance problem
- Next by thread: Re: PHP with open_basedir performance problem
- Index(es):