Google Cloud Profiling how to optimize my code by analyzing it?

62 views
Skip to first unread message

Sudhanshu Gaur

unread,
Apr 4, 2018, 3:27:56 PM4/4/18
to Google App Engine

I am trying to analyse the Google CLoud Stackdriver's Profiling, now can anyone please tell me how can I Optimize my code by using this.

Also, i am not seeing any of my function name and all, i don't know what is this _tickCallback and which part of the code it is executing ??

Please help me, anyone.



Jordan (Cloud Platform Support)

unread,
Apr 5, 2018, 4:28:02 PM4/5/18
to Google App Engine
The _tickCallback frame you see in the graph was called by the main root service you profiled. By clicking on that frame you will reveal the full name and file that defines this frame's process. It looks like this is the Node.js Event Loop that is used to actually run your application. 

It is not clear from the cropped picture what metric this profile is showing (e.g CPU, Heap, etc) so I cannot recommended any optimizations, but you read it top down. The main root service is always 100% (since you are profiling that specific service's metric breakdown). The next layer shows all of the processes your root service called, and the size of each frame shows how much of the 100% root resources that process used. The next layer down shows all of the processes called by each process in the layer above, with their length representing the % used to make up the previous layer's %; and so on until you reach the last processes called. 

These types of flame graphs are best used for understanding what process stack is taking up the most resources in your service. You can also use this information to optimize your service to reduce CPU/Memory usage, contention issues, processing execution time, and threading issues. Errors such a OOMs (Out of Memory) will also reveal themselves in the process that is consuming all of your services memory.

It is recommended to profile your service multiple times in order to see a more accurate averaged profile (I see you ran it 19 times on this service which is good). For more details into how to use these profiles I recommend taking a look at our Profiler Interface and Profiling Concepts guides. 

- Note: Google Groups is for general product discussions. For further technical support in optimizing your code it is recommended to post your full detailed questions to Stack Exchange using the supported Cloud tags. 
 





Sudhanshu Gaur

unread,
Apr 18, 2018, 9:42:14 AM4/18/18
to Google App Engine
@Jordan This is Heap Flamegraph. Also, one thing i wanted to ask is why there is no Function name mentioned in this graph because I can optimize my code only if I can see which functions are utilising much Heap/CPU. 
Reply all
Reply to author
Forward
0 new messages