PHP Application CPU 100% Debugging method

Source: Internet
Author: User

Find out why the process is consuming high CPU.

The process consumes high CPU, generally because the process consumes CPU for a long time, and does not actively release the occupation. If you want to actively release the CPU, you can call sleep. When writing a program, pay particular attention to where the while and other loops are.

Find out which code the PHP process is executing
$sudo gdb-p10434 (gdb) print (char *) executor_globals.active_op_array->filename$13 =0x2924118"/home/admin/gearman_manager/pecl-manager.php" (gdb) Print executor_globals->current_execute_data->opline- >lineno$14 =(GDB) Ccontinuing.^cprogram received signal  SIGINT, interrupt. 0x00000031d32306d0 in sigprocmask () from/lib64/libc.so. 6 (gdb) print Executor_globals->current_execute_data->opline->lineno$15 = Span class= "Hljs-number" >71 (gdb) ccontinuing.^Cprogram received signal sigint,  Interrupt. 0x00000000006250e1 in Zend_hash_find () (gdb) Print Executor_ Globals->current_execute_data->opline->lineno$16 = 53              

If you have questions about the above command, you can look at the lines of code that might be problematic in PHP when the CPU soars
According to the above information, we can know that when the CPU is high, the/home/admin/gearman_manager/pecl-manager.php file is being executed. and executing code near lines 53 and 71.

can also be debugged via Strace

PHP Application CPU 100% Debugging method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.