How to investigate Sitecore startup performance - mitikov/KeepSitecoreSimple GitHub Wiki
Agenda
Despite Moore's law & 50 years ago a computer was capable of bringing man to the moon, we still observe slowness in certain scenarios - like application start.
Actions to take:
- Cry & suffer - most popular route
- Fight
If you pick fighting as I do, the question is - whom to fight with?
Do you wanna fight windmills or tackle an actual problem?
If you are interested in end results rather than investigation flow, just click here.
Step uno - know your enemy
If you know the enemy and know yourself, you need not fear the result of a hundred battles.
If you know yourself but not the enemy, for every victory gained you will also suffer a defeat.
If you know neither the enemy nor yourself, you will succumb in every battle.
Only after knowing the nature of the slowness accurate steps can be done.
Nature can be acknowledged by observing - dynamic profiling is the approach we'll take here.
Collection Part
Run PerfView with default values and pick 'Thread Time' for collection:
NOTE: Similar approach can be taken in KUDU for Azure Web Apps.
Request page in the browser and wait for it to be loaded = congrats you have some data to check.
Analysis Part (fun is here)
I've recorded the 9.0u1 startup.
The first step is to verify needed process is there -> open process summary
report:
The second step is to see what are threads doing during in the trace -> navigate to advanced
-> thread time
.
CPU
VS Blocked
time indicates tons of blocking takes place:
Let's do a right click
on blocked
-> include item
-> switch to Flame Graph
view to inspect code affected from blockings.
Despite blocking is expected for certain threads (f.e. thread pool threads, filewatchers, heartbeat), they appear on our view.
Let's filter them out by top right input ExcPats: FileWatcher;semaphore;heartbeat;scheduler
The next step is to watch only Sitecore-logic by adding Sitecore
filter for IncPats
The last step is to set the Fold% = to fish only for big haul: