SlideShare a Scribd company logo
1 of 14
.net core
performance
How can we increase the performance.
 Apply best practices.
 Memory and GC
 Response caching
 Response Compression
 Diagnostic tools
 Load/stress testing.
Best practices
1. Understand hot code paths.
2. Avoid blocking calls.
3. Minimize large object allocations.
4. Optimize data access and I/O.
5. Pool HTTP connections with HttpClientFactory.
6. Complete long-running Tasks outside of HTTP
requests.
7. Minify client assets.
8. Compress responses
9. Use the latest ASP.NET Core release.
10. Minimize exceptions.
11. Working with a synchronous data processing API
01) Understand hot code paths.
 Codes what frequency used.
 Add loggers to those codes and optimize specially it.
 Make clean middleware such as (logging,authorization ect)
 Beware when use customer middleware.
 Use performance profiling tools such as VS diagnostic tool
02) Avoid blocking calls.
ASP.NET Core apps should be designed to
process many requests simultaneously.
Asynchronous APIs allow a small pool of
threads to handle thousands of concurrent
requests by not waiting on blocking calls
02) Avoid blocking calls.
Dont Do
Don’t user Task.Wait,Task or Task.Result This will
be block tread synchronously
Make hot code paths asynchronous
Do not use Task.Run to make a synchronus API
asynchronous.
Make controller/Razor Page actions asynchronous
03) Minimize large object allocations.
4.Optimize data access and I/O.
(Database,File)
1. Do Async
2. Select only necessary data
3. Cache
4. Use Single call not several calls (select * from x ; select * from y)
5. User EF best practices.
5.Pool HTTP connections with
HttpClientFactory.
 Every http call open socket.
 When use httpClient socket are not reusable.and soket not immediately close even
http request over.and it has some cost when initialize a socket.
 Machine has limited number of socket can open. Therefor this will be make
performance issue.
 Therefor use HttpClientFactory.It will reuse previous socket asynchronously.
6. Complete long-running Tasks
outside of HTTP requests.
 User background process,SignalR.
7.Minify client assets.
 Minify or use cdn for js,css,html
8.Compress responses
 GZIP
 br (Brotli)
9.Use the latest ASP.NET Core
release.
10.Minimize exceptions.

More Related Content

What's hot

How to automated test a web application with sending e mail feature
How to automated test a web application with sending e mail featureHow to automated test a web application with sending e mail feature
How to automated test a web application with sending e mail feature
Jun-ichi Sakamoto
 
Simple todo app with meteor
Simple todo app with meteorSimple todo app with meteor
Simple todo app with meteor
Alex Long
 
CTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & AwaitCTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & Await
Spiffy
 
How to prevent the cache problem in AJAX
How to prevent the cache problem in AJAXHow to prevent the cache problem in AJAX
How to prevent the cache problem in AJAX
Ramzi Alqrainy
 

What's hot (19)

2310 b 06
2310 b 062310 b 06
2310 b 06
 
Inner core of Ajax
Inner core of Ajax Inner core of Ajax
Inner core of Ajax
 
A pitfall when writing an asynchronous web application with Spring and Tomcat
A pitfall when writing an asynchronous web application with Spring and TomcatA pitfall when writing an asynchronous web application with Spring and Tomcat
A pitfall when writing an asynchronous web application with Spring and Tomcat
 
2310 b 11
2310 b 112310 b 11
2310 b 11
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
Late and Early binding in c++
Late and Early binding in c++Late and Early binding in c++
Late and Early binding in c++
 
How to automated test a web application with sending e mail feature
How to automated test a web application with sending e mail featureHow to automated test a web application with sending e mail feature
How to automated test a web application with sending e mail feature
 
Simple todo app with meteor
Simple todo app with meteorSimple todo app with meteor
Simple todo app with meteor
 
CTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & AwaitCTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & Await
 
How to prevent the cache problem in AJAX
How to prevent the cache problem in AJAXHow to prevent the cache problem in AJAX
How to prevent the cache problem in AJAX
 
Project Reactor By Example
Project Reactor By ExampleProject Reactor By Example
Project Reactor By Example
 
AJAX
AJAXAJAX
AJAX
 
Async Programming in C# 5
Async Programming in C# 5Async Programming in C# 5
Async Programming in C# 5
 
Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 
Unit testing hippo
Unit testing hippoUnit testing hippo
Unit testing hippo
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
Building Websocket Applications with GlassFish and Grizzly
Building Websocket Applications with GlassFish and GrizzlyBuilding Websocket Applications with GlassFish and Grizzly
Building Websocket Applications with GlassFish and Grizzly
 

Similar to Net core performance

Scalable Apache for Beginners
Scalable Apache for BeginnersScalable Apache for Beginners
Scalable Apache for Beginners
webhostingguy
 
WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.ppt
webhostingguy
 

Similar to Net core performance (20)

High Performance Coding2.pptx
High Performance Coding2.pptxHigh Performance Coding2.pptx
High Performance Coding2.pptx
 
PAC 2019 virtual Arjan Van Den Berg
PAC 2019 virtual Arjan Van Den Berg  PAC 2019 virtual Arjan Van Den Berg
PAC 2019 virtual Arjan Van Den Berg
 
Scalable Apache for Beginners
Scalable Apache for BeginnersScalable Apache for Beginners
Scalable Apache for Beginners
 
Making it fast: Zotonic & Performance
Making it fast: Zotonic & PerformanceMaking it fast: Zotonic & Performance
Making it fast: Zotonic & Performance
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisation
 
Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5
 
NodeJS.ppt
NodeJS.pptNodeJS.ppt
NodeJS.ppt
 
NodeJS.ppt
NodeJS.pptNodeJS.ppt
NodeJS.ppt
 
NodeJS.ppt
NodeJS.pptNodeJS.ppt
NodeJS.ppt
 
NodeJS introduction and examples of event loops
NodeJS introduction and examples of event loopsNodeJS introduction and examples of event loops
NodeJS introduction and examples of event loops
 
Why meteor
Why meteorWhy meteor
Why meteor
 
5-WebServers.ppt
5-WebServers.ppt5-WebServers.ppt
5-WebServers.ppt
 
WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.ppt
 
BP101 - 10 Things to Consider when Developing & Deploying Applications in Lar...
BP101 - 10 Things to Consider when Developing & Deploying Applications in Lar...BP101 - 10 Things to Consider when Developing & Deploying Applications in Lar...
BP101 - 10 Things to Consider when Developing & Deploying Applications in Lar...
 
Play framework
Play frameworkPlay framework
Play framework
 
ScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency InjectionScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency Injection
 
It and ej
It and ejIt and ej
It and ej
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of users
 
improve website performance
improve website performanceimprove website performance
improve website performance
 
Monkey Server
Monkey ServerMonkey Server
Monkey Server
 

Recently uploaded

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration Tooling
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 

Net core performance

  • 2. How can we increase the performance.  Apply best practices.  Memory and GC  Response caching  Response Compression  Diagnostic tools  Load/stress testing.
  • 3. Best practices 1. Understand hot code paths. 2. Avoid blocking calls. 3. Minimize large object allocations. 4. Optimize data access and I/O. 5. Pool HTTP connections with HttpClientFactory. 6. Complete long-running Tasks outside of HTTP requests. 7. Minify client assets. 8. Compress responses 9. Use the latest ASP.NET Core release. 10. Minimize exceptions. 11. Working with a synchronous data processing API
  • 4. 01) Understand hot code paths.  Codes what frequency used.  Add loggers to those codes and optimize specially it.  Make clean middleware such as (logging,authorization ect)  Beware when use customer middleware.  Use performance profiling tools such as VS diagnostic tool
  • 5. 02) Avoid blocking calls. ASP.NET Core apps should be designed to process many requests simultaneously. Asynchronous APIs allow a small pool of threads to handle thousands of concurrent requests by not waiting on blocking calls
  • 6. 02) Avoid blocking calls. Dont Do Don’t user Task.Wait,Task or Task.Result This will be block tread synchronously Make hot code paths asynchronous Do not use Task.Run to make a synchronus API asynchronous. Make controller/Razor Page actions asynchronous
  • 7. 03) Minimize large object allocations.
  • 8. 4.Optimize data access and I/O. (Database,File) 1. Do Async 2. Select only necessary data 3. Cache 4. Use Single call not several calls (select * from x ; select * from y) 5. User EF best practices.
  • 9. 5.Pool HTTP connections with HttpClientFactory.  Every http call open socket.  When use httpClient socket are not reusable.and soket not immediately close even http request over.and it has some cost when initialize a socket.  Machine has limited number of socket can open. Therefor this will be make performance issue.  Therefor use HttpClientFactory.It will reuse previous socket asynchronously.
  • 10. 6. Complete long-running Tasks outside of HTTP requests.  User background process,SignalR.
  • 11. 7.Minify client assets.  Minify or use cdn for js,css,html
  • 13. 9.Use the latest ASP.NET Core release.