On mer, 2002-04-10 at 18:27, Jimmy Wales wrote:
Here's a question for everyone.
Let's say we have some portion of the page pre-calculated and cached. Is it faster to keep that cached text *in the database*, or *on the hard drive*?
I'm very strongly biased towards thinking that keeping it on the hard drive is faster, and by a significant margin, but only because I've never tested it and because I know (from long experience at Bomis) that opening up a text file on disk and spitting it out can be *really* fast, if the machine has enough ram such that the filesystem can cache lots of popular files in memory.
That's a good question, and one which I haven't made any attempt to test. As it is, we'll already be digging into the database to check things like the user settings, page view count, last edited date, and language links and meta-tag keywords (these last two gleaned from the list of links during parsing, and thus left out altogether when using the existing cache code). So it's probably not significantly slower to grab the stored HTMLized article while we're there.
On the other hand, some of this stuff (except for the page view count and user settings) could also be stored in a cache file and plunked ready-made into the output along with the HTML. User settings perhaps could be stored in a session cookie, refreshed only when the user first visits/logs in/changes preferences, saving a little extra on database access as well.
Worth it? No idea. But, hey, it's a suggestion.
-- brion vibber (brion @ pobox.com)