Blogger Information
Blog 16
fans 0
comment 3
visits 16909
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
查看web的并发请求数及其TCP连接状态
Altura的博客
Original
771 people have browsed it

1、查看内存占用最大的进程的命令:

ps aux| grep -v "USER" | sort -n -r -k 4 | awk 'NR==1{ print $0}'


2、查看所有建立连接的详细记录

netstat -nat|grep ESTABLISHED|wc -l

netstat -an | grep ESTABLISHED | wc -l


3、查看系统tcp连接中各个状态的连接数/查看web的并发请求数及其TCP连接状态

netstat -an | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'


4、输出每个ip的连接数,以及总的各个状态的连接数。

netstat -n | awk '/^tcp/ {n=split($(NF-1),array,":");if(n<=2)++S[array[(1)]];else++S[array[(4)]];++s[$NF];++N} END {for(a in S){printf("%-20s %sn", a, S[a]);++I}printf("%-20s %sn","TOTAL_IP",I);for(a in s) printf("%-20s %sn",a, s[a]);printf("%-20s %sn","TOTAL_LINK",N);}'


5、TCP连接状态详解 

LISTEN:           侦听来自远方的TCP端口的连接请求

SYN-SENT:      再发送连接请求后等待匹配的连接请求

SYN-RECEIVED:再收到和发送一个连接请求后等待对方对连接请求的确认

ESTABLISHED:代表一个打开的连接

FIN-WAIT-1:    等待远程TCP连接中断请求,或先前的连接中断请求的确认

FIN-WAIT-2:   从远程TCP等待连接中断请求

CLOSE-WAIT:等待从本地用户发来的连接中断请求

CLOSING:      等待远程TCP对连接中断的确认

LAST-ACK:    等待原来的发向远程TCP的连接中断请求的确认

TIME-WAIT:  等待足够的时间以确保远程TCP接收到连接中断请求的确认

CLOSED:      没有任何连接状态

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post