SlideShare una empresa de Scribd logo
1 de 22
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
    •   Donut caching
    •   Object caching
    •   Velocity
  – Paging
• Reducing network loads
  – Managing ViewState
  – Compression
What is Scalability?
• “The ability to handle growing amounts of
  work in a graceful manner” Wikipedia

• Scalability != Performance

• What affects scalability?

• Everything you see today 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
  – Cached pages can be removed with
    HttpResponse.RemoveOutputCachedItem
Caching 2: 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
Caching 3: 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 3: 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
  – Can integrate with OutputCaching
Caching 3: Velocity
• Velocity
   – Distributed cache
       • One logical cache split across several servers
       • PowerShell management console

   – CTP3 released April 09
       • v1 Summer 09
       • SP1 Q4 09
       • v2 Summer 2010

   – Doesn’t have dependencies – yet

   – The future: automatic caching?

• See also NCache and memcached
Paging
• Default GridView paging behaviour reads the
  entire dataset every time
  – For 100 rows this probably isn’t going to matter
  – For 1 000 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
  Object
                in bytes
HTML Table        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
  – CSSMin (http://tinyurl.com/cssmin-webdd)
  – Written in PHP
Summary
• Cache is King!
• Paging is good for your pages!
• Viewstate doesn’t have to be evil!
Any Questions?
Resources
• 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

• PodCasts
  –   http://www.dotnetrocks.com/default.aspx?showNum=24
  –   http://www.dotnetrocks.com/default.aspx?showNum=367

• MSDN White Paper on .NET Performance &
  Scalability
  –   http://msdn.microsoft.com/en-us/library/ms998530.aspx

• Strangeloop Networks Scaling Appliance
  –   http://www.strangeloopnetworks.com/products/AS1000/
Resources
• Velocity
  – http://blogs.msdn.com/velocity
  – http://www.hanselman.com/blog/HanselminutesPodcast116DistributedCac
    hingWithMicrosoftsVelocity.aspx
  – http://videos.visitmix.com/MIX09/T59F

• NCache
  – http://www.alachisoft.com/ncache/

• memcached
  – http://www.danga.com/memcached/

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

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

Más contenido relacionado

La actualidad más candente

NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX, Inc.
 
Get MEAN! Node.js and the MEAN stack
Get MEAN!  Node.js and the MEAN stackGet MEAN!  Node.js and the MEAN stack
Get MEAN! Node.js and the MEAN stackNicholas McClay
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimizationAlmog Baku
 
Benchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and ResultsBenchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and ResultsNGINX, Inc.
 
Velocity - NxtGen Oxford
Velocity - NxtGen OxfordVelocity - NxtGen Oxford
Velocity - NxtGen OxfordPhil Pursglove
 
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling StoryPHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Storyvanphp
 
Supercharge Application Delivery to Satisfy Users
Supercharge Application Delivery to Satisfy UsersSupercharge Application Delivery to Satisfy Users
Supercharge Application Delivery to Satisfy UsersNGINX, Inc.
 
MySQL 5.7 - the first few months
MySQL 5.7 - the first few monthsMySQL 5.7 - the first few months
MySQL 5.7 - the first few monthsSimon J Mudd
 
Supercharge JavaEE applications using JCache
Supercharge JavaEE applications using JCacheSupercharge JavaEE applications using JCache
Supercharge JavaEE applications using JCachePayara
 
Owain Perry (Just Giving) - Continuous Delivery of Windows Micro-Services in ...
Owain Perry (Just Giving) - Continuous Delivery of Windows Micro-Services in ...Owain Perry (Just Giving) - Continuous Delivery of Windows Micro-Services in ...
Owain Perry (Just Giving) - Continuous Delivery of Windows Micro-Services in ...Outlyer
 
MySQL Failover and Orchestrator
MySQL Failover and OrchestratorMySQL Failover and Orchestrator
MySQL Failover and OrchestratorSimon J Mudd
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relationalTony Tam
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersMarkus Eisele
 
Full stack development tools &amp; technologies
Full stack development tools &amp; technologiesFull stack development tools &amp; technologies
Full stack development tools &amp; technologieskumar satyam
 
Иван Глушков (Echo)
Иван Глушков (Echo)Иван Глушков (Echo)
Иван Глушков (Echo)Ontico
 
Cassandra Summit 2014: Deploying Cassandra for Call of Duty
Cassandra Summit 2014: Deploying Cassandra for Call of DutyCassandra Summit 2014: Deploying Cassandra for Call of Duty
Cassandra Summit 2014: Deploying Cassandra for Call of DutyDataStax Academy
 
Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
 Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre... Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...Redis Labs
 
Scaling a Web Service
Scaling a Web ServiceScaling a Web Service
Scaling a Web ServiceLeon Ho
 

La actualidad más candente (20)

NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & Acceleration
 
Get MEAN! Node.js and the MEAN stack
Get MEAN!  Node.js and the MEAN stackGet MEAN!  Node.js and the MEAN stack
Get MEAN! Node.js and the MEAN stack
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimization
 
Benchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and ResultsBenchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and Results
 
Mern stack developement
Mern stack developementMern stack developement
Mern stack developement
 
Velocity - NxtGen Oxford
Velocity - NxtGen OxfordVelocity - NxtGen Oxford
Velocity - NxtGen Oxford
 
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling StoryPHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
 
Supercharge Application Delivery to Satisfy Users
Supercharge Application Delivery to Satisfy UsersSupercharge Application Delivery to Satisfy Users
Supercharge Application Delivery to Satisfy Users
 
MySQL 5.7 - the first few months
MySQL 5.7 - the first few monthsMySQL 5.7 - the first few months
MySQL 5.7 - the first few months
 
Supercharge JavaEE applications using JCache
Supercharge JavaEE applications using JCacheSupercharge JavaEE applications using JCache
Supercharge JavaEE applications using JCache
 
Through the JMX Window
Through the JMX WindowThrough the JMX Window
Through the JMX Window
 
Owain Perry (Just Giving) - Continuous Delivery of Windows Micro-Services in ...
Owain Perry (Just Giving) - Continuous Delivery of Windows Micro-Services in ...Owain Perry (Just Giving) - Continuous Delivery of Windows Micro-Services in ...
Owain Perry (Just Giving) - Continuous Delivery of Windows Micro-Services in ...
 
MySQL Failover and Orchestrator
MySQL Failover and OrchestratorMySQL Failover and Orchestrator
MySQL Failover and Orchestrator
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relational
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java Developers
 
Full stack development tools &amp; technologies
Full stack development tools &amp; technologiesFull stack development tools &amp; technologies
Full stack development tools &amp; technologies
 
Иван Глушков (Echo)
Иван Глушков (Echo)Иван Глушков (Echo)
Иван Глушков (Echo)
 
Cassandra Summit 2014: Deploying Cassandra for Call of Duty
Cassandra Summit 2014: Deploying Cassandra for Call of DutyCassandra Summit 2014: Deploying Cassandra for Call of Duty
Cassandra Summit 2014: Deploying Cassandra for Call of Duty
 
Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
 Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre... Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
 
Scaling a Web Service
Scaling a Web ServiceScaling a Web Service
Scaling a Web Service
 

Similar a ASP.NET Scalability - WebDD

DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtNick Santamaria
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduceMatt Wrock
 
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
 
Lc3 beijing-june262018-sahdev zala-guangya
Lc3 beijing-june262018-sahdev zala-guangyaLc3 beijing-june262018-sahdev zala-guangya
Lc3 beijing-june262018-sahdev zala-guangyaSahdev Zala
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas Weinert
 
Biomatters and Amazon Web Services
Biomatters and Amazon Web Services Biomatters and Amazon Web Services
Biomatters and Amazon Web Services Biomatters
 
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
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructureharendra_pathak
 
High performance website
High performance websiteHigh performance website
High performance websiteChamnap Chhorn
 
WordPress performance tuning
WordPress performance tuningWordPress performance tuning
WordPress performance tuningVladimír Smitka
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The SnailMarcus Deglos
 
Cloud Architecture Tutorial - Platform Component Architecture (2of3)
Cloud Architecture Tutorial - Platform Component Architecture (2of3)Cloud Architecture Tutorial - Platform Component Architecture (2of3)
Cloud Architecture Tutorial - Platform Component Architecture (2of3)Adrian Cockcroft
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance OptimizationChen-Tien Tsai
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i Zend by Rogue Wave Software
 
[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
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 
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
 

Similar a ASP.NET Scalability - WebDD (20)

DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an Afterthought
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduce
 
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
 
Lc3 beijing-june262018-sahdev zala-guangya
Lc3 beijing-june262018-sahdev zala-guangyaLc3 beijing-june262018-sahdev zala-guangya
Lc3 beijing-june262018-sahdev zala-guangya
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 
Biomatters and Amazon Web Services
Biomatters and Amazon Web Services Biomatters and Amazon Web Services
Biomatters and Amazon Web Services
 
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)
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructure
 
High performance website
High performance websiteHigh performance website
High performance website
 
WordPress performance tuning
WordPress performance tuningWordPress performance tuning
WordPress performance tuning
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
 
Cloud Architecture Tutorial - Platform Component Architecture (2of3)
Cloud Architecture Tutorial - Platform Component Architecture (2of3)Cloud Architecture Tutorial - Platform Component Architecture (2of3)
Cloud Architecture Tutorial - Platform Component Architecture (2of3)
 
Velocity - Edge UG
Velocity - Edge UGVelocity - Edge UG
Velocity - Edge UG
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i
 
Create cloud service on AWS
Create cloud service on AWSCreate cloud service on AWS
Create cloud service on AWS
 
[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
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
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
 

Más de Phil Pursglove

CosmosDb for beginners
CosmosDb for beginnersCosmosDb for beginners
CosmosDb for beginnersPhil 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
 
The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010Phil Pursglove
 
The Need For Speed - NEBytes
The Need For Speed - NEBytesThe Need For Speed - NEBytes
The Need For Speed - NEBytesPhil Pursglove
 

Más de Phil Pursglove (7)

CosmosDb for beginners
CosmosDb for beginnersCosmosDb for beginners
CosmosDb for beginners
 
Glimpse
GlimpseGlimpse
Glimpse
 
The Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgeThe Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen Cambridge
 
Crystal MEF
Crystal MEFCrystal MEF
Crystal MEF
 
The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010
 
The Need For Speed - NEBytes
The Need For Speed - NEBytesThe Need For Speed - NEBytes
The Need For Speed - NEBytes
 
Innovation at WSP
Innovation at WSPInnovation at WSP
Innovation at WSP
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
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...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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...
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

ASP.NET Scalability - WebDD

  • 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 • Donut caching • Object caching • Velocity – Paging • Reducing network loads – Managing ViewState – Compression
  • 4. What is Scalability? • “The ability to handle growing amounts of work in a graceful manner” Wikipedia • Scalability != Performance • What affects scalability? • Everything you see today 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 – Cached pages can be removed with HttpResponse.RemoveOutputCachedItem
  • 8. Caching 2: 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
  • 9. Caching 3: 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
  • 10. Caching 3: 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 – Can integrate with OutputCaching
  • 11. Caching 3: Velocity • Velocity – Distributed cache • One logical cache split across several servers • PowerShell management console – CTP3 released April 09 • v1 Summer 09 • SP1 Q4 09 • v2 Summer 2010 – Doesn’t have dependencies – yet – The future: automatic caching? • See also NCache and memcached
  • 12. Paging • Default GridView paging behaviour reads the entire dataset every time – For 100 rows this probably isn’t going to matter – For 1 000 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
  • 14. ViewState 1 Viewstate Size Object in bytes HTML Table 52 DataList 6628 Repeater 6600 DataGrid 10592 GridView 10928
  • 15. 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
  • 16. 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
  • 18. Compression 2 • JavaScript Compression – JSMin (http://tinyurl.com/jscriptmin) – jQuery is pre-minified for you • CSS Compression – CSSMin (http://tinyurl.com/cssmin-webdd) – Written in PHP
  • 19. Summary • Cache is King! • Paging is good for your pages! • Viewstate doesn’t have to be evil!
  • 21. Resources • 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 • PodCasts – http://www.dotnetrocks.com/default.aspx?showNum=24 – http://www.dotnetrocks.com/default.aspx?showNum=367 • MSDN White Paper on .NET Performance & Scalability – http://msdn.microsoft.com/en-us/library/ms998530.aspx • Strangeloop Networks Scaling Appliance – http://www.strangeloopnetworks.com/products/AS1000/
  • 22. Resources • Velocity – http://blogs.msdn.com/velocity – http://www.hanselman.com/blog/HanselminutesPodcast116DistributedCac hingWithMicrosoftsVelocity.aspx – http://videos.visitmix.com/MIX09/T59F • NCache – http://www.alachisoft.com/ncache/ • memcached – http://www.danga.com/memcached/ • Donut Caching – http://tinyurl.com/donutcaching • HttpCompress Library – http://www.blowery.org/code/HttpCompressionModule.html