How to know the number of active threads in Puma

前端 未结 6 1943
太阳男子
太阳男子 2021-02-19 03:59

I am trying to see the number of active puma threads on my server.

I can not see it through ps:

$ ps aux | grep puma
healthd   2623  0.0  1.         


        
6条回答
  •  遥遥无期
    2021-02-19 04:59

    Using ps and wc to count puma threads:

    ps --no-headers -T -C puma | wc -l
    

    The string "puma" can be replaced as desired. Example, count bash threads:

    ps --no-headers -T -C bash | wc -l
    

    On my system that outputs:

    9
    

    The code in the question, ps aux | grep puma, has a few grep related problems:

    1. It returns grep --color=auto puma, which isn't a puma thread at all.
    2. Similarly any util or command with the string "puma", e.g. a util called notpuma, would be matched by grep.

提交回复
热议问题