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.
- Author had a Free File of the Month
- Bought between 50 and 99 items
- Exclusive Author
- Has been a member for 4-5 years
- Referred between 10 and 49 users
- Sold between 10 000 and 50 000 dollars
Great! I think this feature is very useful! Thanks.
- Envato Staff
- Reviewer
- Sold between 100 000 and 250 000 dollars
- Author had a Free File of the Month
- Featured in a Magazine
- Author was Featured
- Item was Featured
- Bought between 10 and 49 items
clinton, it seems that I can’t even post comment anymore ?
- Attended a Community Meetup
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
- Author was Featured
- Beta Tester
- Bought between 1 and 9 items
- Contributed a Blog Post
- Contributed a Tutorial to a Tuts+ Site
- Envato Staff
clinton, it seems that I can’t even post comment anymore ?
I cant post comment on any item page too..
- Author had a Free File of the Month
- Bought between 50 and 99 items
- Exclusive Author
- Has been a member for 4-5 years
- Referred between 10 and 49 users
- Sold between 10 000 and 50 000 dollars
I cant post comment on any item page too..
Hmm… I’m having the same issue
- Microlancer Beta Tester
- India
- Exclusive Author
- Author was Featured
- Sold between 50 000 and 100 000 dollars
- Has been a member for 4-5 years
- Referred between 200 and 499 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
I cant post comment on any item page too..
facing same issue.
- Lead Reviewer
- Envato Staff
- Has been a member for 6-7 years
- Forum Moderator
- Won a Competition
- Author was Featured
- Item was Featured
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Canada
Looks OK here… Posted, edited, and deleted.
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.)
Looks OK here… Posted, edited, and deleted.
Hehehe, you were one of the lucky ones. All fixed now.
- Microlancer Beta Tester
- India
- Exclusive Author
- Author was Featured
- Sold between 50 000 and 100 000 dollars
- Has been a member for 4-5 years
- Referred between 200 and 499 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
now working fine, thanks
