Sitefinity Performance and Architecture

advertisement
Sitefinity Performance and Architecture
Christopher Peck, Sales Engineer
June 4, 2015
Overview
• Performance and Monitoring
• Development Considerations
• Deployment Architecture
• System Requirements
• Client Side
• Common Setup Scenarios
• Server Side
• Deployment
• Tools
• Page Pre-Compilation
• Diagnostics Module
• Useful Customizations and Practices
• Custom Trace Listeners
• Web Test Runner
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)
Notes: A simple diagram of
the simplest setup
commonly seen in a
production environment.
Two servers: one web and
one database
Incoming HTTP Requests
Internet
Production Server
Production Database
Simplified Architecture Diagram
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 Author Computer
Content Creation
SiteSync (Content)
Production
Staging
Publish (Code)
Publish (Code)
Development
Publish (Code)
Source Code Check In
Automated Deployment
Infrastructure
Developer Computer
Content Flow Detail
Production Database
Staging Database
Content Creation
Site Sync
Production Server
Staging Server
Content Author Computer
Code Flow Deployment Strategy
Source
Control
Local
Dev
Staging
Prod
Check In
Test Failed
Check In
Test Passed
Trigger Deployment
Tests Passed
Promotion
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)
Notes: Common On
Premise Simplified Setup
Web Server
Load Balancing Addon
Hardware Load Balancer
Database
Web Server
Production – Infrastructure Diagram 2(Simple w/ SW LB)
Web Server
NLB
Notes:
Common in On Premise
or In Cloud Would be
suitable for Both AWS
and Azure
Load Balancing Addon
Database
Web Server
Production – Infrastructure Diagram 3(Simple w/ Azure)
Web Server
(Azure Cloud Services)
Azure LB
Database
(SQL Azure)
Web Server
(Azure Cloud Services)
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 georestore 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
Download