Yes, a filesystem hit is a filesystem hit .. And yes, be worried about the
number of GIF files you serve. Less is always better in this. 

What I meant in my advice about the readfile() function is that it makes a
big deal of a difference whether a file is sent directly to the client, or
first also read in the momory of you php file. Just try it.
        - Make a file with about 10000 lines (or more, just to make the
difference measurable by a regular watch.
        - make two php scripts
                -1. <?php readfile('/path/file.txt'); ?>
                -2. <?php $fd = fopen('/path/file.txt', 'r'); $Buffer =
fread($fd, filesize('/path/file.txt'); print $Buffer; ?>

        - Notice the difference in speed and lines of code.

>> Creating indexes on columns that appear in your WHERE clauses can 
>> drastically increase performance when hitting the database. Be sure to 
>> read your database documentation on creating indexes.

Yes, this is true. But please be aware of the fact that INSERTS on tables
with indexes are in fact slower. Just as UPDATES on indexed columns. Also,
if you have a query like:

        SELECT column1, column2, column3 FROM tablename WHERE column4 =
'foo' AND column5 = 'bar';

Having an index on just column4 or just column5 doesn't do any good. You
will need a index on BOTH columns 

        alter table `tablename` add index name (column4, column5) 

I think the syntax would be.

Gosh, this is getting more and more interesting.. (seriously)

Wouter

-----Original Message-----
From: olinux [mailto:[EMAIL PROTECTED] 
Sent: Thursday 06 November 2003 07:28
To: [EMAIL PROTECTED]
Subject: RE: [PHP] High bandwidth application tips


[snip]

> I fourth the thing about database access. As long as you realize that 
> reading from disk isn't the fastest thing around either. Make sure you 
> reduce the number of files to be read to as little as possible. And 
> output with something like readfile() to prevent the files being 
> loaded into memory.

[/snip]

A filesystem hit is a filesystem hit whether your requesting a php file or
an image for a button. If you are worried about filesystem hits then
shouldn't you also be worried about uneccessarily using GIF's etc.
in your page layouts. Likewise cleaning up bloated HTML code and properly
using CSS can cut down page filesizes dramatically, saving bandwidth for the
server and clients. If users are potentially using dialup, cutting 20K off
your pages will make them a lot happier than shaving a couple tenths of a
second off the backend processes. (not saying you should not be performance
focused on the backend as well.)

olinux



__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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

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

Reply via email to