473,698 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to investigate slow LAMP site?

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!
Oct 9 '07 #1
6 2629
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gilles Ganault 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!
In your code (I'm using PHP for example here, adjust to your language)
disable any output from it and insert echo time(); every now and then.
Once you've run that, consolidate the numbers into something like gnuplot
(I'm guessing you're using linux here) and make a graph to see where the
page takes most of the time.

- --
Brendan Gillatt
brendan {at} brendangillatt {dot} co {dot} uk
http://www.brendangillatt.co.uk
PGP Key: http://pgp.mit.edu:11371/pks/lookup?...rch=0xBACD7433
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)

iD8DBQFHC66NkA9 dCbrNdDMRAoAkAK Ccxc0CnYnoT9ib/2D4q5CdWpur3QCg lPVw
Fm7BxGhrGCMKYGJ 7/jLm//4=
=T5Mw
-----END PGP SIGNATURE-----
Oct 9 '07 #2
On Tue, 09 Oct 2007 17:38:37 +0100, Brendan Gillatt
<br************ ***@brendanREMO VETHISgillatt.c o.ukwrote:
>In your code (I'm using PHP for example here, adjust to your language)
disable any output from it and insert echo time(); every now and then.
Once you've run that, consolidate the numbers into something like gnuplot
(I'm guessing you're using linux here) and make a graph to see where the
page takes most of the time.
Thanks for the tip. I'll give it a shot.
Oct 9 '07 #3
NC
On Oct 9, 9:10 am, Gilles Ganault <nos...@nospam. comwrote:
>
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.
You should consider hiring someone with the skills to give you a
definite answer. Here in the newsgroup, we can hypothesize until we
turn blue, but only actual hands-on work with your application can
tell if the hypotheses we advance are anywhere near reality.
What things would you try to see where the bottlenecks are?
Is there some kind of check-list that we could go through?
Since your problems seem to arise during peak hours, and neither
memory nor CPU seems to be overloaded, a natural first guess is that
the holdup is with disk I/O, more specifically, in the database
interaction. What to do about it will depend on your database usage
patterns. If your application is write-intensive, you may be nearing
your hardware's capacity, and the only way to improve performance is
to upgrade the hardware (do check the UPDATE queries though; you may
be able to improve their performance by optimizing them). If your
application is not write-intensive, there are several possible avenues
to pursue: (1) optimize SELECT queries (adding an index here and there
may be necessary), (2) turn on query cache (which may help if you have
a news site, but not likely to improve things if you have a social
networking site), (3) increase mysql.max_links (which in turn will
increase your memory requirements). Do check your MySQL connection
method just in case; the best performance on a single server is
achieved by using socket connection rather than a TCP/IP connection.

Cheers,
NC
Oct 10 '07 #4
On 9 Oct, 17:10, Gilles Ganault <nos...@nospam. comwrote:
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_hand ler(...) 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.

Oct 10 '07 #5
..oO(Gilles Ganault)
>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?
Have a look at the Xdebug extension and profile the code.

http://xdebug.org/
http://xdebug.org/docs/profiler

Micha
Oct 10 '07 #6
On Wed, 10 Oct 2007 20:01:43 +0200, Michael Fesser <ne*****@gmx.de >
wrote:
>Have a look at the Xdebug extension and profile the code.
Thanks everyone for the feedback. We'll go through this and see how it
goes.
Oct 11 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
2207
by: Ranger West | last post by:
Hello there, Are there any out-of-the box handhelds that run Linux/Apache/MYSQL and PHP? Does Redhat, Suse, or Gentoo support any handhelds? I know the Zaurus comes close, but I've heard people have problems running LAMP applications on it. It would be cool to be able to run any LAMP application on sourceforge on a handheld computer.
2
1837
by: Geoff Blake | last post by:
Hi Sorry if this is OT but I thought some of you would have experienced this and be able to help. I am new to all this and am trying to set up a Linux machine (Fedora 3) as a LAMP server on a LAN with a Windows XP Prof machine. The boxes are connected via a cheap switch. I have added the site address to the Hosts file on both machines, flushed
10
23598
by: Zabby | last post by:
hi, i want to turn on/turn off a usb lamp via a vb.net button... i think i would have to turn on/turn off the power for this usb port.... how could i do this? kind regards
1
1378
by: athindrans | last post by:
Hi I am new to web devp,I have the following query What are the steps and precautions to take when developing your site on a WAMP server and deploying on a LAMP. Since most of the hosting companies are on LAMP, what are the things which will change for a php/mysql site developed and tested on Apache windows. kindly enlighten
0
1915
by: Rog | last post by:
Who am I?: Hi I am a 'one-man-show' and mainly in the ecommerce and community business based in Western Europe. With over 13 years experience in the internet and telecommunication business, I am very strong focused on the adult site. The last 4 years I have been working as well with 2 programmers where we have covered quiet interesting fields like ecommerce, community building, sms-payment, premium-rated numbers
0
325
by: Piotrekk | last post by:
Hi I have a little problem. Having small mavie.avi ( divx compression ) i've noticed that candle fire on movie.avi in windows media player is displayed properly but in my mediaelement candle fire in focal point is black. Sometimes I see such a problems when I use wrong codecs to decode the movie. Same problem is few seconds later with regular lamp ( only the little elements on lamp ). I have tried different codecs so i think that's not...
39
2571
by: Gilles Ganault | last post by:
Hello, I'm no LAMP expert, and a friend of mine is running a site which is a bit overloaded. Before upgrading, he'd like to make sure there's no easy way to improve efficiency. A couple of things: - MySQL : as much as possible, he keeps query results in RAM, but apparently, each is session-specific, which means that results can't be shared with other users.
2
1731
by: mike | last post by:
Hi. I need a web programmer to set up interactive features on a static web site. The project needs are described at http://vitalkids.org My email address shows near the top of the page at http://vitalkids.org/project.htm PLEASE! I have already been advised of and taken a look at Content Management Systems such as Joomla and Drupal. I still want to hire a LAMP consultant. Thank you for past suggestions. But may we please move...
0
9152
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7708
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4612
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2320
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.