The class of interest here is Sitecore.Diagnostics.PerformanceCounters.DataCount (in Sitecore.Kernel.dll). You can simply use the following technique:
var initialItemsAccessed = Sitecore.Diagnostics.PerformanceCounters.DataCount.DataItemsAccessed.Value;
SomeMethod();//the method you want to assess
var totalItemsAccessed = Sitecore.Diagnostics....
When you upgrade Sitecore to a newer version, many Sitecore items are changed. This may cause an issue with EventQueue table filled with thousands of entries.
If that's the case, Sitecore cannot handle it well when it starts.
You should run a script which removes data from EventQueue, PublishQueue and History tables:
/****** History ******/
delete FROM [...
Please try to disable some of the below config in local dev to improve the performance.
1-disable content testing
<setting name="ContentTesting.AutomaticContentTesting.Enabled" value="false" />
2-disables memory hooks and memory measurements
You should swap to P2 from S3. P2 has the same price, but on newer CPUs and better underlying infra (Dv3-series instead of A-series).
Traffic is automatically load balanced across instances, but affected by the Configuration setting (in Azure) called ARR affinity on the General Settings tab. This adds a header that forces traffic from one client to ...