23
Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

Embed Size (px)

Citation preview

Page 1: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

Sitefinity Performance and ArchitectureJune 4, 2015

Christopher Peck, Sales Engineer

Page 2: Sitefinity Performance and Architecture June 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

Page 3: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

Development Considerations

• Client Side• Cache results from jQuery Selectors

• Server Side• Use paging and filtering• Use LINQ deferred Execution (Most of the

time.)

Page 4: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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");});

Page 5: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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

Page 6: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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.)

Page 7: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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

Page 8: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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

Page 9: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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.

Page 10: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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

Page 11: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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.

Page 12: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

Content Flow Detail

Staging Database

Production Server Staging Server

Production Database

Content Creation

Content Author Computer

Site Sync

Page 13: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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

Page 14: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

Code Deployment

• Source Control• git• TFS and Visual Studio Online

• Automated Deployment• Visual Studio Online• TeamCity• Octopus Deploy

Page 15: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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, …)

Page 16: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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

Page 17: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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

Page 18: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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.

Page 19: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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

Page 20: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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.

Page 21: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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.

Page 22: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer

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

Page 23: Sitefinity Performance and Architecture June 4, 2015 Christopher Peck, Sales Engineer