This session introduces tools that can help you analyze and troubleshoot performance with SharePoint 2013. This sessions presents tools like perfmon, Fiddler, Visual Round Trip Analyzer, IIS LogParser, Developer Dashboard and of course we create Web and Load Tests in Visual Studio 2013.
At the end we also take a look at some of the tips and best practices to improve performance on SharePoint 2013.
3. Robi Vončina
• Degree in economics
• Started as MS Office instructor
• System administrator
• I started working with SharePoint from 2003
version on
• Leader of SloSPUG
• MVP, MCSE, MCT
10. Performance Monitor settings
• The Process object in Performance Monitor can display Process IDs (PIDs)
• http://support.microsoft.com/kb/281884
• Click Start, click Run, type regedit, and then click OK.
• Locate and then click the following registry subkey:HKEY_LOCAL_MACHINESYST
EMCurrentControlSetServicesPerfProcPerformance
• On the Edit menu, click New, and then click DWORD Value.
• Right-click New Value #1, click Rename, and then type ProcessNameFormat to
name the new value.
• Right-click ProcessNameFormat, and then click Modify.
• In the Data value box, type one of the following values, and then click OK:
• 1: Disables PID data. This value is the default value.
• 2: Enables PID data.
• Exit Registry Editor.
11. Performance Monitor
• .NET CLR Exceptions
• .NET CLR Loading
• .NET CLR Memory
• .NET Networking
• ASP.NET
• ASP.NET Applications
• Memory
• Network Interface
• Physical Disk
• Process
• Processor
• System
• Web Service
• Web Service Cache
• Office Server Search Archival Plugin
• Office Server Search Gatherer
• Add the Threads object when
troubleshooting CPU Spikes/CPU
high utilization.
• Make sure to use "Run As" so we
can accurately capture the .NET
counters. This should be run as the
same account as the application
pool.
• Setup performance logging at 5
second intervals.
• Select the Log Files tab and
Configure button and set
the preferred directory path and
file name. Limit the log file size to
250 MB and hit OK.
12. Using Perfmon
• Create baseline performance monitoring
• Compare baseline to performance monitoring when troubleshooting
13. • Generic Counters
• Counter NameLook for…
• MemoryAvailable BytesMore than 500 MB (SQL is different)
• MemoryPages/SecAre we paging?
• Processor(_Total)% Processor TimeAnywhere above70% means you
might
• having queuing
• PhysicalDisk%perdisk%)Avg. Disk Queue
• Length
• Less than 2-5 per cluster
• Drill down to reads/writes queue length
• PhysicalDisk(%perdisk%)Disk Writes/secLook for constanthigh values
• PhysicalDisk(%perdisk%)Avg.Disk
• sec/Transfer
• Less than 20milliseconds
• Network Interface([network
• interface])Output Queue Length
• 0
• Network Interface([network
• interface])Bytes Total/sec
• make sure you’re up to 50% of network
• capacity
• ASP.Net
• ASP.NET Apps v4.0.30319(__Total__)Request
• Execution Time < 0.5 seconds
Keepin mind network and rendering times
• ASP.NET Apps v4.0.30319 (__Total__)Requests/Sec
• Rough indication of RPS
• ASP.NET Apps v4.0.30319 (__Total__)Request Wait
Time
• Are requests gettingqueued?
• ASP.NetWorker Process Restarts
• Are we crashing often?
• ProcessVirtual Bytes> 4GB is suspicious
14. Counters to look for:
SharePoint
Monitor cache performance in SharePoint 2013
http://technet.microsoft.com/en-us/library/ff934623(v=office.15).aspx
• SharepointPublishing Cache(/)Object cache flushes
/ second
• Cache flushes are bad!
• SharepointPublishingCache(/)Object Cache Hit
Ratio
• >99% (cache hit vs cache miss)
• SharepointPublishing Cache(/)Object Cache Misses
/ sec
• Close to 0
• BLOB cache, ASP.NET output cache, object cache
SQL
• Focus on CPU and Disk IO
• SQLServer:Locks(_Total)Average Wait Time
(ms)
• 0
• SQLServer:Locks(_Total)Number of
Deadlocks/sec
• 0
• SQLServer:AccessMethodsFull Scans/sec
• < 100. Full scans are bad
• SQLServer:GeneralStatisticsUser Connections
Look at trend: make sure we’re not leaking
• SQLServer:CacheManagerCache Hit Ratio
• > 85%
• Do we need to add more memory?
18. Fiddler
• Flagging performance bottlenecks
• Profiling the performance of your web app
• Timeline for performance analysis
• Simulate HTTP compression
• Taking advantage of HTTP caching
19. Fiddler Add-Ons
• Fiddler Html Inspector Part 3 | elastacloud = azurecoder + bareweb
• http://blog.elastacloud.com/2010/12/09/fiddlerhtmlinspector/
• Download Microsoft neXpert Performance Analysis Plugin from Official
Microsoft Download Center
• http://www.microsoft.com/en-us/download/details.aspx?id=11729
• StresStimulus | Load Testing Tool - Fiddler Extension
• http://stresstimulus.stimulustechnology.com/
20. Fiddler Performance evaluation
• Statistics
• Request count
• Bytes received
• Session list
• Body
• Caching
• Consolidation
• Inspectors
• Compression
• Minification
• Timeline
23. Visual Round Trip Analyzer and Network Monitor
• Analyses Web against list of known best
practices
• Expiration Date
• Bandwidth Efficiency
• Time to First Byte
• Image clustering
• Utility Spotlight: 12 Steps To Faster Web
Pages With Visual Round Trip Analyzer
• http://msdn.microsoft.com/en-us/
magazine/dd188562.aspx
29. Log Parser
• Log parser is a powerful, versatile tool that provides universal query
access to text-based data such as log files, XML files and CSV files, as well
as key data sources on the Windows operating system such as the Event
Log, the Registry, the file system, and Active Directory
• Demo queries
Log Parser Rocks! More than 50 Examples! | LichtenBytes
http://mlichtenberg.wordpress.com/2011/02/03/log-parser-rocks-more-than-50-
examples/
• Uses SQL statements to query logs
30. Log Parser Charts
• Download Office 2003 Add-in: Office Web Components from Official
Microsoft Download Center
• http://www.microsoft.com/en-us/download/details.aspx?id=22276
33. Load Testing
LAN &
WAN
Traffic
User
Configuration
Server Performance
34. What You Need
• Visual Studio Ultimate
• Windows 7/8
• Windows Server 2012/2012 R2
• A test environment
• Nerves of steel
35. Terms
• Performance Testing
• Does it work?
• Load Testing
• Does it really work?
• Stress Testing
• When does it stop working?
• Capacity or Scale Testing
• Will it work for us?
36. More Terms
• Solution
• One or more projects
• Project
• One or more tests
• Web Test
• A series of web requests
• Can be one or more pages or actions
• Load Test
• Execution of one or more web tests
• Has settings like browser, networks, users
38. Create Web Test
• Record steps in Internet Explorer
• Make sure recording bits work
• Easier on workstation
• One type of request per web test
• Can also create with Fiddler
39. Create Load Test
• Add web tests to load test
• Pick network profile
• Pick browser profile
• Can add multiple workstations to test
• Can monitor servers from VS
• Can export results to Excel
40. Add Network Shims
• Needed to simulate network connections
• C:Program Files (x86)Microsoft Visual Studio
12.0Common7IDEVSTestConfig.exe networkemulation /install
• Save results to SQL
• C:Program Files (x86)Microsoft Visual Studio
12.0Common7IDEloadtestrepository.sql
43. Infrastructure
• Capacity planning for SharePoint
Server 2013
• http://technet.microsoft.com/en-us/
library/ff758645(v=office.15).aspx
• Hardware and software
requirements for SharePoint 2013
• http://technet.microsoft.com/en-us/
library/cc262485(v=office.15).asp
x
Component Minimum requirement
Processor •64-bit, 4 cores for small deployments (fewer
than 1,000 users)
•64-bit, 8 cores for medium deployments
(between 1,000 to 10,000 users)
RAM •8 GB for small deployments (fewer than 1,000
users)
•16 GB for medium deployments (between 1,000
to 10,000 users)
For large deployments over 10,000 users, see the
"Estimate memory requirements" section
in Storage and SQL Server capacity planning and
configuration (SharePoint Server 2010). This
document does not apply to search in SharePoint
2013.
These values are larger than those recommended
as the minimum values for SQL Server because of
the distribution of data that is required for a
SharePoint 2013 environment. For more
information about SQL Server system
requirements, see Hardware and Software
Requirements for Installing SQL Server 2008 R2.
Hard disk 80 GB for system drive
Hard disk space depends on how much content
that you have in your deployment. For
information about how to estimate the amount of
content and other databases for your
deployment, see Storage and SQL Server capacity
planning and configuration (SharePoint Server
2010).
44. Database maintanance
• Download Database Maintenance for Microsoft SharePoint 2010 Products
from Official Microsoft Download Center
• http://www.microsoft.com/en-us/download/details.aspx?id=24282
45. SharePoint Caching
• Page
• First request served from DB
• Subsequent requests for same
resource read from memory
• Disk
• File system objects
• Database objects not cached
• Object
• Cross site queries
• Publishing Features Enabled
• Output cache
• Object cache
• Max Cache Size
• Disk cache – Web.config
• BLOBs
46. IIS Compression
• Turned On but not configured
• Reduces size of files
• Caches compressed content on disk
• Increases CPU utilization
• Compression range from 0-9
• Does not effect dynamic content
retrieved from Database
• No UI, must run script
Appcmd set config /section:httpCompression –
[name='gzip'].dynamicCompressionLevel:9
Appcmd set config /section:httpCompression –
[name='gzip'].staticCompressionLevel:9
47. Throttling and Locks
• SQL Server escalates row locks to table locks >5000 items
• Query throttling reduces the impact of any single request by limiting the
amount of data queried
48. Branding
• Minify javascript and CSS files
• Images stiching (CSS sprites)
• Better perfomance with few large
files than lots of small files
• Store CSS, master pages on file
system
• („/_layouts“ folder)
• SpriteMe
• http://spriteme.org/
• Images Folder or Layouts --
_layoutsimages
• Cache-Control: max-age=31536000
• Client does not always ask if newer
version exists
• Document or Images Library
• Cache-Control: Max-age=0
• Expires: Current Date minus 2 weeks
• Client always ask if newer version
exists –fix use blob caching
49. List items
• List and libraries can hold millions of items – doesn‘t mean they should
• All user content in entire site collection is stored in single table in the
content database
• Folders improve view performance NOT query performance
50. List definitions
• Columns
• Lookup columns
• More columns more SQL rows
• Can drastically reduce performance
51. Custom code
• Web.Lists[“Documents”]
• 1 RT, 252 Read IOps
• Web.GetList(“/Shared Documents”)
• 1 RT, 8 Read IOps
• ScriptLink.Register(“sp.js”);
• 2.0 second delay of page content
display (at 1mbps)
• 3 other JS files automatically registered
• ScriptLink.RegisterOnDemand(“sp.js
”);
• 0.0 second delay of page content
display
• List.Items.Count vs. List.ItemCount
• SPQuery is your friend
• Disposing objects
54. thank you.
SHAREPOINT AND PROJECT CONFERENCE ADRIATICS
ZAGREB, 10/15/2014 - 10/16/2014
Notas do Editor
Figure 2 shows files loading on seven TCP ports, represented by the grey horizontal lines, and the number of milliseconds that have elapsed. The colored bars are the files; red is HTML text, gold represents style sheets, tan represents JavaScript, and blue lines are images. Here a single port is opened first, and then two more ports are opened. After the first files (CSS) are loaded, more files (JavaScript and images) are loaded on the same ports.
Bandwidth Efficiency (Score = F) Bandwidth Efficiency Rate (BER) is a primary indication of how well a Web page is able to utilize the available bandwidth. Applications that do not follow such best practices as downloading on parallel TCP ports and using Keep-Alives and larger files will not sustain high bit rates on longer latency wide area networks (WANs). A score of A is given to 80% BER and above. BERs of 40% and below are given a score of F. The math for this rule is BER = AvgBitRate / MaxBitRate.
For our test of the TechNet Magazine site the analysis indicates that though the Web site is downloading at a maximum bit rate of 3Mbps (3022Kbps), it is averaging only 523Kbps. That's an average of only 17%of the max—not very efficient. The ideal Web page ramps up to max bit rate and then stays at max bit rate until the page is completed. Instead, many sites download at a trickle or in short bursts. The score for this rule reflects of all the other best practices (known and unknown).
Expiration Date (Score = F) This rule checks for expiration dates. When a user returns to a site, many of the needed files are already in the cache and will be reused, but first the browser will check to see if a file is still good. If no expiration date is found, the browser will send a Get-If-Modified request to the server.
Time to First Byte(Score = D) This rule checks the server response time. TTFB is the time from the Get packet until the first response packet. Subtracting the TCP connect time from the TTFB gives the server response time. A response time of less than 30ms is scored as an A, while a time greater than 100ms is an F.
Image clustering (Score = F) This rule checks the number of small image files. The site we looked at has 28 files that are under 4KB. TCP does a poor job downloading smaller files. It's much like going grocery shopping and only getting one item at a time, then going home and coming back later for another one item, over and over again. It's far better to consolidate many smaller files into fewer large files so that TCP can send more packets per round-trip. With images, we call this image clustering, and it involves putting many small images side-by-side in one file and then cropping them out and placing them on the page on the client side.
Once you click on "Launch the developer dashboard" it will open the below Figure : 2
In that figure you can see what are requests, against each request you can observe server info, in server info Aggregate status will give how many SQL queries have run, how many SharePoint requests and services has been called what is duration for each of them etc.
See more at: http://www.sharepoint-journey.com/developer-dashboard-in-sharepoint-2013.html#sthash.LLk7wDDr.dpuf
SQL queries running against each request:
One of the most important criteria while designing the SharePoint solution is SQL. Because the performance of SharePoint depends on the SQL. We need for what type of queries runs in the background for each request so that it will be a great help for while troubleshooting the performance issues related to SharePoint.
Once you go to the SQL section of the dashboard you can see the queries name and execution plan details will get displayed once you click on those links.
Other than that there are few important parameters which will help us while troubleshooting the performance issue like what is the total duration to performance query, how many reads and write operations done by the query to the SQL server.
This makes easier for SQL DBA to troubleshoot the issues related to performance of SharePoint.
See more at: http://www.sharepoint-journey.com/developer-dashboard-in-sharepoint-2013.html#sthash.LLk7wDDr.dpuf
ULS logs:
There are many cases where you want to check the error messages related to only that particular request.
In this dashboard we have a separate section for the ULS logs to check against each and every request.
See more at: http://www.sharepoint-journey.com/developer-dashboard-in-sharepoint-2013.html#sthash.LLk7wDDr.dpuf
MDS (Minimal download strategy):
One of the new feature in SharePoint 2013 is a minimal download strategy.
Earlier days whenever you access the page the complete page reloads again, it causes the decrease in performance. In SharePoint 2013 it's not the case, it will load only portion of the page if there is any change so it drastically improves the performance of the application.
See more at: http://www.sharepoint-journey.com/developer-dashboard-in-sharepoint-2013.html#sthash.LLk7wDDr.dpuf
logparser "select cs-uri-stem, count(cs-uri-stem) from "C:\inetpub\logs\LogFiles\W3SVC740837153\u_ex140405.log" where cs-uri-stem like '%aspx%' or cs-uri-stem like '%ashx%' group by cs-uri-stem order by count(cs-uri-stem) desc“