[wp-hackers] Paged Comments and Memory Usage
wp-hackers at google-adsense-templates.co.uk
Tue Feb 14 12:33:34 UTC 2012
Ran into an interesting issue.
Moved a very popular domain over the weekend from one virtual
dedicated server that was struggling to a new one (Centos 5.6, control
On the old server (same basic setup) I'd changed various PHP and MySQL
settings, on the new one I'd not made any changes from the default
The posts with above 2,000 comments (6 posts) were broken, the page
was loading up to where comments are loaded, so the pages were
Checked the error logs and had loads of these errors:
[Mon Feb 13 11:03:43 2012] [error] [client *******] PHP Fatal error:
Allowed memory size of 33554432 bytes exhausted (tried to allocate 35
bytes) in /home/*******/public_html/wp-includes/comment.php on line
1941, referer: **********
Basically the comments weren't loading at all so the page was
truncated below the main content.
I changed allowed memory to 64mb and the pages load now.
I have the site set to paged comments, the post with 8,000 comments is
paged over 132 pages for example.
Relevant discussion settings are:
Enable threaded 10 levels deep
Break comments into pages, 20 top level
I'd assumed WordPress would only access the comments that are loaded
on the page, so if I go to comments paged 27 and it's got 50 comments
in total only those 50 comments are accessed, but this issue suggests
a lot more than the comments shown in a browser are accessed and this
is using a lot of memory.
Are all comments for a post accessed when a page is loaded?
If so any ideas to reduce the load?
I ran into a similar issue a few years back, I wanted to use the
<!--nextpage--> WordPress feature for a public domain books site,
wanted to upload entire books as a post and split them using nextpage
but the entire book (some books several MBs in size) was accessed each
page load and it would timeout.
http://www.stallion-theme.com/ Stallion WordPress SEO Theme
WordPress SEO Plugin
More information about the wp-hackers