Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer.
-
Upload
brenda-ferguson -
Category
Documents
-
view
218 -
download
0
Transcript of Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer.
Sitefinity Performance and ArchitectureJune 4, 2015
Christopher Peck, Sales Engineer
Overview
• Performance and
Monitoring• Development Considerations
• Client Side
• Server Side
• Tools
• Page Pre-Compilation
• Diagnostics Module
• Useful Customizations and Practices
• Custom Trace Listeners
• Web Test Runner
• Deployment
Architecture• System Requirements
• Common Setup Scenarios
• Deployment
Development Considerations
• Client Side• Cache results from jQuery Selectors
• Server Side• Use paging and filtering• Use LINQ deferred Execution (Most of the
time.)
Cache results from jQuery Selectors
• Selecting an element with jQuery traverses the DOM tree
• DOM traversal can be expensive• If we use an selector more than once it should be
cached.
var highlightedItems = $(li.highlighted);highlightedItems.click( function () { highlightedItems.removeClass("highlighted"); highlightedItems.addClass("otherClass");});
Use Paging and Filtering
• The API supports paging and filtering.• App.WorkWith().NewsItems().Get().Skip(40).Take(20);
• Use these options to cut down on data loaded into memory and limit load on the connection to the database
Use LINQ deferred Execution (Most of the time.)
• The API returns IQueryables so we can shift processing to the database server and use deferred execution.
• Use of ToList() will force the query to execute.• This often results in getting too much data
from the database and using too much memory on our web server.
• (Caveat: Sometimes we need to force a query to save an N+1 query later.)
Tools
• Page Pre-Compilation• Helps pages load faster when requested
for the first time• Reduces processor load• Skips the warm-up phase when a site is
deployed.
• Diagnostics Module• Operation Run Times• N+1 Query Problems• Custom Reports
Diagnostics Module
• Operation Run Times• See services used, the database calls they are making, and
duration
• N+1 Query Problems• Tool highlights potential N+1 Queries• Lazy loading is great, but be aware of when we need to force
prefetching. • Try projection strategies to denormalize and preload.
• Custom Reports• RunBigResultSetAnalysis
• See operations that fetched a significant amount of records
• RunLongQueryAnalysis• See operations that took a long time to run
Useful Customizations from the SDK
• Custom Trace Listeners• Log errors to external systems (e.g.
Raygun.io)
• Web Test Runner• Run Integration Tests with Sitefinity.
Basic Architecture Diagram (Single Level)
Production Server Production DatabaseInternet
Incoming HTTP Requests
Notes: A simple diagram of the simplest setup commonly seen in a production environment. Two servers: one web and one database
Simplified Architecture Diagram
Content Creation
Publish (Code)
Production Development
SiteSync (Content)
Publish (Code)
Content Author Computer
Staging
Publish (Code)
Automated Deployment Infrastructure
Developer Computer
Source Code Check In
Notes: Common architecture with databases removed for clarity. Staging and Development may share a database server. Generally production should have a completely separate database server.
Content Flow Detail
Staging Database
Production Server Staging Server
Production Database
Content Creation
Content Author Computer
Site Sync
Code Flow Deployment Strategy
Source ControlLocal Dev Staging
Check In
Test Failed
Check In
Test Passed Trigger Deployment
Tests Passed Promotion
Prod
Tests Passed Promotion
Code Deployment
• Source Control• git• TFS and Visual Studio Online
• Automated Deployment• Visual Studio Online• TeamCity• Octopus Deploy
Site Synchronization Fluent API
Using Statement using Telerik.Sitefinity.SiteSync;
Facade App.WorkWith().SiteSync()
Select Target Server .SelectTarget("http://targetserver")
Select Target Sites (Multisite) .SetSites("site1", "site2", ...)
Sync a content types .Sync(typeof(NewsItem).FullName, ...)
Sync a specific content item for a specific language .Sync(newsItem, CultureInfo.CurrentCulture)
Schedule the sync for later (Cron format) .ScheduleSync(“30 15 5 3 * 2015”, typeof(NewsItem).FullName, …)
Production – Infrastructure Diagram 1(Simple w/ HW LB)
Web Server
Database
Web Server
Load Balancing Addon
Hardware Load Balancer
Notes: Common On Premise Simplified Setup
Production – Infrastructure Diagram 2(Simple w/ SW LB)
Web Server
Database
Web Server
Load Balancing AddonNLB
Notes:Common in On Premise or In Cloud Would be suitable for Both AWS and Azure
Production – Infrastructure Diagram 3(Simple w/ Azure)
Web Server(Azure Cloud Services)
Database(SQL Azure)
Web Server(Azure Cloud Services)
Azure LB
Notes:When using Sitefinity on Azure Cloud Services in a load-balanced scenario (including Auto Scaling) you do not need to configure Sitefinity for Load Balancing. Sitefinity uses the Windows Azure API to automatically identify the web role instances that must be messaged to invalidate the cache dependencies.
Advantages of Azure
• Database: SQL Azure• Built in point in time and various levels of
geo-restore in case of geographic outages
• Web Servers: Azure Cloud Services• Automatic use of Azure load balancing is
built into Sitefinity
Load Balancing
• Support both hardware and software load balancing
• If running in non-Azure environment load balancing addon must be configured on each web server.
• Load Balancing addon invalidates caches on updates to content.
Staging and Development Suggestions
• If using a hosting service the UAT/Staging environment should use the same hosting provider to mirror production as closely as possible
• It is common to see Staging and Dev share a database server (Different databases/schemas) for cost reasons.
• We also generally see Dev as a code testing area only with content being added on Staging. Occasionally see 4 tier deployments with QA coming after Staging.
Project Assessment Services
We can help you optimize the stability, performance and user experience of your Sitefinity project:
• We’ll validate your technical solution design
• Our developers will profile a copy of your project
• We’ll analyze its code for any deviations from best practices
• You will get a list of recommendations that will help you introduce optimizations and deliver the project successfully