Sitecore Pipeline Profiler

I came across the pipelines.aspx under the admin folder of my instance. I found some interesting use of the page and so here is a blog as a result:

Access Pipelines.aspx:

Get the following message if this is the first time you are accessing:

Pipeline Profiler

A snapshot from the pipeline profiler.

Pipeline profiling is disabled. No data is currently available.

To enable pipeline profiling, add the following key "<add key="env:define" value="Profiling" />" to Web.config <appSettings> section.

To measure CPU usage during pipeline profiling, set the value of the "Pipelines.Profiling.MeasureCpuTime" setting to "true". Measuring CPU usage adds a performance overhead to the pipeline but provides additional information about the behavior of the processors.


Based on the message, I setup my root web.config:


With just the above setting in place, I accessed the pipelines.aspx page to find the following list -


There is a legend in the bottom of the page  to describe what each of those columns mean:


#ExecutionsThe number of executions of the pipeline or processor
Wall TimeTotal wall time spent in all executions of the pipeline or processor
% Wall TimeFor a processor, percentage of total pipeline execution time that is spent executing this processor
Max Wall TimeWall Time of the longest execution of a pipeline or processor
% CPUFor a processor, percentage of total pipeline CPU usage that is spent executing this processor
Time / ExecutionAverage time taken by a single execution of the pipeline or processor (wall time)

At this point, when I cross-checked the showconfig.aspx for Pipelines.Profiling.MeasureCpuTime, I find this setting:


Since the setting comes from Sitecore.PipelineProfiling.config under <web root>\App_Config\Environment, I just added a patch under a xxxx folder -


Refreshed the showconfig.aspx to see the change:


Go back to pipelines.aspx to see the end-result of a new column added now:


Next, I decided to add my own pipeline processor to see if it reflects in the above list. I added a PublishItemProcessor and published the concerned feature project but couldn't find the processor in the list:


I also realized that if your application instance had stale config files or processors, that shows up in the above list and so, could affect the application load time. 

So, tip# 1, always be sure to get rid of stale pipeline processor code

Now, until I see my custom pipeline processor appearing in the pipelines.aspx , we are not done yet! So, I went ahead and added a processor that will fire right at Initialize and this is the one I added:



I set the breakpoint in this method, attached to w3wp.exe for the instance and again accessed pipelines.aspx, the breakpoint did hit this time!


Patch config for reference:


When I accessed the pipelines.aspx, I could see the impact of this costly processor -


Ensure to switch off the Pipelines.Profiling.MeasureCpuTime when not checking the cpu usage and most importantly, 

- Ensure to write the most optimized code in the pipeline processors and get rid of stale code!
- Disable or remove unused pipeline configs
- Similarly, no harm in removing unused DLLs

So, next time when you have Sitecore performance issues, you have one more place to check for optimization!



Comments

Popular Posts