Home  >  Article  >  Backend Development  >  php include类文件超时问题处理_php实例

php include类文件超时问题处理_php实例

WBOY
WBOYOriginal
2016-06-07 17:14:09805browse

最近发现,php运行自动加载类函数时总是超时,跟踪php慢查询日志,发现程序卡在了include某个类文件时竟然超时。

    初步定位是io响应超时,硬盘读取有问题。

    通过几个命令来定位:

    iostat -d -x -k 1 10 // 运行10次查看iostat中wait参数很大,一般不超过5ms,await  svctm这2个参数越接近,io性能越好。

    参考别的博客,

await:  每一个IO请求的处理的平均时间(单位是微秒毫秒)。这里可以理解为IO的响应时间,一般地系统IO响应时间应该低于5ms,如果大于10ms就比较大了。
         这个时间包括了队列时间和服务时间,也就是说,一般情况下,await大于svctm,它们的差值越小,则说明队列时间越短,反之差值越大,队列时间越长,说明系统出了问题。svctm    表示平均每次设备I/O操作的服务时间(以毫秒为单位)。如果svctm的值与await很接近,表示几乎没有I/O等待,磁盘性能很好,如果await的值远高于svctm的值,则表示I/O队列等待太长,         系统上运行的应用程序将变慢。

    sudo iotop -o , // 查看在划硬盘的程序,查看进程io占用比例

    sudo perf top // 查看进程io占用比例

    sudo hdparm -t /dev/**** 查看磁盘读取效率

    显示: Timing buffered disk reads:   10 MB in  3.14 seconds =   3.18 MB/sec

    查看非中断睡眠

    while true; do date; ps auxf | awk '{if($8=="D") print $0;}'; sleep 1; done

通过上述命令跟踪后,硬盘读取效率很低,进一步原因,还不得而知,猜想可能是硬盘有坏道。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn