Originally Posted by Bogdan
Hi! I want to know, how much cpu use some software (apache, perl, mysql) for perfomance optimization. The only idea I have is to parse top output.
SNMP is an oft-forgotten completely undervalued method for polling assets for data. Nagios is most used for long term, continuous monitoring of local and remote assets (also see Monit, Munin, Zabbix, Cacti). Most of these these tools come with plugins to monitor for example the amount of MySQL queries and Apaches amount of busy / idle worker threads, etc, etc.
They're valuable tools but might be overkill if you need a quick fix and not continuous monitoring. IMHO the best way to start IMHO is to ask yourself and examine what it exactly is that you feel you need to optimize
. To some extent (low resources, obsolete HW, misconfiguration and other bad admin practices aside) the LAMP web stack isn't the problem but what runs on top of it
. If you're not that knowledgeable or creative then look at performance optimization documents first. These tutorials will often offer system and daemon-specific tools used for performance analysis and stress-testing. Start with with Atop, Collectl or Dstat and Apache Top and MySQL Top. And unless you're very disciplined making backups manually I suggest you add any versioning system you're comfortable with. Collected statistics and changes in performance aren't worth anything if you can't link them back to changes made earlier and it makes reverting easier. Before you turn to optimizing your LAMP web stack ensure you understand the system in terms of scheduling, Virtual Memory Management, networking and web server best practices. Simulate a system under stress with the aptly named 'stress' tool and fire of a gazillion requests using Apaches 'ab' benchmarking tool. For more search Sourceforge, Berlioz, Savannah.nongnu or the-site-formerly-known-as-Freshmeat for terms like "performance analysis" or "stress test" or "test harness" or "automated testing". HTH