SlideShare a Scribd company logo
10 tips to make your ASP.NET
Apps Faster
Brij Bhushan Mishra
Who Am I
• Brij Bhushan Mishra
• Working as a Sr Developer
• Microsoft MVP - ASP.NET/IIS since 2011
• Active in various online and offline communities
• http://codewala.net
• @code_wala
• https://www.facebook.com/codewala
Tip 1: Kernel Caching
Overview of IIS
HTTP.Sys
Kernel level
User level
Windows
Activation
Service (WAS)
WWW
Service
Svchost.exe
Worker
Process
(w3wp.exe)
Worker
Process
(w3wp.exe)
Application Pool Application Pool
HTTP.sys
• Lowest layer of IIS and part of networking subsystem
• Minimizes the context switch for cached content
• Caching support for static and dynamic content
• Implements request queues per application pool
HTTP.Sys Architecture
TCP/IP
Response Cache
Req. Queue
Send Response
HTTP Parser
Namespace Mapper
Listener
HTTP Engine
Request Response
User Level
Req. Queue Req. Queue
Kernel Caching
Demo
Reasons why it could not be cached
• Say if request is authenticated
• Only Get request would be cached
• Dynamic compression is enabled for response (e.g. gzip)
• The request is NOT HTTP 1.1 or 1.0
• Many more….
http://support.microsoft.com/kb/817445
• Doesn’t replace any other User-Mode cache
Tip 2: Asynchrony in ASP.NET
How requests are handled in ASP.NET
Kernel level
User Level
g
IIS Worker
Thread
ASP.NET
processes the
request
Process and
Pass to
ASP.NET
HTTP.Sys
ASP.NET Request processing
App Pool queue
ASP.NET Queue
CLR Thread pool
ASP.NET Request
Handler
Request
Options?
• Write Asynchronous pages (Web forms and MVC/Web API)
• Asynchrnous HTTP Handlers
• Asynchrnous HTTP Modules
Async in ASP.NET Web forms
• Set Async page attribute to use Async pipleline
• Use RegisterAsyncTask to call Async code
• ASP.NET takes care of thread affinity
Async in ASP.NET MVC/Web API
• Simple – Just mark the action method Async
• Similar for Web APIs
• Lot of APIs support Async calls (like EF6+ and many more)
Asynchrony in ASP.NET
Demo
Async scenarios
• I/O operations ( DB calls, file system, Network calls etc..)
• Parallelism
• Long running event driven (streaming, polling etc)
Tip 3- CLR Thread pool
• Used by every managed executable
• ASP.NET requests execute on these thread only
• Designed to auto tune itself based on system resources
• It is configurable to handle specific scenarios
• To queue work to CLR thread pool, application can call
ThreadPool.QueueUserWorkItemAPI
Useful Configurations
• MinWorkerThread (rate which CLR creates thread)
• MaxCurrentRequestsPerCPU (IIS 7+, 12 prior to .NET 4)
• MaxConnection
<connectionManagement>
<add address="*" maxconnection="2">
<add address="http://65.53.32.230" maxconnection="12">
</connectionManagement>
CLR Thread pool
Demo
http://codewala.net @code_wala https://www.facebook.com/codewala
Tip 4: Pipeline mode
Request Processing Mode- Classic
• Duplication between
IIS and ASP.NET
• ASP.NET feature cannot
be applied to non
asp.net content like
form authentication
Request Processing Mode- Integrated
• Unified request
processing pipeline
• Native and managed
modules
• All modules can be
applied to all type
requests
Tip 5: runAllManagedModulesForAllRequests
• If it set true, means all the modules would be running for all the
requests.
• You may not need this for all the static files like jpeg, js, css etc.
• Options
• Create a different application altogether for static resources where it is set as
false
• Put all static contents in a folder in same application and make it false it for
same folder
<add name="UrlRewriteModule" preCondition="managedHandler"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
Tip 6: ASP.NET Pipeline
ASP.NET Pipeline
• ASP.NET Page Request Processing
HTTPModule 1
HTTPModule 2
HTTPModule 3
HTTPModule n
HTTP Handler
Request Response
.
.
.
ASP.NET Pipeline
Demo
Tip 7: SQL Data Source?
SQL Data Source
Demo
Tip 8: Remove Unused View Engines
Remove Unused View Engine
• By default, ASP.NET provides two View Engines.
• It looks first for ASP.NET view engine
• Remove which is not getting used
Do you have empty methods in Global.asax?
Unused View Engines
Demo
Tip 9: Don’t write logs in inetpub
Tip 10: Avoid extra calls to DB?
Use SQL profiler to check the hits
• Run the SQL profiler when access your page.
• You might be unknowingly hitting database several times. It’s very
common using any ORM tool like Entity Framework
• This is one of the main reasons of slow applications
Thank You
http://codewala.net
@code_wala
https://www.facebook.com/codewala
brij.mishra@outlook.com
Ad

More Related Content

What's hot (20)

ASP.NET MVC 4
ASP.NET MVC 4ASP.NET MVC 4
ASP.NET MVC 4
Danijel Malik
 
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens  SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
Sencha
 
Real World Rails Deployment
Real World Rails DeploymentReal World Rails Deployment
Real World Rails Deployment
Alan Hecht
 
Flask introduction
Flask introductionFlask introduction
Flask introduction
Hamid Feizabadi
 
ASP.NET MVC 4 Overview
ASP.NET MVC 4 OverviewASP.NET MVC 4 Overview
ASP.NET MVC 4 Overview
Gunnar Peipman
 
A Gentle Introduction to Blazor
A Gentle Introduction to BlazorA Gentle Introduction to Blazor
A Gentle Introduction to Blazor
Jose Javier Columbie
 
Codegen2021 blazor mobile
Codegen2021 blazor mobileCodegen2021 blazor mobile
Codegen2021 blazor mobile
Jose Javier Columbie
 
Azure Serverless Conf
Azure Serverless ConfAzure Serverless Conf
Azure Serverless Conf
Jose Javier Columbie
 
Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015
Ido Flatow
 
Host, deploy & scale Blazor Server Apps
Host, deploy & scale Blazor Server AppsHost, deploy & scale Blazor Server Apps
Host, deploy & scale Blazor Server Apps
Jose Javier Columbie
 
Asp.net core 1.0 (Peter Himschoot)
Asp.net core 1.0 (Peter Himschoot)Asp.net core 1.0 (Peter Himschoot)
Asp.net core 1.0 (Peter Himschoot)
Visug
 
Migration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET CoreMigration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET Core
Miroslav Popovic
 
Writing power shell the right tool for the job
Writing power shell   the right tool for the jobWriting power shell   the right tool for the job
Writing power shell the right tool for the job
Jaap Brasser
 
Building great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiBuilding great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapi
Maurice De Beijer [MVP]
 
JSFoo-2017 Takeaways
JSFoo-2017 TakeawaysJSFoo-2017 Takeaways
JSFoo-2017 Takeaways
Mir Ali
 
Writing a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media playerWriting a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media player
Tikal Knowledge
 
From server generated pages to client app in a micro-services world
From server generated pages to client app in a micro-services worldFrom server generated pages to client app in a micro-services world
From server generated pages to client app in a micro-services world
Assaf Gannon
 
ReactPHP + Symfony
ReactPHP + SymfonyReactPHP + Symfony
ReactPHP + Symfony
David Bergunder
 
Breaking the eggshell: From .NET to Node.js
Breaking the eggshell: From .NET to Node.jsBreaking the eggshell: From .NET to Node.js
Breaking the eggshell: From .NET to Node.js
Barbara Fusinska
 
Secure your environment by automation
Secure your environment by automationSecure your environment by automation
Secure your environment by automation
Jaap Brasser
 
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens  SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
Sencha
 
Real World Rails Deployment
Real World Rails DeploymentReal World Rails Deployment
Real World Rails Deployment
Alan Hecht
 
ASP.NET MVC 4 Overview
ASP.NET MVC 4 OverviewASP.NET MVC 4 Overview
ASP.NET MVC 4 Overview
Gunnar Peipman
 
Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015
Ido Flatow
 
Host, deploy & scale Blazor Server Apps
Host, deploy & scale Blazor Server AppsHost, deploy & scale Blazor Server Apps
Host, deploy & scale Blazor Server Apps
Jose Javier Columbie
 
Asp.net core 1.0 (Peter Himschoot)
Asp.net core 1.0 (Peter Himschoot)Asp.net core 1.0 (Peter Himschoot)
Asp.net core 1.0 (Peter Himschoot)
Visug
 
Migration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET CoreMigration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET Core
Miroslav Popovic
 
Writing power shell the right tool for the job
Writing power shell   the right tool for the jobWriting power shell   the right tool for the job
Writing power shell the right tool for the job
Jaap Brasser
 
Building great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiBuilding great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapi
Maurice De Beijer [MVP]
 
JSFoo-2017 Takeaways
JSFoo-2017 TakeawaysJSFoo-2017 Takeaways
JSFoo-2017 Takeaways
Mir Ali
 
Writing a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media playerWriting a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media player
Tikal Knowledge
 
From server generated pages to client app in a micro-services world
From server generated pages to client app in a micro-services worldFrom server generated pages to client app in a micro-services world
From server generated pages to client app in a micro-services world
Assaf Gannon
 
Breaking the eggshell: From .NET to Node.js
Breaking the eggshell: From .NET to Node.jsBreaking the eggshell: From .NET to Node.js
Breaking the eggshell: From .NET to Node.js
Barbara Fusinska
 
Secure your environment by automation
Secure your environment by automationSecure your environment by automation
Secure your environment by automation
Jaap Brasser
 

Similar to 10 tips to make your ASP.NET Apps Faster (20)

Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NET
Alex Thissen
 
IIS 6.0 and asp.net
IIS 6.0 and asp.netIIS 6.0 and asp.net
IIS 6.0 and asp.net
Rishi Kothari
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5
Malam Team
 
PHP on Windows 2008
PHP on Windows 2008PHP on Windows 2008
PHP on Windows 2008
jorke
 
Advanced Asp.Net Concepts And Constructs
Advanced Asp.Net Concepts And ConstructsAdvanced Asp.Net Concepts And Constructs
Advanced Asp.Net Concepts And Constructs
Manny Siddiqui MCS, MBA, PMP
 
Azure App Services
Azure App ServicesAzure App Services
Azure App Services
Alper Ebicoglu
 
App fabric introduction
App fabric introductionApp fabric introduction
App fabric introduction
Dennis van der Stelt
 
.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6
Amin Mesbahi
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
orkaplan
 
Philly Tech Fest Iis
Philly Tech Fest IisPhilly Tech Fest Iis
Philly Tech Fest Iis
Springhouse Education and Consulting Services
 
Understanding iis part1
Understanding iis part1Understanding iis part1
Understanding iis part1
Om Vikram Thapa
 
Asp.net performance
Asp.net performanceAsp.net performance
Asp.net performance
Abhishek Sur
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
Thomas Robbins
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOM
Aashish Jain
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
 
Lect02_Asp.NET.pptx
Lect02_Asp.NET.pptxLect02_Asp.NET.pptx
Lect02_Asp.NET.pptx
SwapnilPawar483968
 
The server side story: Parallel and Asynchronous programming in .NET - ITPro...
The server side story:  Parallel and Asynchronous programming in .NET - ITPro...The server side story:  Parallel and Asynchronous programming in .NET - ITPro...
The server side story: Parallel and Asynchronous programming in .NET - ITPro...
Panagiotis Kanavos
 
Understandingiis 120715123909-phpapp01
Understandingiis 120715123909-phpapp01Understandingiis 120715123909-phpapp01
Understandingiis 120715123909-phpapp01
arunparmar
 
[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions
European Collaboration Summit
 
Tips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC ApplicationsTips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC Applications
Sarvesh Kushwaha
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NET
Alex Thissen
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5
Malam Team
 
PHP on Windows 2008
PHP on Windows 2008PHP on Windows 2008
PHP on Windows 2008
jorke
 
.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6
Amin Mesbahi
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
orkaplan
 
Asp.net performance
Asp.net performanceAsp.net performance
Asp.net performance
Abhishek Sur
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
Thomas Robbins
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOM
Aashish Jain
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
 
The server side story: Parallel and Asynchronous programming in .NET - ITPro...
The server side story:  Parallel and Asynchronous programming in .NET - ITPro...The server side story:  Parallel and Asynchronous programming in .NET - ITPro...
The server side story: Parallel and Asynchronous programming in .NET - ITPro...
Panagiotis Kanavos
 
Understandingiis 120715123909-phpapp01
Understandingiis 120715123909-phpapp01Understandingiis 120715123909-phpapp01
Understandingiis 120715123909-phpapp01
arunparmar
 
Tips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC ApplicationsTips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC Applications
Sarvesh Kushwaha
 
Ad

Recently uploaded (20)

tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Ad

10 tips to make your ASP.NET Apps Faster

  • 1. 10 tips to make your ASP.NET Apps Faster Brij Bhushan Mishra
  • 2. Who Am I • Brij Bhushan Mishra • Working as a Sr Developer • Microsoft MVP - ASP.NET/IIS since 2011 • Active in various online and offline communities • http://codewala.net • @code_wala • https://www.facebook.com/codewala
  • 3. Tip 1: Kernel Caching
  • 4. Overview of IIS HTTP.Sys Kernel level User level Windows Activation Service (WAS) WWW Service Svchost.exe Worker Process (w3wp.exe) Worker Process (w3wp.exe) Application Pool Application Pool
  • 5. HTTP.sys • Lowest layer of IIS and part of networking subsystem • Minimizes the context switch for cached content • Caching support for static and dynamic content • Implements request queues per application pool
  • 6. HTTP.Sys Architecture TCP/IP Response Cache Req. Queue Send Response HTTP Parser Namespace Mapper Listener HTTP Engine Request Response User Level Req. Queue Req. Queue
  • 8. Reasons why it could not be cached • Say if request is authenticated • Only Get request would be cached • Dynamic compression is enabled for response (e.g. gzip) • The request is NOT HTTP 1.1 or 1.0 • Many more…. http://support.microsoft.com/kb/817445 • Doesn’t replace any other User-Mode cache
  • 9. Tip 2: Asynchrony in ASP.NET
  • 10. How requests are handled in ASP.NET Kernel level User Level g IIS Worker Thread ASP.NET processes the request Process and Pass to ASP.NET HTTP.Sys ASP.NET Request processing App Pool queue ASP.NET Queue CLR Thread pool ASP.NET Request Handler Request
  • 11. Options? • Write Asynchronous pages (Web forms and MVC/Web API) • Asynchrnous HTTP Handlers • Asynchrnous HTTP Modules
  • 12. Async in ASP.NET Web forms • Set Async page attribute to use Async pipleline • Use RegisterAsyncTask to call Async code • ASP.NET takes care of thread affinity Async in ASP.NET MVC/Web API • Simple – Just mark the action method Async • Similar for Web APIs • Lot of APIs support Async calls (like EF6+ and many more)
  • 14. Async scenarios • I/O operations ( DB calls, file system, Network calls etc..) • Parallelism • Long running event driven (streaming, polling etc)
  • 15. Tip 3- CLR Thread pool • Used by every managed executable • ASP.NET requests execute on these thread only • Designed to auto tune itself based on system resources • It is configurable to handle specific scenarios • To queue work to CLR thread pool, application can call ThreadPool.QueueUserWorkItemAPI
  • 16. Useful Configurations • MinWorkerThread (rate which CLR creates thread) • MaxCurrentRequestsPerCPU (IIS 7+, 12 prior to .NET 4) • MaxConnection <connectionManagement> <add address="*" maxconnection="2"> <add address="http://65.53.32.230" maxconnection="12"> </connectionManagement>
  • 17. CLR Thread pool Demo http://codewala.net @code_wala https://www.facebook.com/codewala
  • 19. Request Processing Mode- Classic • Duplication between IIS and ASP.NET • ASP.NET feature cannot be applied to non asp.net content like form authentication
  • 20. Request Processing Mode- Integrated • Unified request processing pipeline • Native and managed modules • All modules can be applied to all type requests
  • 21. Tip 5: runAllManagedModulesForAllRequests • If it set true, means all the modules would be running for all the requests. • You may not need this for all the static files like jpeg, js, css etc. • Options • Create a different application altogether for static resources where it is set as false • Put all static contents in a folder in same application and make it false it for same folder <add name="UrlRewriteModule" preCondition="managedHandler" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
  • 22. Tip 6: ASP.NET Pipeline
  • 23. ASP.NET Pipeline • ASP.NET Page Request Processing HTTPModule 1 HTTPModule 2 HTTPModule 3 HTTPModule n HTTP Handler Request Response . . .
  • 25. Tip 7: SQL Data Source?
  • 27. Tip 8: Remove Unused View Engines
  • 28. Remove Unused View Engine • By default, ASP.NET provides two View Engines. • It looks first for ASP.NET view engine • Remove which is not getting used Do you have empty methods in Global.asax?
  • 30. Tip 9: Don’t write logs in inetpub
  • 31. Tip 10: Avoid extra calls to DB?
  • 32. Use SQL profiler to check the hits • Run the SQL profiler when access your page. • You might be unknowingly hitting database several times. It’s very common using any ORM tool like Entity Framework • This is one of the main reasons of slow applications