[UPHPU] Why is require() slow?

Richard K Miller richardkmiller at gmail.com
Wed Jan 9 18:12:04 MST 2008


On Jan 9, 2008, at 5:21 PM, Joseph Scott wrote:

>
> 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.


I've generally been impressed with WordPress performance. I maintain  
WordPress blogs for 30 people, none of which have caching plugins, and  
none of them are this slow. What's funny is that this blog is running  
on the same server as MediaWiki and MediaWiki isn't slow at all. So I  
can't blame it on Wordpress nor can I blame it on the PHP/MySQL (I  
think.)

I like your idea of adding more and more require()'s to a simple file  
to see if that causes the slowdown. I'll try that.




More information about the UPHPU mailing list