V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
zfyp
V2EX  ›  服务器

请教:服务器并发数的计算

  •  
  •   zfyp · Jul 10, 2013 · 5272 views
    This topic created in 4674 days ago, the information mentioned may be changed or developed.
    服务器为Linux,使用Apache(perfork)作为Web服务器,怎么得到服务器当前的的并发数?是看Apache的进程?还是看netstat -an里面的ESTABLISHED数?还是通过其他的办法获取?
    5 replies    1970-01-01 08:00:00 +08:00
    nybux
        1
    nybux  
       Jul 10, 2013
    分析访问日志
    Livid
        2
    Livid  
    MOD
    PRO
       Jul 10, 2013
    netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
    zfyp
        3
    zfyp  
    OP
       Jul 11, 2013
    @Livid 这个得到的信息不能得到并发数吧,命令获取到有已经断开但还没有释放资源的状态CLOSE_WAIT,CLOSING、ITMED_WAIT等等

    @nybux 分析访问日志得到的应该是每秒请求数吧?
    nybux
        4
    nybux  
       Jul 11, 2013
    并发数很难计算,所以一般就是都是计算一段时间内的请求数,然后根据每个请求的平均时间,然后估算出并发数量。
    比如你平均每秒有1000个请求,每个请求平均耗时1秒,那平均并发就是1000。如果每个请求是0.1秒,那并发就是100了。
    julyclyde
        5
    julyclyde  
       Jul 13, 2013
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1008 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 19:07 · PVG 03:07 · LAX 12:07 · JFK 15:07
    ♥ Do have faith in what you're doing.