什么可能导致进程不活跃

什么可能导致进程不活跃

运行 Linux 并执行一堆 PHP 脚本。我注意到我们的 CPU 使用率很低,但许多进程处于休眠状态,因此开始调查。带有 S3 存储桶的 AWS EC2。

我似乎找不到任何瓶颈,但也许我对数据的解释是错误的。从我下面发布的内容来看,一切似乎运行正常(至少活动线程看起来没问题),但其中很多仍处于这种状态S。它们最终会得到处理,但我们希望一切都运行得更快,充分利用资源。

任何帮助都将不胜感激。即使只是指向一个特定的方向。谢谢!

CPU 数量 (进程数):

36

平均负载():

18:42:32 up 106 days,  4:46,  2 users,  load average: 6.26, 7.63, 8.42

记忆 (猫/proc/meminfo):

MemTotal:       61837284 kB
MemFree:         3982024 kB
Buffers:           10328 kB
Cached:         32626956 kB
SwapCached:         9460 kB
Active:         42867976 kB
Inactive:       13606444 kB
Active(anon):   22581328 kB
Inactive(anon):  1259760 kB
Active(file):   20286648 kB
Inactive(file): 12346684 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       6775804 kB
SwapFree:        2165592 kB
Dirty:             16952 kB
Writeback:            60 kB
AnonPages:      23829904 kB
Mapped:            24808 kB
Shmem:              3236 kB
Slab:             749544 kB
SReclaimable:     541536 kB
SUnreclaim:       208008 kB
KernelStack:        8792 kB
PageTables:       160316 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    37694444 kB
Committed_AS:   39910116 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      131876 kB
VmallocChunk:   34328119820 kB
HardwareCorrupted:     0 kB
AnonHugePages:    550912 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:       92160 kB
DirectMap2M:     4102144 kB
DirectMap1G:    58720256 kB

列出进程(ps -ax -o pid,s,cmd,wchan = WIDE-WCHAN-COLUMN | grep php):

2136 S /bin/sh -c php /var/www/dom wait
  2156 S php /var/www/domains/vps.de poll_schedule_timeout
  5831 S /bin/sh -c php /var/www/dom wait
  5878 S php sync.php 110004255 --ca poll_schedule_timeout
  5888 S php sync.php 11001587 --cal hrtimer_nanosleep
  9138 S /bin/sh -c php /var/www/dom wait
  9174 S php /var/www/builds/product poll_schedule_timeout
  9243 R php sync.php 11001795 --cal -
  9253 S php sync.php 110005751 --ca poll_schedule_timeout
 13480 S /bin/sh -c php /var/www/dom wait
 13684 S php sync.php 18003496 --cal poll_schedule_timeout
 14825 S /bin/sh -c php /var/www/dom wait
 17323 S /bin/sh -c php /var/www/dom wait
 17385 S php sync.php 110005518 --ca poll_schedule_timeout
 17391 S php sync.php 110004168 --ca pipe_wait
 17393 S php sync.php 110006890 --ca poll_schedule_timeout
 18479 S /bin/sh -c php /var/www/dom wait
 18491 S php /var/www/domains/vps.de poll_schedule_timeout
 19563 S php cron-new.php --auto-syn poll_schedule_timeout
 19957 S /bin/sh -c php /var/www/dom wait
 20004 S php sync.php 11001211 --cal poll_schedule_timeout
 20006 R php sync.php 110004925 --ca -
 20024 S php sync.php 11001046 --cal poll_schedule_timeout
 20030 S php sync.php 11001517 --cal poll_schedule_timeout
 21901 S /bin/sh -c php /var/www/dom wait
 22004 S php sync.php 11002052 --cal poll_schedule_timeout
 22006 S php sync.php 11001088 --cal pipe_wait
 22008 S php sync.php 18002964 --cal hrtimer_nanosleep
 22010 S php sync.php 11001069 --cal pipe_wait

这不是完整的列表。平均有 5-10 个在R州内,其余的在S州内。总共约有 80 个流程

检查活动线程(psn -p“php”-a -G syscall,wchan,kstack):

=== Active Threads ==================================================================================================================================================================================================================================================================================================================================================================================

 samples | avg_threads | comm  | state                  | syscall   | wchan                 | filenamesum | kstack
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    2910 |       29.10 | (php) | Sleep (Interruptible)  | nanosleep | hrtimer_nanosleep     |             | system_call_fastpath()->SyS_nanosleep()->hrtimer_nanosleep()
    2207 |       22.07 | (php) | Sleep (Interruptible)  | select    | poll_schedule_timeout |             | system_call_fastpath()->SyS_select()->core_sys_select()->do_select()->poll_schedule_timeout()
     646 |        6.46 | (php) | Running (ON CPU)       | [running] | 0                     |             | -
     350 |        3.50 | (php) | Sleep (Interruptible)  | poll      | poll_schedule_timeout |             | system_call_fastpath()->SyS_poll()->do_sys_poll()->poll_schedule_timeout()
       7 |        0.07 | (php) | Running (ON CPU)       | [running] | 0                     |             | system_call_fastpath()->SyS_read()
       6 |        0.06 | (php) | Running (ON CPU)       | [running] | 0                     |             | retint_careful()
       2 |        0.02 | (php) | Disk (Uninterruptible) | rename    | sleep_on_page         |             | system_call_fastpath()->SyS_rename()->SYSC_renameat()->vfs_rename()->nfs_rename()->nfs4_inode_return_delegation()->nfs_wb_all()->sync_inode()->writeback_single_inode()->__writeback_single_inode()->filemap_fdatawait()->filemap_fdatawait_range()->wait_on_page_bit()->sleep_on_page()
       2 |        0.02 | (php) | Running (ON CPU)       | [running] | 0                     |             | page_remove_rmap()->mem_cgroup_uncharge_page()
       1 |        0.01 | (php) | Disk (Uninterruptible) | open      | rpc_wait_bit_killable |             | system_call_fastpath()->SyS_open()->do_sys_open()->do_filp_open()->path_openat()->do_last()->nfs_atomic_open()->nfs4_atomic_open()->nfs4_do_open()->nfs4_run_open_task()->__rpc_wait_for_completion_task()->rpc_wait_bit_killable()
       1 |        0.01 | (php) | Running (ON CPU)       | [running] | poll_schedule_timeout |             | -
       1 |        0.01 | (php) | Running (ON CPU)       | poll      | poll_schedule_timeout |             | system_call_fastpath()->SyS_poll()->do_sys_poll()->poll_schedule_timeout()
       1 |        0.01 | (php) | Running (ON CPU)       | select    | 0oll_schedule_timeout |             | system_call_fastpath()->SyS_select()->core_sys_select()->do_select()->poll_schedule_timeout()
       1 |        0.01 | (php) | Running (ON CPU)       | select    | poll_schedule_timeout |             | system_call_fastpath()->SyS_select()->core_sys_select()->do_select()->poll_schedule_timeout()
       1 |        0.01 | (php) | Sleep (Interruptible)  | [running] | poll_schedule_timeout |             | -
       1 |        0.01 | (php) | Sleep (Interruptible)  | [running] | poll_schedule_timeout |             | system_call_fastpath()->SyS_poll()->do_sys_poll()->poll_schedule_timeout()

相关内容