Erik,

thaks for the reply.  I conducted a simple/rough benchmark to which is more
expensive.  I tested on a Intel PIII (450MHz 384MB ram) box running Win Xp,
Apache 1.3.26 and PHP 4.2.1, and mysql 3.23.49  and freeBSD of similar stats
(1000MHz, 1G ram).  I used the adodb database abstraction layer to make my
connections (which adds extra weigt to the db initialization and queries,
but this is the default method I use to access databases) to a db, and then
queried a smallish db with a "select * from table."  I then benchmarked a
file read of a similarily sized file.

Win DB results average (not including the include of the adodb class):
                 time index                            ex time
%
Start        1024676092.32095600        -                            0.00%
init db      1024676092.34258300        0.021627               75.19%
query       1024676092.34942600        0.006843               23.79%
close        1024676092.34963100        0.000205               0.71%
Stop        1024676092.34971900        0.000088                0.31%
total         -                                           0.028763
100.00%


Win Filesystem results average:
                 time index                            ex time
%
Start         1024676092.35610400        -                            0.00%
file open    1024676092.35685300      0.000749               28.59%
read          1024676092.35846200      0.001609               61.41%
close         1024676092.35863700      0.000175               6.68%
Stop          1024676092.35872400      0.000087               3.32%
total            -                                         0.002620
100.00%


freeBSD DB results average (not including the include of the adodb class):
                 time index                            ex time
%
Start          1024677559.22131200       -                            0.00%
init adodb  1024677559.22266700       0.001355               75.66%
query         1024677559.22303400       0.000367               20.49%
close          1024677559.22307900       0.000045               2.51%
Stop          1024677559.22310300       0.000024                1.34%
total           -                                          0.001791
100.00%

freeBSD Filesystem results average:
                time index                              ex time
%
Start         1024677559.22374400        -
0.00%
file open    1024677559.22380700      0.000063                   11.23%
read          1024677559.22423200      0.000425                   75.76%
close         1024677559.22428200      0.000050                    8.91%
Stop          1024677559.22430500     0.000023                    4.10%
total            -                                        0.000561
100.00%


On the win box, file system access was 11 times faster, while on the freeBSD
box, file system access was 3 times faster.  The include of the adodb class
is not benchmarked, as part of this test, that that adds extra overhead as
well.

I suppose that filesystem access is faster.

Michael


"Erik Price" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> On Friday, June 21, 2002, at 11:19  AM, mike wrote:
>
> > I was reading somewhere (can't remember where) that connecting to a db
> > is a
> > pretty costly transaction.  DB queries aside, does anyone know of any
> > benchmarks that demonstrate file access vs. db connections?
> >
> > Similarily, while DB queries offer alot of power, would it be cheaper
> > (faster) to drop simple information that does not require heavy queries
> > into
> > a file and access it through the file system?
>
> I don't have any stats, but I think it really depends.  If you're
> executing a really complex query that uses like six JOINs and eight
> WHERE clauses, then the bottleneck is the DB and not the DB access
> itself, so it would probably be quicker to have this information ready
> in a file (or even better, cached in memory somehow, though I have no
> experience doing this).  But I believe that with a simpler DB query, a
> DB access is faster than a file read.
>
> Here's something that turned up in Google...
> http://phplens.com/lens/php-book/optimizing-debugging-php.php
>
>
> Erik
>
>
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to