[wp-hackers] Improving performance for lots of comments
Roger Chen
developer at rogerhub.com
Mon Oct 7 00:11:49 UTC 2013
Thanks Casey, your tips helped a lot.
I settled on storing the comment markup in APC via the WP Transients API
for all comments past the first hundred. Each comment was keyed
individually, since I had surrounding markup based on the comment's
location as well. Response times have gone from ~5500ms to ~1000ms for
logged-in users.
Roger
On Mon, Sep 30, 2013 at 6:08 PM, Casey Bisson <casey.bisson at gmail.com>wrote:
> Roger,
>
> I've faced similar problems elsewhere. The solution I used at the time was
> to capture the comment markup and save it as meta on the post. In most
> cases the template would fetch the markup from the post meta rather than
> generating it fresh.
>
> Any time a comment was added or removed, etc, the cache was deleted and
> the list regenerated.
>
> The performance improvement for posts with hundreds or thousands of
> comments was ten to 20 seconds.
>
> Since then we've shifted to paged comments, though because of how the
> comment walker class works, we still suffer many of the performance affects
> related to iterating all the comments that we did previously.
>
> Another important aspect to consider is gravatars. 1000 gravatars can take
> many tens of seconds to load in the browser. Lazy loading those has a huge
> performance effect.
>
> --Casey Bisson
>
> > On Sep 30, 2013, at 4:23 PM, Roger Chen <developer at rogerhub.com> wrote:
> >
> > Hi all,
> >
> > One of my WordPress pages has 2,000+ comments and when I visit it, it can
> > take 5-6 seconds to load. Of course, this isn't a problem for visitors
> > because a cached version gets served, but it is still annoying to have to
> > wait that long for all of the comments to render. I don't want to break
> the
> > comments into pages either, since all of those comments are a huge SEO
> > boost.
> >
> > I have removed cut down my comments template to the bare minimum, but the
> > comment markup loop still takes too long. I wish there were some way for
> > WordPress to automatically cache the markup for past comments so that
> every
> > time a new comment is posted, it only needs to generate markup for new
> > comments.
> >
> > Does anyone have experience with something like this?
> >
> > Roger
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list