That way everyone can share the cache page, and the dynamic icing is separate.
That way everyone can share the cache page, and the dynamic icing is separate.
Both of these however make cache invalidation (in case of multiple browsers/computers) hard—nearly impossible even.
*Pardon my broken SQL, I don't actually know the language.
I believe the original comment was that each comments page should be cached globally and then each user can have their friend list & dynamic data fetched separately and added to the page using javascript.
Even caching a 2000 comment thread for a minute would significantly speed up that page.
Votes should be done the same way friends' lists are: on the client side, via javascript. The cached page with its comments would include Javascript to grab the most current scores for all its posts (one request) and modify the DOM appropriately.
<html> <cached comments here> <!ssi include="/load-json" /> </html>
Also, if that's such a bottleneck, create a separate webserver in C++ and keep friend relationships in RAM in some sort of an efficient data structure, something like Map [UID]->[set of friend UIDs]. Queries should be lightning fast (even if you pass a thousand UIDs in one query).