From: "Christian Smith" <[EMAIL PROTECTED]>
> On Tue, 28 Sep 2004, Kazuho Oku wrote:

> >Unfortunately, my apache module only performs a single SELECT clause of
> >which WHERE clause can be indexed.
> >What I am wondering is the way to stop calling SQLite each time the
module
> >processes an HTTP request (eliminate the FLOCK -> READ -> FUNLOCK done by
> >SQLite).
>
> Is this an actual bottleneck? Against internet latencies, this is likely
> not to be that big a win.
>
> It will not be significantly slower than any other filesystem operation,
> such as checking for an indicator file, especially if you then remove the
> indicator file (synchronous disk operations!)

It's not the latency that is the problem.
The problem is the performance decrease caused by the module I am
developing.

When apache (without my module) sends a static file, the disk-related system
calls that it issues are: stat(), open(), mmap(), munmap(), write(), once
for each.
If my module did not cache database information, then it would issue flock()
twice, and multiple seek()s and read()s.
Although I have not benchmarked, my understanding is that this would be of
(at least) some performance penalty.
This is the reason why I think caching is necessary.

> Does the cache have to be in sync with the current database all the time.
> ie. Would it be satisfactory to simply check the database once per second,
> and only update the cache then? This would certainly reduce any SQLite
> overhead significantly.

Since apache is a multiprocess server, I do not think rereading the database
periodically is a good idea.
Typical usage would be to update the database through a CGI and then access
through the updated database from a different HTTP connection.  So I cannot
make the interval between rereads long.

Reply via email to