|
Posted by C. (http://symcbean.blogspot.com/) on 10/10/07 11:47
On 9 Oct, 17:10, Gilles Ganault <nos...@nospam.com> wrote:
> Hello
>
> A friend of mine is running a LAMP (PHP, MySQL, Apache,
> Debian) Web 2.0 site on a dedicated, hosted server with about 300
> connected users when it's really busy.
>
> The server is an Intel Celeron 2.4 GHz with 1GB of RAM, a 40GB IDE
> drive, and a 10Mbps bandwith.
>
> Here's what top says:
>
> Tasks: 196 total, 6 running, 181 sleeping, 8 stopped, 1 zombie
> Cpu(s): 71.6% us, 8.6% sy, 0.0% ni, 58.0% id, 0.8% wa, 0.3% hi, 0.7%
> si
> Mem: 1023656k total, 963348k used, 60308k free, 119612k buffers
> Swap: 514040k total, 0k used, 514040k free, 484324k cached
>
> The site is too slow in the evenings, but we don't have the skills to
> check why and what can be done about it.
>
> For all you LAMP experts out there: What things would you try to see
> where the bottlenecks are? Is there some kind of check-list that we
> could go through?
>
> Thanks for any tip!
Measuring bottlenecks on any system is kind of difficult. Its a lot
easier to fix the stuff which is running slowly (not the same thing).
1) set an appropriate value for the slow query log and see what's
causing the pain there (or implement you own logging for each SQL call
which will also simplify consolidation if you 'anonymize' the queries
- e.g. is query is 'SELECT * FROM widgets WHERE id={$requested_id}'
then you can log the non-interpolated version of the query)
2) fix the caching headers for static content. It's probably wrong.
3) check that you've got compression on output (mod_gzip for Apache/
static content, set_output_handler(...) for PHP which generates large
files).
3) identify PHP output which can be cached on browsers - fix the
headers (IIRC 'Vary:' breaks some MSIE)
4) identify PHP output which can be cached on the server and write
appropriate wrappers or set up a reverse proxy
4) snarf the output of 1, identify what is using up most database time
and see if it can be tuned (NB you will get more mileage from fixing a
query which takes 3 seconds and runs 10000 times a day than one which
takes 30 seconds and runs 10 times a day)
5) install a PHP accelerator if you don't already have one.
Maybe you really are reaching the limits of what you can do on one
box. But I'd be surprised if that's the case.
C.
Navigation:
[Reply to this message]
|