Server tools - htop and apache server status
By Mike Street
When starting to debug server performance, a good place to start is the tools built into the server. Before you start installing extra utilities, it is worth checking to see if anything obvious sticks out.
Below we walk through using a
htop command line tool along with setting up a server status page.
Note: This post is part of a mini-series exploring debugging and monitoring server performance. All the posts can be found under the Server Tools - Introduction post.
top and the better looking
htop are great applications to see if there any processes hogging your system. I believe
top is installed by default but
htop can be installed with any good linux package manager.
htop as you can filter by process name, sort the CPU/RAM columns and customise the output. You can change the top display too, to show CPU and RAM usage at a quick glance.
F[0-10] keys to navigate the interface (what to press is listed along the bottom).
A good one to use is press
F6 to Sort By and then use the arrow keys to select
PERCENT_MEM to see what is blocking your server. Once you've pressed enter, you can use the arrow keys to navigate up and down and list and potentially kill (
Enter) and processes you want to get rid of.
Leave the app open and do the action which seems to be slow - does anything jump out at you as a resource hog?
ctrl + c will get you out.
htop can be quit by pressing
There are a lot more Linux tools available for DevOps monitoring - I tried a few to see if I could spot my problem, but nothing here really helped.
Apache server status
Apache has a server status page you can enable with some config.
It is worth noting that you probably want to restrict this to your IP so potential attackers or data thieves can't easily discover information about your server.
To enable the server status page, you need to enable the Apache module
sudo a2enmod status
Once enabled (but before you restart apache), edit the
status.conf file and uncomment out the IP address line and update to yours
The file can be found at
Look for the line starting
Require ip that is commented out by default
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the "192.0.2.0/24" to allow access from other hosts.
#Require ip 192.0.2.0/24
Restart apache and this will then give you a quick snapshot of the server by navigating to
/server-status. You can add
?refresh=n to the end of the URL, where
n is a number of seconds the page will automatically refresh.
E.g. (where 22.214.171.124 is your server IP)