Excessive load time and memory usage on posts with many spam comments
3 views
Skip to first unread message
Jonathan Street
unread,
Oct 30, 2010, 1:01:17 PM10/30/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to habar...@googlegroups.com
I was on the IRC channel yesterday trying to figure out why habari was causing the processes on my apache server to reach ~80Mb and due to some less than perfect settings the whole server to freeze up under relatively little load. Although several people tried to help and offered several useful comments we weren't able to identify the problem. I've taken another look today and have finally been able to figure out what the problem is.
I had initially thought it was every page causing the problem but with a considerable amount of trial and error I stumbled onto the discovery that it was only one blog post and any page that referenced it. Fetching most pages used ~6Mb of memory as measured by memory_get_peak_usage but this one blog post would use ~63Mb. It would also take considerably longer to load than other pages (>10s). Using xdebug and kcachegrind I noticed that most of the time was spent getting and setting Comment objects.
Looking at the comments in the database I realised that a) I had a lot of spam comments that needed deleting and b) the vast majority were on this one post. Deleting the spam comments seems to have fixed the problem. Memory usage drops back down to ~6Mb and requesting the page is faster as well.
Hopefully this will be useful to someone else in the future.
Caius Durling
unread,
Nov 8, 2010, 9:24:09 PM11/8/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to habar...@googlegroups.com
This sounds like it's pulling spam comments out when viewing a blog post - or your theme is doing so. That kind of filtering should be done by the database, so you should only be using ~6MB of memory whether you've got 0 spam comments or 5000.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to habar...@googlegroups.com
That was my understanding as well. This is also a problem when the number of comments is displayed even if the comments themselves are not. I'm using a custom theme but I don't think I made any alterations to the comments file. It's possible that a plugin is responsible but although I find that unlikely I haven't attempted to repeat this problem on a fresh install.
For the moment I'll leave everything as is. It will take a while for things to build up to the state they were in and when that time comes I'll just run a query on the database to clear the spam messages again.