Linux netstat view number of connections, number of concurrent

Source: Internet
Author: User
Tags fully qualified domain name


Linux view number of connections, number of concurrent

Netstat displays protocol statistics and current TCP/IP network connections.
NETSTAT [-A] [-b] [-e] [-f] [-n] [-O] [-P proto] [-r] [-S] [-t] [interval]
-a displays all connections and listening ports. Common
-B Displays the executable program involved in creating each connection or listening port. Common
In some cases, it is known that the executable program hosts multiple Independent
component, which in these cases shows when a connection or listening port is created
and a sequence of components. In this case, the name of the executable program
At the bottom [], the component it calls is located at the top, up to
to TCP/IP. Note that this option can be time-consuming and
May fail if sufficient permissions are available.
-e Displays Ethernet statistics. This option can be used in conjunction with the-s option. Common
-F Displays the fully qualified domain name (FQDN) of the external address. Useless
-N Displays the address and port number in digital form. Common
-O Displays the ID of the process that you have associated with each connection. Useless
-p proto shows the connection of proto specified protocol; Proto can be any of the following
What: TCP, UDP, TCPv6, or UDPV6.
If used with the-s option to display statistics for each protocol, Proto can be any of the following
What: IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP
or UDPV6.
-r Displays the routing table. Common
-S displays statistics for each protocol. By default, display//useful
IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPV6
The-p option can be used to specify a default subnet.
-T displays the current connection offload status. Useless

Interval re-displays the selected statistics, the number of seconds between each display pause.
Press CTRL + C to stop displaying the statistics again. If omitted, the Netstat
The current configuration information is printed once.



To view the current number of concurrent accesses to Apache:
Netstat-an | grep established | Wc-l
Compare the number of maxclients in httpd.conf.
To see how many processes are there:
PS Aux|grep httpd|wc-l
You can view the data using the following parameters
Server-status?auto
#ps-ef|grep Httpd|wc-l
1388
Count the number of httpd processes, and a single request initiates a process that is used for the Apache server.
Indicates that Apache can handle 1388 concurrent requests, which Apache can automatically adjust according to the load situation.
#netstat-nat|grep-i "|wc-l"
4341

Netstat-an will print the current network link state of the system, while Grep-i "80" is used to extract connections related to port 80, wc-l the number of connections counted.
The final number returned is the total number of requests for all 80 ports currently.
#netstat-na|grep Established|wc-l
376
Netstat-an Prints the current network link state of the system, and grep established extracts information about the established connection. Then wc-l statistics.
The final number returned is the total number of established connections for all current 80 ports.
netstat-nat| | grep ESTABLISHED|WC-To see detailed records of all established connections

To view the number of concurrent requests for Apache and its TCP connection status:
Linux commands:
Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Examples of returned results:
Last_ack 5
SYN_RECV 30
Established 1597
Fin_wait1 51
Fin_wait2 504
Time_wait 1057
One of the
SYN_RECV indicates the number of requests waiting to be processed;
Established indicates the normal data transmission status;
Time_wait indicates the number of requests that have finished processing and waiting for the timeout to expire.

Linux netstat view number of connections, number of concurrent

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.