Hi,
This is not a problem with a specific page but it is something I have come across on many sites I have worked on with and with different technologies. I would appreciate your opinions or links to pages that discuss the issue since I have not been able to get relevant search results.
I am interested in caching a dynamic page on the server rather than recreating it on every access. I know that sounds like defeating the purpose of dynamic pages but I think there is value for it. And I don’t mean caching for a user in the event of revisiting the page. I want to serve a cache copy to all users.
Think of a high traffic site, say 100+ hits per second and the home page including 15 queries to the database. The user cannot post to this site so it cannot tell whether a copy is current or 5 seconds old. So if the content was generated every 10 seconds and served to all users as static content it would save tens of thousand of database queries which may not all be fast.
With Servlets I could have a thread generating the content and saving it in a String and just printing it out for every GET request. This does not seem as simple with PHP.
Some solutions come to mind, such as having a process generating the page and adding it to the database to be retrieved by a single very fast query. Are such techniques being practiced?
I am looking for “best practices” or “tried and tested” ways of doing this. I could not find anything relevant by searching google but this would be very useful for certain sites. Any thoughts would be appreciated.
Thanks
yiannis