Tuning and benchmarking Apache and MySQL

Published: 10, Sep 2015
LinuxSystems AdministrationWordPress

Have you ever found yourself needing to speed up apache or mysql?  Here’s a quick writeup on some very useful tools when you first setup Apache and MySQL.  These will help you optimize and build out the absolute best configuration for your webserver.

Apachebuddy:

https://github.com/gusmaskowitz/apachebuddy.pl

To download and run ApacheBuddy, use the following:

curl http://cloudfiles.fanatassist.com/apachebuddy.pl | perl

Output:

apachebuddy
When you see [  !!  ]  this indicates that there is an issue and suggests something to be changed.

—————————————————-

The Second Script is MySQL tuner

https://github.com/major/MySQLTuner-perl

This script will give you all sorts of valuable information about your MySQL server

Simply run the following:

wget https://raw.github.com/major/MySQLTuner-perl/master/mysqltuner.pl

./mysqltuner.pl --user root --pass YOURPASSWORD --forcemem 1024

Output:

mysqltuner

————————————————————————————————————————————————————–

Another great script is lazyscript

https://github.com/hhoover/lazyscripts

Lazy script is filled with a number of invaluable resources including the following:

Function Description
lsinfo Display useful system information
lsbwprompt Switch to a plain prompt.
lscolorprompt Switch to a fancy colorized prompt.
lsbigfiles List the top 50 files based on disk usage.
lsmytuner MySQL Tuner.
lshighio Reports stats on processes in an uninterruptable sleep state.
lsmylogin Auto login to MySQL
lsmyengines List MySQL tables and their storage engine.
lsmyusers List MySQL users and grants.
lsmycreate Creates a MySQL DB and MySQL user
lsmycopy Copies an existing database to a new database.
lsap Show a virtual host listing.
lsapcheck Verify apache max client settings and memory usage.
lsapdocs Prints out Apache’s DocumentRoots
lsapproc Shows the memory used by each Apache process
lsrblcheck Server Email Blacklist Check
lscloudkick Installs the Cloudkick agent
lsvhost Add an Apache virtual host
lsvsftpd Installs/configures vsftpd
lspostfix Set up Postfix for relaying email
lsparsar Pretty sar output
lslsync Install lsyncd and configure this server as a master
lswordpress Install WordPress on this server
lsdrupal Install Drupal 7 on this server
lswebmin Install Webmin on this server
lsvarnish Installs Varnish 3.0
lsconcurchk Show concurrent connections
lscrtchk Check SSL Cert/Key to make sure they match
lsrpaf Install mod_rpaf to set correct client IP behind a proxy.
lspma Installs phpMyAdmin
lsnginx Replace Apache with nginx/php-fpm
lshaproxy Install HAProxy on this server
lshppool Adds a new pool to an existing HAProxy config
lswhatis Output the script that would be run with a specific command.
lsnodejs Installs Node.js and Node Package Manager
lsapitools Installs API tools for Rackspace Cloud
lsrecap Installs Recap – https://github.com/rackerlabs/recap
lsnova Nova Configuration generator

———————————————————————————————————–

And finally,  recap

https://github.com/rackerlabs/recap

Developed by Rackspace, there is many great tools to use.

Provides a combination of command outputs including: uptime, free, vmstat, iostat, df, as well as some information derived from the ‘top’ command including the top 10 cpu% using processes and the top 10 memory% using processes.

You can setup recap to run on a scheduled basis using cron.  This is a great tool when it comes to troubleshooting servers at various points in time.  Using this correctly, you can easily get an idea of what was going on on your server at a given time.

 

Have any great tools / resources to share?  Add them in the comments below