使用linux命令诊断性能问题

怎么用top和ps命令组合找出CPU占用最高的进程?

1
2
3
4
```
```bash
top -b -n 1 | head -n 10 | grep -v "top" | awk '{print $1}' | xargs -I {} ps -p {} -o pid,ppid,pcpu,cmd,user

怎么用tcpdump抓包分析网络延迟问题?

1
tcpdump -i any -nn -s 0 -t -w tcp_delay.pcap dst host 192.168.1.100 and dst port 8080 and tcp