Attempts to cache data have always been in conflict with the desire to have as dynamic pages as possible. In my current knowledge, the current modus operandi of systems that want to cache and be dynamic at the same time pre-generate as much of the page code as possible, and then perform a few simple string substitutions afterwards.
I'd like to propose this one more step further: generate and cache the static page, and serve the dynamic content via JavaScript/AJAX! Is this feasible? Accessible? I suppose for essential dynamic data this wouldn't work well, as well as interactive pages.
My ulterior motive is that I'm trying to figure out performance-friendly ways of using XSLT in high-traffic contexts. It's such a great language, pity that it consumes so many resources.
Caching and dynamic content
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Re: Caching and dynamic content
XSLT is extremely fast, if you use the right parser.Ambush Commander wrote: My ulterior motive is that I'm trying to figure out performance-friendly ways of using XSLT in high-traffic contexts. It's such a great language, pity that it consumes so many resources.
We have libxslt and libxml2 compiled into a custom apache module. This guy handles 10 million transforms per month off a single Sun Ultra 60 (450mhz).
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
The apache module is written entirely in C++ and does the transforms internally. PHP on a different server talks to the apache module through SOAP requests.Ambush Commander wrote:Mmm... that's about four transforms a second. Not too shabby. Though, are you invoking it with PHP as a separate process (which probably would be quite slow) or is Apache handling the transforms itself?
The XSLTs are sitting on disk and the XMLs are either built on-the-fly by the apache module, or pulled from mysql (by the apache module) depending on the SOAP request.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US