[wp-testers] Too slow...

Mark Jaquith mark.wordpress at txfx.net
Sun Jan 22 16:34:11 GMT 2006


On Jan 22, 2006, at 9:20 AM, Paolo Gabrielli wrote:

> This "problem" is only on the front page, but I think is relevant.
> Is there anyone with an installation with so many posts? If so, what
> have you done?

I help admin a popular WP install with 50,000 + posts that suffered  
from chronic slowness on the front page, especially.  The site gets  
50,000+ page views a day, and was getting crushed by the volume.  As  
you also discovered, it was the posts query that was the killer.

Here is the solution I came up with:

(1) enable MySQL's Qcache (Google it to find out how)
(2) use this custom plugin: http://txfx.net/files/wordpress/post- 
query-accelerator.phps
(3) use wp-cache2 plugin

wp-cache2 obviously helps by caching the output of pages.  Still, the  
query needs to be made sometimes, so (1) and (2) help there. Qcache  
caches MySQL queries.  The problem there is that the query needs to  
be exactly the same to be cached.  WP's post query uses a dynamic  
$now ( WHERE post_date_gmt < '$now' ) that makes the query different  
each time it is run.

My custom plugin freezes the $now value, setting it to the time of  
the most recent post... so that the posts query remains the same  
until a new post is made, and is able to be cached by Qcache.  This  
reduced the burden a LOT.  I also went crazy with query optimization,  
getting the front page down to 7 queries.

--
Mark Jaquith
http://txfx.net/




More information about the wp-testers mailing list