200 likes | 545 Views
Kentico CMS Performance Optimization. Implementation at Newsmax - Ayush Chaturvedi. Agenda. The Newsmax Project Architecture, load and performance Optimizations Queries Code Caching Database Application Server Front End Optimizations. Newsmax Project. Site layout
E N D
Kentico CMS Performance Optimization Implementation at Newsmax - AyushChaturvedi
Agenda • The Newsmax Project • Architecture, load and performance • Optimizations • Queries • Code • Caching • Database • Application Server • Front End Optimizations
Newsmax Project • Site layout • One instance two sites www.newsmax.com, www.moneynews.com • Centered around articles • Customizations & features like slideshows • Notice urls • High load, High performance and High availability • Project Layout • Dev –Dev Test– Stage - Production • Load balanced on two servers • TFS team and build automation is used.
Newsmax Project Contd.. • Avg. visits a month ~ 20,000,000
Newsmax Project Contd.. • Best case on a single day ~ 3,000,000
Newsmax Project contd.. • Our experience with Kentico • We have grown as Kentico has over the last year. • Seen Database CPU from 99% to 3-4% . • From versions to versions till 5.5 • 5.5 is the real enterprise class CMS
Where are we? • The Newsmax Project • Architecture, load and performance • Optimizations • Queries • Code • Caching • Database • Application Server • Front End Optimizations
Optimizations • Kentico CMS off the shelf + efforts at Newsmax • Off the shelf: caching, indexing, queries • Newsmax: more caching and cache management, more indexing and stats and query tuning. • UPGRADE TO 5.5 (V.V. imp.) • Understand Kentico CMS is a normal ASP.NET web project. Many
Optimization - Queries • Understanding what queries run on a page request • User request query to node alias query to documentpath query to documentaliases • Initially aliases then document url path • One page to serve all articles. /{section}/{keywords}/{year}/{month}/{date}/id/{id} • Understanding the three tables that create a document • Cms_tree, cms_document, doctype tables • Difference between select and selectdocument • Define select columns, avoid selecting ntext {nvarchar(max)}columns for listing controls • Extreme case (not recommended unless justified) modify view_doctype_joined
example SELECT ##TOPN## ##columns## FROM dbo.View_CMS_Tree_Joinedct INNER JOIN dbo.Newsmax_Articlena ON ct.DocumentForeignKeyValue = na.ArticleID AND ct.NodeClassID = 2046 INNER JOIN dbo.customtable_SiteSectionArticlescssa ON (na.NMID = cssa.ArticleID AND ct.Published = 1 AND ct.NodeParentID = @parentID AND cssa.SiteSectionID = @SiteSectionID) INNER JOIN dbo.customtable_SiteSectionscss on cssa.SiteSectionID = css.NMID ORDER BY CASE ##ORDERBY## SELECT ##TOPN## ##COLUMNS## FROM View_Newsmax_Article_Joined inner join custom tables WHERE (##WHERE##) ORDER BY ##ORDERBY## // joining a view of views to another table. !!Again not recommended unless you are an expert and willing to support.
Optimization - Code • Scheduled tasks, use wisely • Portal development mode reduces custom code. • Output filters. Use only if absolutely needed. • Store images on both file system and db • Ondatabound Processing. • Avoid queries to databases, use cached context variablesand macros. • Monitor eventlog and clean errors. Exceptions cause performance problems. E.g. missing image in a CSS.
Where are we? • The Newsmax Project • Architecture, load and performance • Optimizations • Queries • Code • Caching • Database • Application Server • Front End Optimizations
Optimization - Caching • No cache no performance. • Levels of caching • Data cache, partial cache (asp.net output cache), full page cache, IIS output cache • Implementation of keys and cache expiry mechanism is critical • E.gNewsmax custom dummy key based cache dependency newsmax|custom|sectionid|16 • Cache expiry handling in 5.5. Refer Martin’s blog post. • At Newsmax we cache the latest 6000 articles • Have images cached
Optimization of Database • SQL 2008 (advanced level for DBAs) • DB Architecture • Cluster, failover configuration. • RAID Drive mounts and locations. • TempDB. • Backup Scheme.
Optimization of Database – Contd. • Query tuning • Specially for custom tables • Data tuning advisor, index usage stats • Index_seekvsindex_scans • Too much indexing and stats can cause wrong compilation plans • Keep an eye on compiled plans and single use ad hoc queries • Optimize for ad-hoc workload • Forced parameterization • Case of Order by 1 • Understanding AWE and PAE switches • Depending on your DB size. • Min and Max memory setting • MaxDOP setting
Optimization – Application server • Load balanced • Multiple core (i7), SSD drives, 32GB RAM, Windows 2008 server. • IIS recycling set to a particular time. • Redirects done in IIS rather than in the CMS
Optimizations – Front End • Often neglected • Image compression • CSS and JavaScript mimification • CSS and JavaScript compression • Use of CSS sprites • JavaScripts to the bottom of the page. External if possible. • Using client browser cache (E-tags) • Minimize HTTP requests (e.g. libraries for front end validation)
Optimizations- Even more • For superior caching consider 3rd party tools like Memcached • Use Content Delivery Networks • For extremely large datasets 100s of millions consider partitioning DB tables. • Future DB cluster support in Kentico.
About Myself • Working as Systems Architect at Newsmax Media. Advertise with us we get a lot of traffic!! • Worked at fortune 500 companies like H&R Block with training at Microsoft. • Background in CMS and ERP systems. • Provide offshore troubleshooting and development services. • Interested in solving problems and discussing solutions. AYUSH CHATURVEDI ayushc@newsmax.com ayush4284@gmail.com 001-816-716-4843 Please collect business cards !! Feel free to contact. Credits: Thanks Karol, Neil and Martin for their inputs.
Questions?? Questions??