Fastcgi-cache with lots of comments


#1

One of my clients runs a site that gets heavy numbers of comments on every post and a lot of activity by the authors of those comments. The result is that I see a lot of BYPASS in the access.log, and the server is having to render everything dynamically for those users constantly because they have the comment_author_ cookie.

Using nginx-helper, I have it set to purge a page when a comment is published for that post.

So my question is, do we really need to BYPASS the cache for comment authors? Given that nginx-helper is purging as soon as each comment is posted, won’t comment authors already get a freshly generated page?

Has anyone experimented with this?


#2

On a quick test, I was able to remove comment_author from the cache bypass and then left a comment and when the page refreshed i got a page that included the new comment and when i refreshed that page (still having the comment_author cookie in my browser), i got the cache page.

So as far as I can tell, there isn’t any good reason to bypass the cache based on having that comment_author cookie if you are using nginx-helper to purge the cache on new comments.

Am I missing something?


#3

On a site where comment moderation is on, BYPASS is needed so WordPress can show message saying “your comment is awaiting moderation”


#4

Also, for a site with lots of comments, I recommend using disqus or other third party system. Nothing about speed or nginx. As site admin, I find those system easy to administrator. :smile:


#5

Ah so. Well, luckily for me the specific site that I am most worried about all the BYPASS log entries on has moderation turned off so taking out the cache bypass for commenters on that site is a win with no downside.

I do also run some other sites for clients who have moderation turned on. Wish there was a way to push that moderation message with javascript/ajax so that commenters could use the cache. That cookie lasts a year! So someone leaves a comment and for a year whenever they visit the site they hit php instead of the cache. :frowning:


#6

That cookie lasts a year!

That is really serious. Cookie is used for auto-filling name, email and site details. So long duration makes sense. But then using cookie message display can be shifted to client-side (js). Only thing is that JS based logic, need to be checked against different theme markup.

This need to be looked into more depth. We need to see how WordPress displays message.


#7

In my testing when I was receiving the cached page after leaving a comment (after I took comment_author out of the strings that bypass the cache in the nginx config), I was still seeing my name, email, site get auto-filled in the leave comment form. Could that stuff already be happening on the client side?


#8

I think form filling is done my javascript.

You may disable javascript and check again. :wink:


#9

So I tried taking the comment_author cache bypass out of nginx in production under load and there were problems. nginx was caching stuff with commenters names and emails and other commenters were then seeing those cached pages.

So unfortunately it doesn’t seem to be viable to allow caching for commenters. It’s too bad because that is really a lot of extra load on a site that has a lot of comment traffic.


#10

I think for may be another reason that top WordPress sites do use external comment system!

If nginx is caching stuff with commenters name, then comment-form-filling must be handled on server side. :expressionless:


#11

Yes and yes.

Unfortunately, for the site I am trying to optimize, the client and the community there would be resistant to changing anything.

For another site that I am hosting, I’m getting ready to implement commenting and integrated forum using discourse (same system we are using now) via the discourse wp plugin. Have you guys ever done that integration anywhere?


#12

Haven’t used that discourse plugin yet. But it seems easy.

Personally I never liked linking blog posts to forum topic. For blog posts, among third party, I prefer disqus. They all are almost similar. As long as a third party system provides 2-way sync with WordPress, it’s fine with me. I am more concerned about data lock-in rather than features.


#13