From: "Christian Smith" <[EMAIL PROTECTED]>

> There is going to be some performance penalty, but if it's only 1% of your
> request time, you'll have complicated your design for very little
> performance gain.
>
> Always perform benchmarks to back up your assumptions. I'm not saying your
> assumptions are necessarily wrong, but just that you should back up your
> claims before complicating your design to work round a bottleneck which
> may not be there.

Thank you for your help, and sorry for my late response.  I have taken the
benchmarks.

The apache module I am writing is an access controller.  It queries the
SQLite database and send different contents to clients depending on their IP
addresses / cookies.

When the apache module was configured to issue SQLite queries, the
performance decreased for 45% (it took 72.9 seconds, compared to 50.3 secs
when the module was configured not to issue any queries).
# test details are shown below

> There is going to be some performance penalty, but if it's only 1% of your
> request time, you'll have complicated your design for very little
> performance gain.
(snip)
> AFAIK, flock() is a kernel operation, and seek() and read() should not
> touch the disk if the data blocks required are already cached, and so all
> should be relatively cheap operations (against disk IO and network
> latencies.)

I also tried using on-memory database of SQLite.  When doing so, the
decrease was 28% (64.2 seconds).  This means that the other 27% decrease is
caused by I/O operations of SQLite.

My target is to minimize the performance penalty to less than 10%.  So it
seems I have to cache data by myself (to avoid overhead like compilation of
SQL statement, etc.)    :-(



Benchmark Information:

Test Platform:

OS: FreeBSD/5.2.1
CPU: Pentium III / 750MHz
HDD: 40GB x 2 (softupdates on)
apache: 2.0.52
SQLite: 3.0.7 (cvs version downloaded on Oct. 4th)

Total time for handing 5000 HTTP requests * 5 times:

with SQLite queries: 72.943 seconds
wo. SQLite queries: 50.299 seconds
with SQLite queries to on-memory database: 64.200 seconds

The test was performed from a different server connected by fast ethernet.
For the test apachebench 1.3d was used.  The options supplied to apachebench
were:

  % ab -k -n 5000 -c 20 http://192.168.10.221:82/

The content sent was the default root document of apache2.

Reply via email to