Skip to content

Instantly share code, notes, and snippets.

@facelordgists
Created May 3, 2014 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save facelordgists/11503895 to your computer and use it in GitHub Desktop.
Save facelordgists/11503895 to your computer and use it in GitHub Desktop.
Linux Web Server performance analysis and troubleshooting

Analyze performance

Logs

Monitor several pertinent logs simultaneously in real-time

ls -drt /var/log/* | tail -n5 | xargs sudo tail -n0 -f

HTTP connections

See list of top 5 client IPs connected to server and how many connections

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head

See list of IP addresses from access log sorted by most connections

cat /var/log/httpd/access_log | awk '{print $1}' | sort | uniq -c | sort -n

Examine processes and threads and see what's going on

Hierarchy of processes

ps auxf | less

Current process list presented in tree hierarchy and wide output (showing the full command line arguments and not cutting them after X characters)

ps -auxwwwf

Tree of processes

pstree

show all processes and their process id's:

pstree -ap

Kill a process

kill 3009

If it refused to die, add -9

kill -9 3009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment