Home  >  Article  >  Backend Development  >  Handling the timeout problem of php include class files, _PHP tutorial

Handling the timeout problem of php include class files, _PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:07:43833browse

PHP include class file timeout problem handling,

Recently, I discovered that PHP always times out when running automatic loading class functions. Tracking the PHP slow query log, I found that the program actually times out when it gets stuck in including a certain class file.

The initial positioning is that the io response timed out and there was a problem with hard disk reading.

Use several commands to locate:

iostat -d -x -k 1 10 // Run 10 times to see that the wait parameter in iostat is very large, generally no more than 5ms. The closer the two parameters of await svctm are, the better the io performance will be.

Refer to other blogs,

await: The average processing time of each IO request (unit is microseconds and milliseconds). This can be understood as the IO response time. Generally, the system IO response time should be less than 5ms. If it is greater than 10ms, it will be larger.
This time includes queue time and service time. That is to say, under normal circumstances, await is greater than svctm. The smaller the difference between them, the shorter the queue time. On the contrary, the larger the difference, the longer the queue time, indicating that the system has failed. problem. svctm represents the average service time (in milliseconds) of each device I/O operation. If the value of svctm is very close to await, it means there is almost no I/O waiting and the disk performance is very good. If the value of await is much higher than the value of svctm, it means the I/O queue wait is too long, and the applications running on the system will Slow down.

sudo iotop -o, // Check the program that is deleting the hard disk and check the io occupation ratio of the process

sudo perf top // Check the process io usage ratio

sudo hdparm -t /dev/**** View disk read efficiency

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

View non-interrupted sleep

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

After tracing through the above command, the hard disk reading efficiency is very low. The further reason is unknown. It is speculated that the hard disk may have bad sectors.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/954663.htmlTechArticleHandling of php include class file timeout problem. Recently, it was discovered that php always times out when running automatic loading class functions. Track php After slowly querying the log, I found that the program was stuck when including a certain class file...
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