Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Mar 2000 15:36:20 -0600
From:      "Sean Heber" <sean@fifthace.com>
To:        <questions@freebsd.org>
Subject:   Flooded in hits! Suggestions?
Message-ID:  <000d01bf99c6$d38a6520$f97338d1@central.edu>

next in thread | raw e-mail | index | archive | help
I run a BeOS file site (like freshmeat or winfiles.com) and as you may 
or may not know, BeOS R5 was released for free yesterday.  However, 
today my site is being hit very very hard by people looking for 
software.  And that's the problem.

FreeBSD 3.3-RELEASE
Dual PII at 400Mhz
256MB of RAM

The site is using Apache (of course), PHP4, and mySQL.  The problem is, 
the site is nearly totaly dynamic and we were not quite prepared for 
this kind of a rush of traffic.  We're under a redesign at the moment to 
use better and fewer queries, etc, but that's too far off to move to 
live right now.  So, I'm wonder what I can do to help overcome the 
problems we are having.

It seems mySQL just can't keep up and the queries are taking too long to 
complete.  So, not only does that make the site slow, but very quickly 
Apache reaches its maximum client limit and so things get REALLY slow 
(since the queries are slow and you have to wait for an open connection 
and all those backed up connections that are active are slowing mysql 
down even more, etc..).   Someone had suggested I try putting squid in 
front of the webserver by changing the webserver's port and then 
configuring squid to use port 80.  I tried this, but it didn't seem to 
make any difference.  If this can be done and will help, does anyone 
have a squid config file for this?  I might have missed something 
important..

Also, are there any specific mysql command-line options I could use to 
speed things up?  I've anaylzed my queries pretty closely and did manage 
to find one case where an index solved a lot of problems, but I've 
looked further and can't see that I'm missing any more important 
indexes.  So now it just seems to be a matter of mysql not being able to 
complete the queries quite fast enough.  (The site seems to be too 
dynamic for it's own good..)

I've messed with setting the "ulimit -n" line in safe_mysqld and all 
that.  It helped a bit, but still not enough to increase the speed far 
enough to avoid the connection backups.

So, what can I do?  Any suggestions?   Please don't suggest that I 
rebuild the whole site using static pages as I already know about that 
option.  The problem I have with that option, though, is I would still 
need to record all of the download and voting stats, etc, and I would 
have to re-write most of the site just so the stats could be recorded 
while redirecting back to a static version of the page.  (If you've ever 
done PHP programming, you know how the code is embeded right in the page 
and so HTML and code are all just one big mess making it VERY hard to 
split it apart).  Also, adding more servers is not realistic (we have no 
money. :-).  Adding RAM is something we plan on doing, but that could 
take awhile to get it shipped and installed, etc. and I'm not totaly 
convinced that it would solve the speed problems anyway (mysql alone is 
taking about 110MB of Ram, so I'm sure it should have stuff pretty well 
cached the way it is..)  I've got Apache limited to 180 clients and it's 
almost always full due to the slow queries.  I can't set that any higher 
as we don't have the RAM for it and it starts to swap otherwise (which 
is very evil).

Hopefully this is enough information.  I'm sure someone out there has 
had this problem before and I'd appreciate hearing a solution!

Thanks.

l8r
Sean
BeBits Admin
http://www.bebits.com/




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000d01bf99c6$d38a6520$f97338d1>