[UPHPU] Why is require() slow?
Joseph Scott
joseph at randomnetworks.com
Wed Jan 9 17:21:39 MST 2008
On Jan 9, 2008, at 4:39 PM, Richard K Miller wrote:
> What would make require() slow? I installed APD[1] to profile a
> slow running WordPress blog, and it said the 34 calls to require()
> are taking 10.76 seconds to execute! Something must be wrong with
> my server. This is a stock installation of WordPress on FreeBSD and
> I have only one folder in my include_path.
10 seconds is way too long. The front page of my WordPress blog
(also on FreeBSD, yeah!) takes just over 1.1 seconds, with a single
post page with 9 comments taking less than 0.7 seconds. I'm also
using Donncha's WP Super Cache plugin http://wordpress.org/extend/
plugins/wp-super-cache/ which helps. I've also got APC http://
pecl.php.net/package/APC running to reduce the parse/compile over
head in PHP.
My gut instinct on really slow loading pages like this is that there
they have large content files (huge images, video embeds, etc.), but
if your profiler indicates that it is the require() that is killing
the performance I'm inclined to think it isn't a content issue.
I'd look at the performance of a simple hello world PHP page and see
what absolute lowest time your server push out a PHP file. From
there add a simple require() and keep building it up until you can
see a trend on where the performance is getting killed.
--
Joseph Scott
http://joseph.randomnetworks.com/
More information about the UPHPU
mailing list