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

More Related Content

What's hot

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
 

What's hot (20)

ASP.NET MVC 4
ASP.NET MVC 4ASP.NET MVC 4
ASP.NET MVC 4
 
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
 
Real World Rails Deployment
Real World Rails DeploymentReal World Rails Deployment
Real World Rails Deployment
 
Flask introduction
Flask introductionFlask introduction
Flask introduction
 
ASP.NET MVC 4 Overview
ASP.NET MVC 4 OverviewASP.NET MVC 4 Overview
ASP.NET MVC 4 Overview
 
A Gentle Introduction to Blazor
A Gentle Introduction to BlazorA Gentle Introduction to Blazor
A Gentle Introduction to Blazor
 
Codegen2021 blazor mobile
Codegen2021 blazor mobileCodegen2021 blazor mobile
Codegen2021 blazor mobile
 
Azure Serverless Conf
Azure Serverless ConfAzure Serverless Conf
Azure Serverless Conf
 
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
 
Host, deploy & scale Blazor Server Apps
Host, deploy & scale Blazor Server AppsHost, deploy & scale Blazor Server Apps
Host, deploy & scale Blazor Server Apps
 
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)
 
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
 
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
 
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
 
JSFoo-2017 Takeaways
JSFoo-2017 TakeawaysJSFoo-2017 Takeaways
JSFoo-2017 Takeaways
 
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
 
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
 
ReactPHP + Symfony
ReactPHP + SymfonyReactPHP + Symfony
ReactPHP + Symfony
 
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
 
Secure your environment by automation
Secure your environment by automationSecure your environment by automation
Secure your environment by automation
 

Similar to 10 tips to make your ASP.NET Apps Faster

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
aminmesbahi
 
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
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
 

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
 
IIS 6.0 and asp.net
IIS 6.0 and asp.netIIS 6.0 and asp.net
IIS 6.0 and asp.net
 
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
 
PHP on Windows 2008
PHP on Windows 2008PHP on Windows 2008
PHP on Windows 2008
 
Advanced Asp.Net Concepts And Constructs
Advanced Asp.Net Concepts And ConstructsAdvanced Asp.Net Concepts And Constructs
Advanced Asp.Net Concepts And Constructs
 
Azure App Services
Azure App ServicesAzure App Services
Azure App Services
 
App fabric introduction
App fabric introductionApp fabric introduction
App fabric introduction
 
.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
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Philly Tech Fest Iis
Philly Tech Fest IisPhilly Tech Fest Iis
Philly Tech Fest Iis
 
Understanding iis part1
Understanding iis part1Understanding iis part1
Understanding iis part1
 
Asp.net performance
Asp.net performanceAsp.net performance
Asp.net performance
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOM
 
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?
 
Lect02_Asp.NET.pptx
Lect02_Asp.NET.pptxLect02_Asp.NET.pptx
Lect02_Asp.NET.pptx
 
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...
 
Understandingiis 120715123909-phpapp01
Understandingiis 120715123909-phpapp01Understandingiis 120715123909-phpapp01
Understandingiis 120715123909-phpapp01
 
[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
 
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
 

Recently uploaded

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 

Recently uploaded (20)

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 

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