View Single Post
Old 10-10-2009   #3
raymor
Members
 
Join Date: Mar 2004
Posts: 42
Default Re: lighttpd and nginx are silly says to try to reduce load

Quote:
Originally Posted by Hell Puppy View Post
When I see sites running like a slug today it's usually some piss poor database design and config with some sloppy PHP running on the front of it.
Absolutely. How many times have you seen pretty much this exact same code, just with
with the variable names changed to protect the cluless:

$query = "SELECT name, subject, message FROM contact";


while($i < $max)
{
$result = mysql_query(SELECT thing, thang, thung from stuff WHERE id=$i);
$row = mysql_fetch_array($result, MYSQL_ASSOC);

echo "Name :{$row['thing']}
" .
"Subject : {$row['thang']}
" .
"Message : {$row['thung']}

";
}

Umm, excuse me Mr. "programmer", wouldn't that run 500 times faster if you did the
query once instead of 500 times?:

$result = mysql_query(SELECT thing, thang, thung from stuff WHERE id < $max);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "Name :{$row['thing']}
" .
"Subject : {$row['thang']}
" .
"Message : {$row['thung']}

";
}

and you know none of the tables have any indexes.


Quote:
Originally Posted by Hell Puppy View Post
I'm guessing most people today just openly trust that their hosts' SAs are competent.
Yeah I'm hoping that in the next conversation between host and webmaster when one
of them suggests "let's add another pointless proxy web server onto this machine" the
other will reply "how about commenting out the 85% of crap we're currently running but
not using instead". Competence doesn't seem to be any more common in the hosting
industry than in so many others. Sure there a few knowledgeable people, but we regularly
spend significant time educating hosts on the basics.
__________________
Ray Morris
support AT bettercgi.com

Strongbox - The next generation in site security
Throttlebox - The next generation in intelligent bandwidth control
Clonebox - Backup (disaster recovery) on steroids
Make money with your sig
raymor is offline   Reply With Quote