Sundararajan Subramanian
Associate Technical Architect | Aditi Technologies Ltd.,
http://tinyurl.com/codeshelve | sundararajans@hotmail.com
Asp.Net Resource Monitoring
Traditionally monitored at worker process
level
No insight into the individual applications
sharing the same worker process.
CLR 4 introduces ARM – Application
domain resource management
Enables monitoring resources at individual
appdomain level
Asp.Net Resource Monitoring
ASP.NET 4 exposes performance counters
built on ARM
Managed Memory Used
% Managed Processor Time
Asp.Net Resource Monitoring
• Enable ARM in aspnet.config file in the .Net
framework directory
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<runtime>
<appDomainResourceMonitoring enabled="true"/>
</runtime>
</configuration>
Resource Monitoring
Extensible Request Validation
Write your own custom Request Validators
Step1: Inherit from
System.Web.Util.RequestValidator
Step2: Override IsValidRequestString(….)
Step3: configure custom request validator in
web.config
<httpRuntime requestValidationType="Samples.MyValidator,
Samples" />
Request Validation
Session State
Out-Of-Proc Session State Compression
Compressed using GZIP -
System.IO.Compression.GZipStream
<sessionState mode="SqlServer"
sqlConnectionString="data source=dbserver;Initial
Catalog=aspnetstate"
allowCustomSqlDatabase="true"
compressionEnabled="true" />
Auto start Web applications
Intensive operations to be performed when
application starts?
First request takes time?
Asp.Net 4 + IIS 7.5 + Windows 2008 R2 –
Configure Autostart Web apps
<applicationpools>
<add name="defaultappPool" startMode="AlwaysRunning"
/>
</applicationpools>
<sites>
<site name="MySite" id="1">
<application path="/"
serviceAutoStartEnabled="true"
serviceAutoStartProvider="PrewarmMyCache" >
<!-- Additional content -->
</application>
</site>
</sites>
<!-- Additional content -->
<serviceautostartproviders>
<add name="PrewarmMyCache"
type="MyNamespace.CustomInitialization, MyLibrary"
/>
</serviceautostartproviders>
Output Caching
Cache the response (output) in memory
previously
High memory footprint in case of
applications with heavy traffic
Asp.Net 4.0 provides features to write
custom output cache providers
Can use any storage mechanism to store
HTML content
Output cache
Create Custom output cache provider by
inheriting from
System.Web.Caching.OutputCacheProvider
Configure the provider in the providers
section of the web.config
Output Caching
URL limit
Previously 260 character limit.
Extend this character limit in Asp.net 4.0 by
config
<httpRuntime maxRequestPathLength="260"
maxQueryStringLength="2048" />
requestPathInvalidChars - Configure the
set of valid characters in the url
<httpRuntime
requestPathInvalidChars="&lt;,&gt;,*,%,&amp;,:,,?
" />
Other features
Custom Encoders
encoderType in <httpruntime> element
Object caching
Features of Asp.Net cache brought to other
non web applications
RedirectPermanent(..) – HTTP 301
References
Asp.Net
http://www.asp.net/
Feedback / QnA
Your Feedback is Important!
Please take a few moments to fill out our online
feedback form
Use the Question Manager on LiveMeeting
to ask your questions now!
Contact (optional slide)
Code snippets blog
http://tinyurl.com/codeshelve
http://sundars.net
Email Address
sundararajans@hotmail.com
Twitter - @sundararajans
Asp.Net 4.0 Core runtime enhancements

Asp.Net 4.0 Core runtime enhancements

  • 1.
    Sundararajan Subramanian Associate TechnicalArchitect | Aditi Technologies Ltd., http://tinyurl.com/codeshelve | sundararajans@hotmail.com
  • 2.
    Asp.Net Resource Monitoring Traditionallymonitored at worker process level No insight into the individual applications sharing the same worker process. CLR 4 introduces ARM – Application domain resource management Enables monitoring resources at individual appdomain level
  • 3.
    Asp.Net Resource Monitoring ASP.NET4 exposes performance counters built on ARM Managed Memory Used % Managed Processor Time
  • 4.
    Asp.Net Resource Monitoring •Enable ARM in aspnet.config file in the .Net framework directory <?xml version="1.0" encoding="UTF-8" ?> <configuration> <runtime> <appDomainResourceMonitoring enabled="true"/> </runtime> </configuration>
  • 5.
  • 6.
    Extensible Request Validation Writeyour own custom Request Validators Step1: Inherit from System.Web.Util.RequestValidator Step2: Override IsValidRequestString(….) Step3: configure custom request validator in web.config <httpRuntime requestValidationType="Samples.MyValidator, Samples" />
  • 7.
  • 8.
    Session State Out-Of-Proc SessionState Compression Compressed using GZIP - System.IO.Compression.GZipStream <sessionState mode="SqlServer" sqlConnectionString="data source=dbserver;Initial Catalog=aspnetstate" allowCustomSqlDatabase="true" compressionEnabled="true" />
  • 9.
    Auto start Webapplications Intensive operations to be performed when application starts? First request takes time? Asp.Net 4 + IIS 7.5 + Windows 2008 R2 – Configure Autostart Web apps
  • 10.
    <applicationpools> <add name="defaultappPool" startMode="AlwaysRunning" /> </applicationpools> <sites> <sitename="MySite" id="1"> <application path="/" serviceAutoStartEnabled="true" serviceAutoStartProvider="PrewarmMyCache" > <!-- Additional content --> </application> </site> </sites> <!-- Additional content --> <serviceautostartproviders> <add name="PrewarmMyCache" type="MyNamespace.CustomInitialization, MyLibrary" /> </serviceautostartproviders>
  • 11.
    Output Caching Cache theresponse (output) in memory previously High memory footprint in case of applications with heavy traffic Asp.Net 4.0 provides features to write custom output cache providers Can use any storage mechanism to store HTML content
  • 12.
    Output cache Create Customoutput cache provider by inheriting from System.Web.Caching.OutputCacheProvider Configure the provider in the providers section of the web.config
  • 13.
  • 14.
    URL limit Previously 260character limit. Extend this character limit in Asp.net 4.0 by config <httpRuntime maxRequestPathLength="260" maxQueryStringLength="2048" /> requestPathInvalidChars - Configure the set of valid characters in the url <httpRuntime requestPathInvalidChars="&lt;,&gt;,*,%,&amp;,:,,? " />
  • 15.
    Other features Custom Encoders encoderTypein <httpruntime> element Object caching Features of Asp.Net cache brought to other non web applications RedirectPermanent(..) – HTTP 301
  • 16.
  • 17.
    Feedback / QnA YourFeedback is Important! Please take a few moments to fill out our online feedback form Use the Question Manager on LiveMeeting to ask your questions now!
  • 18.
    Contact (optional slide) Codesnippets blog http://tinyurl.com/codeshelve http://sundars.net Email Address sundararajans@hotmail.com Twitter - @sundararajans