SlideShare a Scribd company logo
Tips and Tricks For Faster ASP.NET and
MVC Web Applications
By Sarvesh Kushwaha
1. Static Resources should be Cacheable ;)
Above code cache all static resources for 365 days.
2. Bundling and Minification
Reduce the amount of data (CSS & JavaScript) sent across the
network using Bundling and Minification in ASP.NET 4.5 .
Bundling is merging all CSS files into one and same for JavaScripts file
.This Reduce the number of requests to server.
Minification is removing blank space b/w words and lines and
more then that ;) .
LINK : HOW TO DO IT
3.Use View State when its necessary
Every control has ViewState in Asp.Net and ViewState is turned on in
ASP.NET by default.
ViewState is an unnecessary overhead for pages that do not need it. As
the ViewState grows larger, it affects the performance of garbage
collection. ViewState gets store in hidden field too many field can make
a web page heavier and will cause rendering problem.
So Disable ViewState for every control, untill you need it (have to keep
data on post backs of a page).
1. You know you don't need ViewState for a textbox control and similar control untill
you are performing textchange_event. So disable it by using EnableViewState=
“false” for each one.
2. Disable ViewState at page level add in page : <%@ Page EnableViewState="false"
%> .
3. Disable ViewState at Application level add in web.config : <pages
enableViewState="false" />.

Recommended for you

The Glory of Rest
The Glory of RestThe Glory of Rest
The Glory of Rest

The document discusses REST (Representational State Transfer) architectural styles and best practices for designing web services. It covers topics like RESTful principles of using URIs and HTTP methods to manipulate resources, statelessness, hypermedia as the engine of application state, and JSON and XML media types for representing resources. It also discusses REST maturity levels, security, versioning, and error handling in RESTful web services.

restroarpc
Aerospike Architecture
Aerospike ArchitectureAerospike Architecture
Aerospike Architecture

The document provides an overview of the Aerospike architecture, including the client, cluster, storage, primary and secondary indexes, RAM, flash storage, and cross datacenter replication (XDR). The Aerospike architecture aims to handle extremely high read/write rates over persistent data at low latency while ensuring consistency and scalability across datacenters with no downtime.

nosqlaerospike
4. Use Effecting Paging
• Bring small set of data at once ,show them using paging to render the page quickly.
• Large set of data use stored procedure for page index data and filtering .
LINK: HOW TO DO IT
5. URL Compression
Now with IIS 7 we can do HTTP compression of data being send over the
network . Add following Xml snippets in the web.config file under
<system.webserver> node :
<urlCompression doDynamicCompression="true" doStaticCompression="true"
dynamicCompressionBeforeCache="true"/>
• doDynamicCompression tells IIS whether it should compress dynamically
generated content, i.e. content generated by your scripts (ASP, ASP.NET, PHP
…).
• doStaticCompression tells IIS whether to compress static files (PDF, JPEG …)
,those actually exist on the file system.
• dynamicCompressionBeforeCache attribute specifies whether IIS will
dynamically compress content that has not been cached.
6. Use Sprite Images
use sprite images instead of using several images so at one download you can
use several small images .
Now we can make sprite images very easily using Some NUGET packages.
Below are some :
7. Image Optimization
• Normally images take largest percentage (size) in a web page. image
optimization help us to increase performance . Using Asp.net Nuget we can
optimize images :
• Allocate space for image using <height/> and <width/> , it will let page
rendering more quickly .

Recommended for you

A base da pirâmide
A base da pirâmideA base da pirâmide
A base da pirâmide

O documento discute o mercado na base da pirâmide econômica, composto por cerca de 4 bilhões de pessoas com renda diária inferior a US$ 2. Apresenta a lógica dominante entre executivos de que esse mercado não é lucrativo, e argumenta que é possível inovar para atender as necessidades desse público de forma sustentável e lucrativa para as empresas. Também fornece exemplos de soluções desenvolvidas por empresas para atuar nesse mercado no Brasil e na Índia.

Caching solutions with Redis
Caching solutions   with RedisCaching solutions   with Redis
Caching solutions with Redis

Redis is an open source, in-memory data structure store that can be used as a database, cache, or message broker. It supports basic data types like strings, hashes, lists, and sets. Redis features high performance, replication, publishing/subscribing, and Lua scripting. It is widely adopted by companies like GitHub, StackOverflow, and Blizzard for use cases like caching, sessions, queues, and as a real-time database.

cachingprogrammingredis
Deep Dive on Amazon Redshift
Deep Dive on Amazon RedshiftDeep Dive on Amazon Redshift
Deep Dive on Amazon Redshift

Tony Gibbs gave a presentation on Amazon Redshift covering its history, architecture, concepts, and parallelism. The presentation included details on Redshift's cluster architecture, node components, storage design, data distribution styles, and terminology. It also provided a deep dive on parallelism in Redshift, explaining how queries are compiled and executed through streams, segments, and steps to enable massively parallel processing across nodes.

amazon web servicesdatabase aws loft architecture weekcloud computing
8. Always Deploy in Release Mode
• At the time of deploying our main concern is performance , Debug Mode
creates .pdb file and take some info generated by JIT to code address mapping
.
• Code is more optimized in Release Mode.
• Less memory is used by the source code at run time in Release Mode.
• Set debug=“false” in web.config for release mode.
9. Use client Side Validation
At max one should use client side validation for application as it gives user a friendly experience
and reduce the over head of post back to the server.Where secuirty is priority use server side
validation .
10. Remove Unnecessary HTTP Headers
The X-AspNet-Version, X-AspNetMvc-Version, X-Powered-By, and Server HTTP headers
provide no direct benefit and unnecessarily used a small amount of bandwidth.
• Removing X-AspNet-Version : Under <System.web> add this <httpRuntime
enableVersionHeader="false"/>
• Removing X-AspNetMvc-Version : Add this in Global.asax.cx file
MvcHandler.DisableMvcResponseHeader = true;
• Remove Server HTTP Header : LINK HOW TO DO IT
• Remove or Edit X-Powered-By : IIS7 Manager > HTTP Response Header > Edit or Remove
11. Pipeline Optimization
• There are many default HttpModule which sit in request pipeline and intercept each and every request.
• Example If you are not using window authentication you don’t need window authentication HttpModule.
Add following code in web.config :
<httpModules>

<remove name="Session" />
<remove name="WindowsAuthentication" />
<remove name="PassportAuthentication" />
<remove name="AnonymousIdentification" />
<remove name="UrlAuthorization" />
<remove name="FileAuthorization" />
</httpModules>

Recommended for you

Cost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWSCost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWS

High performance Redis is popular among developers for its incredible performance, versatility and simplicity. The powerful combination of low cost memory and high performance Redis brings to life new next generation analytic uses - such as simultaneous real time transaction and analytics processing. With Redis Labs' RLEC Flash on AWS SSD instances, you can get fantastic performance at up to 70% lower costs. Join this session to learn how next generation Flash from leading memory provider Intel has made significant strides in performance while retaining its cost advantage to memory. Using a combination of AWS' powerful SSD instances, and Redis Labs' RLEC Flash, you can achieve up to 3M ops/sec at sub millisecond latencies, with a combination of RAM and Flash. The session will also feature customer use cases from a large university, a large customer engagement company and a pioneer of online Flash sales. Session sponsored by Redis Labs.

ctoaws summitintel
Logística Empresarial - Módulo I
Logística Empresarial - Módulo ILogística Empresarial - Módulo I
Logística Empresarial - Módulo I

Este documento fornece uma introdução ao módulo sobre história e abordagem inicial de logística empresarial. Apresenta conceitos básicos de logística e sua evolução histórica, desde os exércitos antigos até os modelos atuais. Também discute desafios da logística moderna, como a necessidade de visibilidade do fluxo logístico e de gerenciamento sistêmico.

logística empresarial curso virtual online icurso
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

This document discusses various techniques for optimizing ASP.NET applications to scale from thousands to millions of users. It covers topics such as preventing denial of service attacks, optimizing the ASP.NET process model and pipeline, reducing the size of ASP.NET cookies on static content, improving System.net settings, optimizing queries to ASP.NET membership providers, issues with LINQ to SQL, using transaction isolation levels to prevent deadlocks, and employing a content delivery network. The overall message is that ASP.NET requires various "hacks" at the code, database, and configuration levels to scale to support millions of hits.

asp.net.netperformance
12. Use Content Delivery Network
• Better if you download things from nearest server from your palace .its like
travelling things from one country to another which takes times. If application
has large number of images, CSS, JavaScript sending request for each of them
and downloading them across the world will take significant time.
• Content Delivery Network deal with static cacheable Content .
• Bootsrap Used CDN for his latest release ;)
13. Dispose Objects Manually
• Although Objects will be cleaned up when they are no longer being
used and when the garbage collector sees fit. Always dispose an
object which implements IDisposable ,to do so Use a USING
statement to automatically dispose of an object once your program
leaves the scope of the using statement.
using (SqlConnection cn = new SqlConnection(connectionString))
{
using (SqlCommand cm = new SqlCommand(commandString, cn))
{
cm.ExecuteNonQuery();
}
}
14. Effective use of Jquery AJAX in Asp.ne
• Use ajax to download data asynchronously, which are not needed
immediately like content of Accordion (Collapsed Panel) and tabs.
• Don’t make too much ajax requests
• Use ajax when its needed to load more data when user scrolls,
when user is not scrolling there is no benefit to bring all the data at
once.
15. Do use magic of Asynchronous
Methods
If your page needs to access multiple data sources , then use
asynchronous methods to parallelize access to those sources .
LINK : HOW TO DO IT

Recommended for you

10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites

1) ASP.NET requires optimizations at the code, database, and configuration levels to scale to millions of hits out of the box. Common optimizations include tweaking process model settings, removing unnecessary pipeline components, and using compiled Linq queries. 2) Issues like application-level DOS attacks, slow profile provider stored procedures, and Linq to SQL performance problems can be addressed to improve scalability. Using a CDN can also help offload static content delivery. 3) Database queries must consider index usage and transaction isolation levels to prevent timeouts and deadlocks under high load.

asp.netperformanceweb 2.0
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance

1. The document discusses various optimizations that can be made to an ASP.NET MVC application to improve performance, including compiled LINQ queries, URL caching, and data caching. 2. Benchmark results show that optimizing partial view rendering, LINQ queries, and URL generation improved performance from 8 requests/second to 61.5 requests/second. Additional caching of URLs, statistics, and content improved performance to over 400 requests/second. 3. Turning off ASP.NET debug mode also provided a significant performance boost, showing the importance of running production sites in release mode.

optimizationlinqsqlperformance
Four Ways to Improve ASP .NET Performance and Scalability
 Four Ways to Improve ASP .NET Performance and Scalability Four Ways to Improve ASP .NET Performance and Scalability
Four Ways to Improve ASP .NET Performance and Scalability

Learn how to improve ASP.net performance and scalability with object caching, session state caching, view state caching and output caching.

object cachingdistributed cachingsession state caching
16. Turn off Tracing unless until its required because its keep track
of the application's trace and the sequences. Under <system.web>
node write following code:
<trace enabled="false" pageOutput="false" />
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true"/>
17. Instead of Respons.Redirect() use Server.Transfer() when we
want to transfer current page request to another .aspx page on the
same server. it helps to reduce server requests. And optionally give
us value of preserve query string and form controls values .
18. String Management :
• Use += operator or String.Concat() when the number of appends is know and short .
• Use StringBuilder object when number of appends is unknown.
19. Asp .NET literal and label are different
• Literal just show that text they don’t add the extra markup.
• Label add the extra markup <label><label/>.
20. Remove Blank Space and lines from HTML
• Using Regular Expressions in VS2012 remove blank lines from .aspx and HTML
^(?([^rn])s)*r?$r?n
• Use CodeMaid tool to remove spaces and more.
21. Use Performance Tools
Correct code makes good performance
• Backend performance Tools : DotNetMemoryProfiler,
SQLServerProfiler
• Performance Tools :
• Static analysis tool : Yslow
• Run Time Profiler : Speed tracer for chrome, Firebug for firefox, IE
Developer tools
• Others : WebPageTest , Page-analyzer , Pingdom
• Monitoring Tool : Fiddler
Developer Checklist
Caching
Client Side Validation
Use ViewState if needed
Dispose Objects ManuallyCDN
Remove Unneccesary HTTP Headers
Effective Paging URL Compression
Pipeline Optimization
Release Mode
Images Optimization & Sprite Images
Bundling and Minification
Jquery Ajax Async and Await Turn Tracing Off

Recommended for you

Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications

1. The document discusses strategies for scaling web applications, including scaling the client, web/application, and database tiers. 2. It covers techniques like load balancing, domain sharding, caching, and database partitioning to distribute load across servers. 3. Scaling the database tier involves strategies such as replication, indexing, and moving to NoSQL databases which sacrifice some consistency for improved scalability.

netscalability
Web api scalability and performance
Web api scalability and performanceWeb api scalability and performance
Web api scalability and performance

The document discusses techniques for optimizing server performance, including reducing server load through HTTP caching, efficient content types, batching requests, and pushing content streams. It also discusses measuring performance metrics like response time and throughput, and tools for performance profiling like ASP.NET counters and load testing software. Specific techniques presented include using ETags, setting cache control headers, throttling requests, and choosing efficient data serialization formats and protocols.

dddmelbourne 2013
Updated Mvc Web security updated presentation
Updated Mvc Web security updated presentationUpdated Mvc Web security updated presentation
Updated Mvc Web security updated presentation

OWASP Top 10 threats to web applications and how to conunter the threats using Mvc.net mitigations, first shown at #DDDNorth, contains bonus slides for DDOS and social engineering

securityc#mvc
Sarvesh Kushwaha | | | | | |

More Related Content

What's hot

Gestão dos canais de distribuição (9)
Gestão dos canais de distribuição (9)Gestão dos canais de distribuição (9)
Gestão dos canais de distribuição (9)
Adeildo Caboclo
 
Access Control in AWS Glue Data Catalog (ANT376) - AWS re:Invent 2018
Access Control in AWS Glue Data Catalog (ANT376) - AWS re:Invent 2018Access Control in AWS Glue Data Catalog (ANT376) - AWS re:Invent 2018
Access Control in AWS Glue Data Catalog (ANT376) - AWS re:Invent 2018
Amazon Web Services
 
Apresentação kanban
Apresentação kanbanApresentação kanban
Apresentação kanban
Joao Furtado
 
The Glory of Rest
The Glory of RestThe Glory of Rest
The Glory of Rest
Sławomir Chrobak
 
Aerospike Architecture
Aerospike ArchitectureAerospike Architecture
Aerospike Architecture
Peter Milne
 
A base da pirâmide
A base da pirâmideA base da pirâmide
A base da pirâmide
guest12d885
 
Caching solutions with Redis
Caching solutions   with RedisCaching solutions   with Redis
Caching solutions with Redis
George Platon
 
Deep Dive on Amazon Redshift
Deep Dive on Amazon RedshiftDeep Dive on Amazon Redshift
Deep Dive on Amazon Redshift
Amazon Web Services
 
Cost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWSCost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWS
Amazon Web Services
 
Logística Empresarial - Módulo I
Logística Empresarial - Módulo ILogística Empresarial - Módulo I
Logística Empresarial - Módulo I
Rafael Marser
 

What's hot (11)

Gestão dos canais de distribuição (9)
Gestão dos canais de distribuição (9)Gestão dos canais de distribuição (9)
Gestão dos canais de distribuição (9)
 
Access Control in AWS Glue Data Catalog (ANT376) - AWS re:Invent 2018
Access Control in AWS Glue Data Catalog (ANT376) - AWS re:Invent 2018Access Control in AWS Glue Data Catalog (ANT376) - AWS re:Invent 2018
Access Control in AWS Glue Data Catalog (ANT376) - AWS re:Invent 2018
 
Apresentação kanban
Apresentação kanbanApresentação kanban
Apresentação kanban
 
The Glory of Rest
The Glory of RestThe Glory of Rest
The Glory of Rest
 
Aerospike Architecture
Aerospike ArchitectureAerospike Architecture
Aerospike Architecture
 
wms Κιλικίδης
wms Κιλικίδηςwms Κιλικίδης
wms Κιλικίδης
 
A base da pirâmide
A base da pirâmideA base da pirâmide
A base da pirâmide
 
Caching solutions with Redis
Caching solutions   with RedisCaching solutions   with Redis
Caching solutions with Redis
 
Deep Dive on Amazon Redshift
Deep Dive on Amazon RedshiftDeep Dive on Amazon Redshift
Deep Dive on Amazon Redshift
 
Cost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWSCost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWS
 
Logística Empresarial - Módulo I
Logística Empresarial - Módulo ILogística Empresarial - Módulo I
Logística Empresarial - Módulo I
 

Viewers also liked

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
oazabir
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
oazabir
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
rudib
 
Four Ways to Improve ASP .NET Performance and Scalability
 Four Ways to Improve ASP .NET Performance and Scalability Four Ways to Improve ASP .NET Performance and Scalability
Four Ways to Improve ASP .NET Performance and Scalability
Alachisoft
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications
Buu Nguyen
 
Web api scalability and performance
Web api scalability and performanceWeb api scalability and performance
Web api scalability and performance
Himanshu Desai
 
Updated Mvc Web security updated presentation
Updated Mvc Web security updated presentationUpdated Mvc Web security updated presentation
Updated Mvc Web security updated presentation
John Staveley
 
Architecting ASP.NET MVC Applications
Architecting ASP.NET MVC ApplicationsArchitecting ASP.NET MVC Applications
Architecting ASP.NET MVC Applications
Gunnar Peipman
 
JavaScript For CSharp Developer
JavaScript For CSharp DeveloperJavaScript For CSharp Developer
JavaScript For CSharp Developer
Sarvesh Kushwaha
 
Scaling your servers with async and await
Scaling your servers with async and awaitScaling your servers with async and await
Scaling your servers with async and await
Stephen Cleary
 
Accelerate your web app with a layer of Varnish
Accelerate your web app with a layer of VarnishAccelerate your web app with a layer of Varnish
Accelerate your web app with a layer of Varnish
Jeremy Cook
 
Performance testing wreaking balls
Performance testing wreaking ballsPerformance testing wreaking balls
Performance testing wreaking balls
Leonid Grinshpan, Ph.D.
 
jChaart - Web Dashboard Framework
jChaart - Web Dashboard FrameworkjChaart - Web Dashboard Framework
jChaart - Web Dashboard Framework
oazabir
 
OpenROV: Node.js takes a dive into the ocean
OpenROV: Node.js takes a dive into the oceanOpenROV: Node.js takes a dive into the ocean
OpenROV: Node.js takes a dive into the ocean
Simone Chiaretta
 
End to End Security with MVC and Web API
End to End Security with MVC and Web APIEnd to End Security with MVC and Web API
End to End Security with MVC and Web API
Michele Leroux Bustamante
 
Design Practices for a Secure Azure Solution
Design Practices for a Secure Azure SolutionDesign Practices for a Secure Azure Solution
Design Practices for a Secure Azure Solution
Michele Leroux Bustamante
 
Frontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and WorkflowsFrontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and Workflows
Treasure Data, Inc.
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
Elad Hirsch
 
Business Case for SharePoint and Office 365
Business Case for SharePoint and Office 365Business Case for SharePoint and Office 365
Business Case for SharePoint and Office 365
Gregory Zelfond
 
SharePoint Folders vs. Metadata
SharePoint Folders vs. MetadataSharePoint Folders vs. Metadata
SharePoint Folders vs. Metadata
Gregory Zelfond
 

Viewers also liked (20)

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
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
 
Four Ways to Improve ASP .NET Performance and Scalability
 Four Ways to Improve ASP .NET Performance and Scalability Four Ways to Improve ASP .NET Performance and Scalability
Four Ways to Improve ASP .NET Performance and Scalability
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications
 
Web api scalability and performance
Web api scalability and performanceWeb api scalability and performance
Web api scalability and performance
 
Updated Mvc Web security updated presentation
Updated Mvc Web security updated presentationUpdated Mvc Web security updated presentation
Updated Mvc Web security updated presentation
 
Architecting ASP.NET MVC Applications
Architecting ASP.NET MVC ApplicationsArchitecting ASP.NET MVC Applications
Architecting ASP.NET MVC Applications
 
JavaScript For CSharp Developer
JavaScript For CSharp DeveloperJavaScript For CSharp Developer
JavaScript For CSharp Developer
 
Scaling your servers with async and await
Scaling your servers with async and awaitScaling your servers with async and await
Scaling your servers with async and await
 
Accelerate your web app with a layer of Varnish
Accelerate your web app with a layer of VarnishAccelerate your web app with a layer of Varnish
Accelerate your web app with a layer of Varnish
 
Performance testing wreaking balls
Performance testing wreaking ballsPerformance testing wreaking balls
Performance testing wreaking balls
 
jChaart - Web Dashboard Framework
jChaart - Web Dashboard FrameworkjChaart - Web Dashboard Framework
jChaart - Web Dashboard Framework
 
OpenROV: Node.js takes a dive into the ocean
OpenROV: Node.js takes a dive into the oceanOpenROV: Node.js takes a dive into the ocean
OpenROV: Node.js takes a dive into the ocean
 
End to End Security with MVC and Web API
End to End Security with MVC and Web APIEnd to End Security with MVC and Web API
End to End Security with MVC and Web API
 
Design Practices for a Secure Azure Solution
Design Practices for a Secure Azure SolutionDesign Practices for a Secure Azure Solution
Design Practices for a Secure Azure Solution
 
Frontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and WorkflowsFrontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and Workflows
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
Business Case for SharePoint and Office 365
Business Case for SharePoint and Office 365Business Case for SharePoint and Office 365
Business Case for SharePoint and Office 365
 
SharePoint Folders vs. Metadata
SharePoint Folders vs. MetadataSharePoint Folders vs. Metadata
SharePoint Folders vs. Metadata
 

Similar to Tips and Tricks For Faster Asp.NET and MVC Applications

Asp.net performance
Asp.net performanceAsp.net performance
Asp.net performance
Abhishek Sur
 
High performance coding practices code project
High performance coding practices code projectHigh performance coding practices code project
High performance coding practices code project
Pruthvi B Patil
 
Presentation Tier optimizations
Presentation Tier optimizationsPresentation Tier optimizations
Presentation Tier optimizations
Anup Hariharan Nair
 
Drupal performance and scalability
Drupal performance and scalabilityDrupal performance and scalability
Drupal performance and scalability
Twinbit
 
Magento Performance Optimization 101
Magento Performance Optimization 101Magento Performance Optimization 101
Magento Performance Optimization 101
Angus Li
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
Timothy Fisher
 
Performace optimization (increase website speed)
Performace optimization (increase website speed)Performace optimization (increase website speed)
Performace optimization (increase website speed)
clickramanm
 
Frontend performance
Frontend performanceFrontend performance
Frontend performance
sacred 8
 
How to scale up, out or down in Windows Azure - Webinar
How to scale up, out or down in Windows Azure - WebinarHow to scale up, out or down in Windows Azure - Webinar
How to scale up, out or down in Windows Azure - Webinar
Common Sense
 
IBM Connect 2016 - Break out of the Box
IBM Connect 2016 - Break out of the BoxIBM Connect 2016 - Break out of the Box
IBM Connect 2016 - Break out of the Box
Karl-Henry Martinsson
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
Akhil Mittal
 
Ch05 state management
Ch05 state managementCh05 state management
Ch05 state management
Madhuri Kavade
 
ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA Templates
Eamonn Boyle
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
Timothy Fisher
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
Nilesh Bafna
 
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
 
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19
Vivek chan
 
23 Ways To Speed Up WordPress
23 Ways To Speed Up WordPress23 Ways To Speed Up WordPress
23 Ways To Speed Up WordPress
Zero Point Development
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
Ben Hall
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
Rasel Khan
 

Similar to Tips and Tricks For Faster Asp.NET and MVC Applications (20)

Asp.net performance
Asp.net performanceAsp.net performance
Asp.net performance
 
High performance coding practices code project
High performance coding practices code projectHigh performance coding practices code project
High performance coding practices code project
 
Presentation Tier optimizations
Presentation Tier optimizationsPresentation Tier optimizations
Presentation Tier optimizations
 
Drupal performance and scalability
Drupal performance and scalabilityDrupal performance and scalability
Drupal performance and scalability
 
Magento Performance Optimization 101
Magento Performance Optimization 101Magento Performance Optimization 101
Magento Performance Optimization 101
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
 
Performace optimization (increase website speed)
Performace optimization (increase website speed)Performace optimization (increase website speed)
Performace optimization (increase website speed)
 
Frontend performance
Frontend performanceFrontend performance
Frontend performance
 
How to scale up, out or down in Windows Azure - Webinar
How to scale up, out or down in Windows Azure - WebinarHow to scale up, out or down in Windows Azure - Webinar
How to scale up, out or down in Windows Azure - Webinar
 
IBM Connect 2016 - Break out of the Box
IBM Connect 2016 - Break out of the BoxIBM Connect 2016 - Break out of the Box
IBM Connect 2016 - Break out of the Box
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
 
Ch05 state management
Ch05 state managementCh05 state management
Ch05 state management
 
ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA Templates
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
 
IIS 6.0 and asp.net
IIS 6.0 and asp.netIIS 6.0 and asp.net
IIS 6.0 and asp.net
 
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19
 
23 Ways To Speed Up WordPress
23 Ways To Speed Up WordPress23 Ways To Speed Up WordPress
23 Ways To Speed Up WordPress
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 

Recently uploaded

Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
RaminGhanbari2
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
Enterprise Wired
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
Matthew Sinclair
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
ScyllaDB
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
Yevgen Sysoyev
 
Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
Andrey Yasko
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
UiPathCommunity
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
Stephanie Beckett
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Erasmo Purificato
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
Adam Dunkels
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
Stephanie Beckett
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
rajancomputerfbd
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Bert Blevins
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 

Recently uploaded (20)

Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
 
Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 

Tips and Tricks For Faster Asp.NET and MVC Applications

  • 1. Tips and Tricks For Faster ASP.NET and MVC Web Applications By Sarvesh Kushwaha
  • 2. 1. Static Resources should be Cacheable ;) Above code cache all static resources for 365 days.
  • 3. 2. Bundling and Minification Reduce the amount of data (CSS & JavaScript) sent across the network using Bundling and Minification in ASP.NET 4.5 . Bundling is merging all CSS files into one and same for JavaScripts file .This Reduce the number of requests to server. Minification is removing blank space b/w words and lines and more then that ;) . LINK : HOW TO DO IT
  • 4. 3.Use View State when its necessary Every control has ViewState in Asp.Net and ViewState is turned on in ASP.NET by default. ViewState is an unnecessary overhead for pages that do not need it. As the ViewState grows larger, it affects the performance of garbage collection. ViewState gets store in hidden field too many field can make a web page heavier and will cause rendering problem. So Disable ViewState for every control, untill you need it (have to keep data on post backs of a page). 1. You know you don't need ViewState for a textbox control and similar control untill you are performing textchange_event. So disable it by using EnableViewState= “false” for each one. 2. Disable ViewState at page level add in page : <%@ Page EnableViewState="false" %> . 3. Disable ViewState at Application level add in web.config : <pages enableViewState="false" />.
  • 5. 4. Use Effecting Paging • Bring small set of data at once ,show them using paging to render the page quickly. • Large set of data use stored procedure for page index data and filtering . LINK: HOW TO DO IT
  • 6. 5. URL Compression Now with IIS 7 we can do HTTP compression of data being send over the network . Add following Xml snippets in the web.config file under <system.webserver> node : <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/> • doDynamicCompression tells IIS whether it should compress dynamically generated content, i.e. content generated by your scripts (ASP, ASP.NET, PHP …). • doStaticCompression tells IIS whether to compress static files (PDF, JPEG …) ,those actually exist on the file system. • dynamicCompressionBeforeCache attribute specifies whether IIS will dynamically compress content that has not been cached.
  • 7. 6. Use Sprite Images use sprite images instead of using several images so at one download you can use several small images . Now we can make sprite images very easily using Some NUGET packages. Below are some :
  • 8. 7. Image Optimization • Normally images take largest percentage (size) in a web page. image optimization help us to increase performance . Using Asp.net Nuget we can optimize images : • Allocate space for image using <height/> and <width/> , it will let page rendering more quickly .
  • 9. 8. Always Deploy in Release Mode • At the time of deploying our main concern is performance , Debug Mode creates .pdb file and take some info generated by JIT to code address mapping . • Code is more optimized in Release Mode. • Less memory is used by the source code at run time in Release Mode. • Set debug=“false” in web.config for release mode.
  • 10. 9. Use client Side Validation At max one should use client side validation for application as it gives user a friendly experience and reduce the over head of post back to the server.Where secuirty is priority use server side validation .
  • 11. 10. Remove Unnecessary HTTP Headers The X-AspNet-Version, X-AspNetMvc-Version, X-Powered-By, and Server HTTP headers provide no direct benefit and unnecessarily used a small amount of bandwidth. • Removing X-AspNet-Version : Under <System.web> add this <httpRuntime enableVersionHeader="false"/> • Removing X-AspNetMvc-Version : Add this in Global.asax.cx file MvcHandler.DisableMvcResponseHeader = true; • Remove Server HTTP Header : LINK HOW TO DO IT • Remove or Edit X-Powered-By : IIS7 Manager > HTTP Response Header > Edit or Remove
  • 12. 11. Pipeline Optimization • There are many default HttpModule which sit in request pipeline and intercept each and every request. • Example If you are not using window authentication you don’t need window authentication HttpModule. Add following code in web.config : <httpModules> <!-- Remove unnecessary Http Modules for faster pipeline --> <remove name="Session" /> <remove name="WindowsAuthentication" /> <remove name="PassportAuthentication" /> <remove name="AnonymousIdentification" /> <remove name="UrlAuthorization" /> <remove name="FileAuthorization" /> </httpModules>
  • 13. 12. Use Content Delivery Network • Better if you download things from nearest server from your palace .its like travelling things from one country to another which takes times. If application has large number of images, CSS, JavaScript sending request for each of them and downloading them across the world will take significant time. • Content Delivery Network deal with static cacheable Content . • Bootsrap Used CDN for his latest release ;)
  • 14. 13. Dispose Objects Manually • Although Objects will be cleaned up when they are no longer being used and when the garbage collector sees fit. Always dispose an object which implements IDisposable ,to do so Use a USING statement to automatically dispose of an object once your program leaves the scope of the using statement. using (SqlConnection cn = new SqlConnection(connectionString)) { using (SqlCommand cm = new SqlCommand(commandString, cn)) { cm.ExecuteNonQuery(); } }
  • 15. 14. Effective use of Jquery AJAX in Asp.ne • Use ajax to download data asynchronously, which are not needed immediately like content of Accordion (Collapsed Panel) and tabs. • Don’t make too much ajax requests • Use ajax when its needed to load more data when user scrolls, when user is not scrolling there is no benefit to bring all the data at once.
  • 16. 15. Do use magic of Asynchronous Methods If your page needs to access multiple data sources , then use asynchronous methods to parallelize access to those sources . LINK : HOW TO DO IT
  • 17. 16. Turn off Tracing unless until its required because its keep track of the application's trace and the sequences. Under <system.web> node write following code: <trace enabled="false" pageOutput="false" /> <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/> 17. Instead of Respons.Redirect() use Server.Transfer() when we want to transfer current page request to another .aspx page on the same server. it helps to reduce server requests. And optionally give us value of preserve query string and form controls values .
  • 18. 18. String Management : • Use += operator or String.Concat() when the number of appends is know and short . • Use StringBuilder object when number of appends is unknown. 19. Asp .NET literal and label are different • Literal just show that text they don’t add the extra markup. • Label add the extra markup <label><label/>. 20. Remove Blank Space and lines from HTML • Using Regular Expressions in VS2012 remove blank lines from .aspx and HTML ^(?([^rn])s)*r?$r?n • Use CodeMaid tool to remove spaces and more.
  • 19. 21. Use Performance Tools Correct code makes good performance • Backend performance Tools : DotNetMemoryProfiler, SQLServerProfiler • Performance Tools : • Static analysis tool : Yslow • Run Time Profiler : Speed tracer for chrome, Firebug for firefox, IE Developer tools • Others : WebPageTest , Page-analyzer , Pingdom • Monitoring Tool : Fiddler
  • 20. Developer Checklist Caching Client Side Validation Use ViewState if needed Dispose Objects ManuallyCDN Remove Unneccesary HTTP Headers Effective Paging URL Compression Pipeline Optimization Release Mode Images Optimization & Sprite Images Bundling and Minification Jquery Ajax Async and Await Turn Tracing Off
  • 21. Sarvesh Kushwaha | | | | | |