SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
“This One Goes Up To 11”
                              or
         How to write scalable ASP.NET

Phil Pursglove
phil@philippursglove.com
http://diaryofadotnetdeveloper.blogspot.com
http://www.philippursglove.com/ScalableASPNET
http://twitter.com/philpursglove
About Me
•   Senior .NET Developer
•   MBCS
•   MCSD
•   VBUG East Anglia Co-ordinator
•   Written for VB Developer and SQL
    Server Pro
Agenda
• Increasing server performance
  – Caching
     •   Output caching
     •   Object caching
     •   Donut caching
     •   Velocity
  – Paging
• Reducing network loads
  – Managing ViewState
  – Compression
• Load Balancing
What is Scalability?
• “The ability to handle growing amounts
  of work in a graceful manner” Wikipedia
• What affects scalability?

• Everything you see this evening
  applies to .NET 2.0 and higher
Increasing Server
  Performance
Why Cache?
• Because there’s a credit crunch!
• Building a page is an expensive
  process
  – Database calls across servers
  – Web Service calls
  – AD lookups

• Returning a stored page from a cache
  is much cheaper!
Caching 1: OutputCache
• Caches the rendered HTML from your
  page
  – Duration is in seconds
  – VaryByParam allows you to cache several
    versions
  – Location means you can cache on the
    web server, client, downstream machines
    or all of these
  – CacheProfiles mean you have fine config-
    based control
Caching 2: Caching API
• Store objects in memory and pull them
  out when you need them

• For data objects, you have to use
  DataSets and DataTables, not
  DataReaders
Caching 2: CacheDependency
• Objects in the cache can be dependent on
  other objects
  – When the dependency changes, the cached item
    is removed
  – Not very useful in .NET 1.1

• .NET 2.0 introduced SqlCacheDependency
  – Cached objects can be dependent on SQL tables
  – Enable using the ASPNET_REGSQL tool
  – Or programmatically with the
    SqlCacheDependencyAdmin object
Caching 3: Velocity
• Velocity
  – Distributed cache
     • One logical cache split across several servers
     • PowerShell management console
  – CTP2 released at PDC
  – CTP3 releasing at Mix 09

  – Doesn’t have dependencies – yet

  – The future: automatic caching?
Caching 3: Velocity
Caching 4: Donut Caching
• aka Post-Cache Substitution

• Inject dynamic content into a cached
  page before it is returned to the client
  – <asp:substitution>
  – Must use static methods with a
    HttpContext
Paging
• Default GridView paging behaviour reads the
  entire dataset every time
  – For 100 000 rows this probably isn’t so good
• Write your own paging mechanism
• For custom paging DataGrids are better than
  GridViews
• In SQL 2005 the ROW_NUMBER function is
  your friend!
• LINQ
  – Skip
Reducing Network Loads
ViewState 1
                                    Viewstate Size
                                       in bytes
   HTML Table (built in-line)            52
HTML Table (built in code-behind)        52
          DataList                      6628
         Repeater                       6600
          DataGrid                      10592
          GridView                      10928
ViewState 2
• Taming Viewstate
  – Can be disabled per-control
  – ZIP it up and put the zipped version on the
    page
  – Keep it on the web server
Compression 1
• All modern browsers will accept
  compressed content
     – Content is compressed on the server /
       decompressed by the browser
     – Can be enabled in IIS
or
     – Use the HttpCompress library
Compression
Compression 2
• JavaScript Compression
  – JSMin (http://tinyurl.com/jscriptmin)
  – jQuery is pre-minified for you


• CSS Compression
Load Balancing
Load Balancing
• Synchronise machineKey (in
  machine.config)
• Don’t use basic Session state
  – SQL Server Session State
  – ASP.NET State Service
  – Velocity ASP.NET Session state
Summary
• Cache is King!
• Paging is good for your pages!
• Viewstate doesn’t have to be evil!
Any Questions?
Resources
• DotNetRocks
  – http://www.dotnetrocks.com/default.aspx?showNum=24
  – http://www.dotnetrocks.com/default.aspx?showNum=367



• Books
  – Essential ASP.NET by Fritz Onion
  – The ASP.NET 2.0 Cookbook by Michael Gittel & Geoffrey
    LeBlond
  – The ASP.NET Anthology by Scott Allen et al


• MSDN White Paper on .NET Performance &
  Scalability
  – http://msdn.microsoft.com/en-us/library/ms998530.aspx
Resources
• Velocity
  – http://blogs.msdn.com/velocity
  – http://www.hanselman.com/blog/HanselminutesPodcast116DistributedCac
    hingWithMicrosoftsVelocity.aspx

• Donut Caching
  – http://tinyurl.com/donutcaching




• HttpCompress Library
  –   http://www.blowery.org/code/HttpCompressionModule.html

Más contenido relacionado

La actualidad más candente

Insight on MongoDB Change Stream - Abhishek.D, Mydbops Team
Insight on MongoDB Change Stream - Abhishek.D, Mydbops TeamInsight on MongoDB Change Stream - Abhishek.D, Mydbops Team
Insight on MongoDB Change Stream - Abhishek.D, Mydbops TeamMydbops
 
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011camp_drupal_ua
 
Design a scalable site: Problem and solutions
Design a scalable site: Problem and solutionsDesign a scalable site: Problem and solutions
Design a scalable site: Problem and solutionsChau Thanh
 
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TSOpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TSAlkacon Software GmbH & Co. KG
 
WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale WebinarPantheon
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sitesdrupalcampest
 
WordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningWordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningTimothy Wood
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadKrivoy Rog IT Community
 
MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups Mydbops
 
Php & web server performace
Php & web server performacePhp & web server performace
Php & web server performaceTuyển Đoàn
 
Евгений Самоненко - Практическая оптимизация сервер сайд современные реалии
Евгений Самоненко - Практическая оптимизация сервер сайд современные реалииЕвгений Самоненко - Практическая оптимизация сервер сайд современные реалии
Евгений Самоненко - Практическая оптимизация сервер сайд современные реалииWeb Tech Fun
 
Практическая оптимизация сервер сайд: современные реалии
Практическая оптимизация сервер сайд: современные реалииПрактическая оптимизация сервер сайд: современные реалии
Практическая оптимизация сервер сайд: современные реалииValtech Ukraine
 
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Dylan Butler
 
Full stack development using javascript what and why - ajay chandravadiya
Full stack development using javascript   what and why - ajay chandravadiyaFull stack development using javascript   what and why - ajay chandravadiya
Full stack development using javascript what and why - ajay chandravadiyaajayrcgmail
 

La actualidad más candente (16)

Insight on MongoDB Change Stream - Abhishek.D, Mydbops Team
Insight on MongoDB Change Stream - Abhishek.D, Mydbops TeamInsight on MongoDB Change Stream - Abhishek.D, Mydbops Team
Insight on MongoDB Change Stream - Abhishek.D, Mydbops Team
 
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
 
Design a scalable site: Problem and solutions
Design a scalable site: Problem and solutionsDesign a scalable site: Problem and solutions
Design a scalable site: Problem and solutions
 
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TSOpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
 
WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale Webinar
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
WordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningWordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & Tuning
 
Performance Web
Performance WebPerformance Web
Performance Web
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
 
MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups
 
Php & web server performace
Php & web server performacePhp & web server performace
Php & web server performace
 
Евгений Самоненко - Практическая оптимизация сервер сайд современные реалии
Евгений Самоненко - Практическая оптимизация сервер сайд современные реалииЕвгений Самоненко - Практическая оптимизация сервер сайд современные реалии
Евгений Самоненко - Практическая оптимизация сервер сайд современные реалии
 
Практическая оптимизация сервер сайд: современные реалии
Практическая оптимизация сервер сайд: современные реалииПрактическая оптимизация сервер сайд: современные реалии
Практическая оптимизация сервер сайд: современные реалии
 
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
 
Presentation1
Presentation1Presentation1
Presentation1
 
Full stack development using javascript what and why - ajay chandravadiya
Full stack development using javascript   what and why - ajay chandravadiyaFull stack development using javascript   what and why - ajay chandravadiya
Full stack development using javascript what and why - ajay chandravadiya
 

Destacado

παρουσιαση προϊοντοσ με Dvd
παρουσιαση προϊοντοσ με Dvdπαρουσιαση προϊοντοσ με Dvd
παρουσιαση προϊοντοσ με DvdPeaca and Glory
 
The Need For Speed - NEBytes
The Need For Speed - NEBytesThe Need For Speed - NEBytes
The Need For Speed - NEBytesPhil Pursglove
 
The Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgeThe Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgePhil Pursglove
 
Tweet reach its_k_isabella
Tweet reach its_k_isabellaTweet reach its_k_isabella
Tweet reach its_k_isabellaMatthew Gain
 
Twitter and the Australian Election 2010
Twitter and the Australian Election 2010Twitter and the Australian Election 2010
Twitter and the Australian Election 2010Matthew Gain
 

Destacado (9)

Crystal MEF
Crystal MEFCrystal MEF
Crystal MEF
 
παρουσιαση προϊοντοσ με Dvd
παρουσιαση προϊοντοσ με Dvdπαρουσιαση προϊοντοσ με Dvd
παρουσιαση προϊοντοσ με Dvd
 
Velocity - Edge UG
Velocity - Edge UGVelocity - Edge UG
Velocity - Edge UG
 
Remembering Amber
Remembering  AmberRemembering  Amber
Remembering Amber
 
The Need For Speed - NEBytes
The Need For Speed - NEBytesThe Need For Speed - NEBytes
The Need For Speed - NEBytes
 
The Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgeThe Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen Cambridge
 
Tweet reach its_k_isabella
Tweet reach its_k_isabellaTweet reach its_k_isabella
Tweet reach its_k_isabella
 
Twitter and the Australian Election 2010
Twitter and the Australian Election 2010Twitter and the Australian Election 2010
Twitter and the Australian Election 2010
 
What Genre Am I
What Genre Am IWhat Genre Am I
What Genre Am I
 

Similar a How to Write Scalable ASP.NET Apps

DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtNick Santamaria
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas Weinert
 
Scylla Summit 2016: Compose on Containing the Database
Scylla Summit 2016: Compose on Containing the DatabaseScylla Summit 2016: Compose on Containing the Database
Scylla Summit 2016: Compose on Containing the DatabaseScyllaDB
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduceMatt Wrock
 
High performance website
High performance websiteHigh performance website
High performance websiteChamnap Chhorn
 
How_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_FarmHow_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_FarmNigel Price
 
Biomatters and Amazon Web Services
Biomatters and Amazon Web Services Biomatters and Amazon Web Services
Biomatters and Amazon Web Services Biomatters
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructureharendra_pathak
 
Apache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutApache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutSander Temme
 
Rails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeRails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeFastly
 
Rails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeRails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeMichael May
 
Running PostgreSQL in a Kubernetes cluster: CloudNativePG
Running PostgreSQL in a Kubernetes cluster: CloudNativePGRunning PostgreSQL in a Kubernetes cluster: CloudNativePG
Running PostgreSQL in a Kubernetes cluster: CloudNativePGNick Ivanov
 
[Hanoi-August 13] Tech Talk on Caching Solutions
[Hanoi-August 13] Tech Talk on Caching Solutions[Hanoi-August 13] Tech Talk on Caching Solutions
[Hanoi-August 13] Tech Talk on Caching SolutionsITviec
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance OptimizationChen-Tien Tsai
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)Michael Collier
 
SharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 PerformanceSharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 PerformanceBrian Culver
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The SnailMarcus Deglos
 

Similar a How to Write Scalable ASP.NET Apps (20)

DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an Afterthought
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 
Scylla Summit 2016: Compose on Containing the Database
Scylla Summit 2016: Compose on Containing the DatabaseScylla Summit 2016: Compose on Containing the Database
Scylla Summit 2016: Compose on Containing the Database
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduce
 
High performance website
High performance websiteHigh performance website
High performance website
 
How_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_FarmHow_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_Farm
 
Biomatters and Amazon Web Services
Biomatters and Amazon Web Services Biomatters and Amazon Web Services
Biomatters and Amazon Web Services
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructure
 
Apache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutApache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling Out
 
Rails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeRails Caching: Secrets From the Edge
Rails Caching: Secrets From the Edge
 
Rails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeRails Caching Secrets from the Edge
Rails Caching Secrets from the Edge
 
Running PostgreSQL in a Kubernetes cluster: CloudNativePG
Running PostgreSQL in a Kubernetes cluster: CloudNativePGRunning PostgreSQL in a Kubernetes cluster: CloudNativePG
Running PostgreSQL in a Kubernetes cluster: CloudNativePG
 
[Hanoi-August 13] Tech Talk on Caching Solutions
[Hanoi-August 13] Tech Talk on Caching Solutions[Hanoi-August 13] Tech Talk on Caching Solutions
[Hanoi-August 13] Tech Talk on Caching Solutions
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)
 
Performance out
Performance outPerformance out
Performance out
 
SharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 PerformanceSharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 Performance
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
 
Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 

Último

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Último (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

How to Write Scalable ASP.NET Apps

  • 1. “This One Goes Up To 11” or How to write scalable ASP.NET Phil Pursglove phil@philippursglove.com http://diaryofadotnetdeveloper.blogspot.com http://www.philippursglove.com/ScalableASPNET http://twitter.com/philpursglove
  • 2. About Me • Senior .NET Developer • MBCS • MCSD • VBUG East Anglia Co-ordinator • Written for VB Developer and SQL Server Pro
  • 3. Agenda • Increasing server performance – Caching • Output caching • Object caching • Donut caching • Velocity – Paging • Reducing network loads – Managing ViewState – Compression • Load Balancing
  • 4. What is Scalability? • “The ability to handle growing amounts of work in a graceful manner” Wikipedia • What affects scalability? • Everything you see this evening applies to .NET 2.0 and higher
  • 5. Increasing Server Performance
  • 6. Why Cache? • Because there’s a credit crunch! • Building a page is an expensive process – Database calls across servers – Web Service calls – AD lookups • Returning a stored page from a cache is much cheaper!
  • 7. Caching 1: OutputCache • Caches the rendered HTML from your page – Duration is in seconds – VaryByParam allows you to cache several versions – Location means you can cache on the web server, client, downstream machines or all of these – CacheProfiles mean you have fine config- based control
  • 8. Caching 2: Caching API • Store objects in memory and pull them out when you need them • For data objects, you have to use DataSets and DataTables, not DataReaders
  • 9. Caching 2: CacheDependency • Objects in the cache can be dependent on other objects – When the dependency changes, the cached item is removed – Not very useful in .NET 1.1 • .NET 2.0 introduced SqlCacheDependency – Cached objects can be dependent on SQL tables – Enable using the ASPNET_REGSQL tool – Or programmatically with the SqlCacheDependencyAdmin object
  • 10. Caching 3: Velocity • Velocity – Distributed cache • One logical cache split across several servers • PowerShell management console – CTP2 released at PDC – CTP3 releasing at Mix 09 – Doesn’t have dependencies – yet – The future: automatic caching?
  • 12. Caching 4: Donut Caching • aka Post-Cache Substitution • Inject dynamic content into a cached page before it is returned to the client – <asp:substitution> – Must use static methods with a HttpContext
  • 13. Paging • Default GridView paging behaviour reads the entire dataset every time – For 100 000 rows this probably isn’t so good • Write your own paging mechanism • For custom paging DataGrids are better than GridViews • In SQL 2005 the ROW_NUMBER function is your friend! • LINQ – Skip
  • 15. ViewState 1 Viewstate Size in bytes HTML Table (built in-line) 52 HTML Table (built in code-behind) 52 DataList 6628 Repeater 6600 DataGrid 10592 GridView 10928
  • 16. ViewState 2 • Taming Viewstate – Can be disabled per-control – ZIP it up and put the zipped version on the page – Keep it on the web server
  • 17. Compression 1 • All modern browsers will accept compressed content – Content is compressed on the server / decompressed by the browser – Can be enabled in IIS or – Use the HttpCompress library
  • 19. Compression 2 • JavaScript Compression – JSMin (http://tinyurl.com/jscriptmin) – jQuery is pre-minified for you • CSS Compression
  • 21. Load Balancing • Synchronise machineKey (in machine.config) • Don’t use basic Session state – SQL Server Session State – ASP.NET State Service – Velocity ASP.NET Session state
  • 22. Summary • Cache is King! • Paging is good for your pages! • Viewstate doesn’t have to be evil!
  • 24. Resources • DotNetRocks – http://www.dotnetrocks.com/default.aspx?showNum=24 – http://www.dotnetrocks.com/default.aspx?showNum=367 • Books – Essential ASP.NET by Fritz Onion – The ASP.NET 2.0 Cookbook by Michael Gittel & Geoffrey LeBlond – The ASP.NET Anthology by Scott Allen et al • MSDN White Paper on .NET Performance & Scalability – http://msdn.microsoft.com/en-us/library/ms998530.aspx
  • 25. Resources • Velocity – http://blogs.msdn.com/velocity – http://www.hanselman.com/blog/HanselminutesPodcast116DistributedCac hingWithMicrosoftsVelocity.aspx • Donut Caching – http://tinyurl.com/donutcaching • HttpCompress Library – http://www.blowery.org/code/HttpCompressionModule.html