How to find out code with too high cpu usage

Source: Internet
Author: User
Tags high cpu usage
During the recent website activities, the order volume was several times more than usual. During this period, the cpu usage of the two APIs reached 60%, and the memory usage was normal. Preliminary suspicion is the reason for the large amount of orders, so I am reading the code for shopping cart, settlement, and order submission, but I don't feel useful, so I want to have something... during the recent website activities, the order volume was several times more than usual. During this period, the cpu usage of the two APIs reached 60%, and the memory usage was normal. Preliminary suspicion is the reason for the large amount of orders, so I am reading the code for shopping cart, settlement, and order submission, but I don't feel it is useful, so what tools can be used to track the code cpu usage in the program, and then optimize the Code accordingly. I searched the internet and found that xdebug is only for the running time of the code, but what I want to know is the cpu, I don't know if you have any methods or tools to help find the code block to be optimized.

Reply content:

During the recent website activities, the order volume was several times more than usual. During this period, the cpu usage of the two APIs reached 60%, and the memory usage was normal. Preliminary suspicion is the reason for the large amount of orders, so I am reading the code for shopping cart, settlement, and order submission, but I don't feel it is useful, so what tools can be used to track the code cpu usage in the program, and then optimize the Code accordingly. I searched the internet and found that xdebug is only for the running time of the code, but what I want to know is the cpu, I don't know if you have any methods or tools to help find the code block to be optimized.

It is recommended to understand the APM, such as: http://www.oneapm.com/ai/php.html

"Performance" is ultimately time

High cpu usage is a phenomenon. The more fundamental reason is that the old request is not complete when the new request comes (assuming you are not writing thread scheduling, spin locks, and other things in php)

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.