225 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $1+ on Envato Market
  • Has been a beta tester for an Envato feature
+4 more
clinton says

Hey Guys & Gals,

After adding this feature, then removing it, then adding it, then removing it, I have added item comment editing for the third and hopefully final time. (Fingers crossed.)

For those web-developers who are interested, here is the problem that we were having:

We cache item comments because the popular item pages make up a very large portion of our traffic. This speeds up our item pages by about 10x on average.

The item comments page looks different depending on whether you are logged in (extra Flag Comment links), if you are an admin (extra admin links) or if you are not logged in (no links). In the past we were caching 3 different versions of the page for logged in, not logged in, and admin. This is not ideal from a memory perspective, but it really helps performance.

Of course, adding in an Edit link doesn’t play nice with caching because we should only show the Edit link to the person who made the comment, and only for our allowed time window. This is what caused our first failed version of comment editing, a failure to notice that it would not work with our caching.

To fix this I started caching just the data and rendering the HTML , including the relevant Flag Comment, Edit links, on each request. Unfortunately this was nowhere near as efficient as the cached HTML because Ruby/Erubis just isn’t that performant. Bummer. That was our second failed attempt. Rolled it back after about 4 hours because the drop in performance was going to kill the whole site during our peak.

So, finally, my last attempt at caching the item page with comment editing. I went back to caching the HTML of the Item page, but I also cache the underlying data. The majority of the page (the doughnut) is prerendered HTML , with little markers (‘doughnut holes’) where I have to fill in dynamic content depending on the logged-in user. (The Flag Comment, Edit links). The final result is what is presented to the user. So far this approach seems to be working okay, not quite as fast as our old caching, but at least we have the comment editing feature now.

Oh, and we are not caching the comment date any more either, so it doesn’t constantly say ‘1 minute ago’ for the latest comment. Hooray for Doughnut Caching.

86 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 50+ items on Envato Market
+2 more
YA says

Great! I think this feature is very useful! Thanks.

1633 posts fueledweb.com
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
RimmonTrieu says

clinton, it seems that I can’t even post comment anymore ?

1437 posts
  • Has referred 200+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Member of the Envato Team
+12 more
kailoon Envato team says
clinton, it seems that I can’t even post comment anymore ?

I cant post comment on any item page too..

86 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 50+ items on Envato Market
+2 more
YA says
I cant post comment on any item page too..

Hmm… I’m having the same issue

189 posts
  • Has referred 200+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has been a beta tester for an Envato feature
  • Has collected 1+ items on Envato Market
+6 more
settysantu says
I cant post comment on any item page too..

facing same issue.

3221 posts Point. Counterpoint.
  • Member of the Envato Team
  • Has been part of the Envato Community for over 7 years
  • Located in Canada
  • Joined us in one of our Envato Live Events
+14 more
ADG3studios Envato team says

Looks OK here… Posted, edited, and deleted.

225 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $1+ on Envato Market
  • Has been a beta tester for an Envato feature
+4 more
clinton says
clinton, it seems that I can’t even post comment anymore ?

Thanks, Rimmon, you were correct. I was caching the ‘post a comment’ stuff so it would depend on whether a logged-in or non-logged-in user viewed the page first. I have fixed that. Hopefully that will be the last bug for this featre. (Still got my fingers crossed.)

225 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $1+ on Envato Market
  • Has been a beta tester for an Envato feature
+4 more
clinton says
Looks OK here… Posted, edited, and deleted.

Hehehe, you were one of the lucky ones. All fixed now.

189 posts
  • Has referred 200+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has been a beta tester for an Envato feature
  • Has collected 1+ items on Envato Market
+6 more
settysantu says

now working fine, thanks

by
by
by
by
by
by