首页 > 服务器 > 查看Apache并发请求数及其TCP连接状态

查看Apache并发请求数及其TCP连接状态

2009年03月31号
查看评论 发表评论 55,389次浏览

续以前的文章,补充一下更完整正确的说明操作 :)

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves

StartServers     10
MinSpareServers   10
MaxSpareServers   15
ServerLimit     2000
MaxClients      2000
MaxRequestsPerChild 10000

  查看httpd进程数(即prefork模式下Apache能够处理的并发请求数):

  Linux命令:

ps -ef | grep httpd | wc -l

  返回结果示例:

  1388

  表示Apache能够处理1388个并发请求,这个值Apache可根据负载情况自动调整,我这组服务器中每台的峰值曾达到过2002。

  查看Apache的并发请求数及其TCP连接状态:

  Linux命令:

netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’
  返回结果示例:

  LAST_ACK 5

  SYN_RECV 30

  ESTABLISHED 1597

  FIN_WAIT1 51

  FIN_WAIT2 504

  TIME_WAIT 1057

  其中的SYN_RECV表示正在等待处理的请求数;ESTABLISHED表示正常数据传输状态;TIME_WAIT表示处理完毕,等待超时结束的请求数。

  关于TCP状态的变迁,可以从下图形象地看出:

  状态:描述

  CLOSED:无连接是活动的或正在进行

  LISTEN:服务器在等待进入呼叫

  SYN_RECV:一个连接请求已经到达,等待确认

  SYN_SENT:应用已经开始,打开一个连接

  ESTABLISHED:正常数据传输状态

  FIN_WAIT1:应用说它已经完成

  FIN_WAIT2:另一边已同意释放

  ITMED_WAIT:等待所有分组死掉

  CLOSING:两边同时尝试关闭

  TIME_WAIT:另一边已初始化一个释放

  LAST_ACK:等待所有分组死掉

  1. 高手
    发表于 2009年04月04号 02时27分20秒 | 1楼

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

  2. 高手
    发表于 2009年04月04号 02时28分09秒 | 2楼

    ‘ 记得要改英文符号哦!~

  3. 高手
    发表于 2009年04月08号 22时38分30秒 | 3楼

    可以加上grep 80,比较准确

  4. world cup jerseys 2010
    发表于 2010年06月22号 10时17分28秒 | 4楼

    You are a beautyful inspiration many times for me and specially your poems!

  5. replica corum watches
    发表于 2010年06月24号 14时25分14秒 | 5楼

    another great news,thanks.Can’t wait to download!

  6. fashion necklaces
    发表于 2010年06月27号 13时04分56秒 | 6楼

    Thanks,you are the greatest.

  7. mbt shoes
    发表于 2010年06月28号 10时01分04秒 | 7楼

    Thanks for a great post.

  8. Replica Bags
    发表于 2010年06月29号 08时42分46秒 | 8楼

    You’ll always have our support!

  9. lv bags
    发表于 2010年07月03号 16时29分22秒 | 9楼

    Thanks for your post. I agree and i try be optimistic in my posts too…

  10. mbt kisumu sandals
    发表于 2010年07月08号 07时56分59秒 | 10楼

    The presentation is so unusual. I like that

  11. fake gucci watch
    发表于 2010年07月09号 15时19分51秒 | 11楼

    Thanks, beautiful words

  12. puma shoes sale
    发表于 2010年07月11号 03时20分32秒 | 12楼

    HOt!!!!

  13. Miu Miu Handbags
    发表于 2010年07月17号 15时33分33秒 | 13楼

    you have an open mind

  14. cheap lacoste shoes
    发表于 2010年07月19号 15时47分50秒 | 14楼

    This is something that I have been pondering. Love and beautiful light to you all,

  15. rolex submariner
    发表于 2010年07月19号 17时12分07秒 | 15楼

    what matters is that you trust yourself as God has in you and try to be who you are ..then this lifetime can be Heaven…

评论页数:
1 2 122
  1. 目前没有通告
你必需 登陆 才能发表评论.