facelordgists
5/3/2014 - 7:04 PM

Linux Web Server performance analysis and troubleshooting

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