Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cakephp - Controller::invokeAction taking lot of time

I am working on cakephp 2.x. I found in the transaction trace summary of New Relic, that there are some APIs which are taking a lot of time(almost 20-30 sec) to execute out of which almost 90% of the time is spent in the Controller::invokeAction method.

Can somebody explain why so much time is spent on invokeAction method.

like image 588
avinashw50w Avatar asked Jan 09 '18 13:01

avinashw50w


Video Answer


1 Answers

I agree with @ndm that Controller::invokeAction() method encapsulates everything that is triggered by the Controller action. Your method did not take much time to execute, but when it sends the resulting data to the client - the time it takes to finish unloading the data gets logged into this method. In New Relic's parlance this is uninstrumented time.

New Relic's Transaction time includes this network time too, which will get logged into Controller::invokeAction() method, because New Relic couldn't find some other action to blame for the untracked time.

According the the New Relic Documentation -

the most frequent culprits are functions that send large blocks of data or large files to users. If the user is on a slow connection, sending small files (small images for example) could take a long time due to simple network latency. Since no internal or C extension functions are instrumented, the PHP agent has no one to "blame" the time spent on, and this appears in a transaction trace as uninstrumented time.

You can read more about it here https://docs.newrelic.com/docs/agents/php-agent/troubleshooting/uninstrumented-time-traces

If you still want to figure out what happened, or trace the uninstrumented time of your method; you can set the newrelic.transaction_tracer.detail to 0 in your New Relic's PHP Agent. This will ensure maximum visibility.

You can read more about setting up New Relic's PHP custom instrumentation here : https://docs.newrelic.com/docs/agents/php-agent/features/php-custom-instrumentation

like image 136
Niraj Kumar Avatar answered Oct 28 '22 12:10

Niraj Kumar