On Thu, 2020-04-09 at 10:08 +0200, Mickael Desfrenes wrote:
My goal was to get faster results when a query is run multiple times. Yes, that's probably premature optimization, but since I do require these things in other application stacks I thought I'd ask.
I have a Perl-based framework that kept a cache of results). But, the time taken to open a cache file and read it is often longer than it takes BaseX to run the query. The main value is that there are a couple of queries that are much slower.
I've also used memcached via php in a front end, and that's faster.
One of that hardest things about cache management, though, is invalidating pages when the data changes. For https://www.fromoldbooks.org/Search/ i just blow away the whole cache and then pre-fetch the 100 or so most common queries, one per second.
But the front page on fromoldbooks.org is not cached and is just about as fast as a search. The sweet spot for Web back ends is still that you need a Web page to finish loading in under two seconds to stop Google from hating you :)
Liam