Sunday, February 19, 2012

Performance Unrivaled: Quick heal solution to website performance

For me the performance of any web application can be assessed by only two important factors. One is processing of code in server and then carrying those processed output though network & wires to end users. If you processed your code faster than output transmittal through wire is another parameter that makes lot of difference. Its thumb rule, less weight faster it traverse through wire and get downloaded at browser much less time. My intention is to bring some light on these two things. There are different aspects of scale out and scale in approach to support huge user base but that is not my objective. My first level to assess any application is to probe these areas, what time it takes for any code to get processed and give output and next more interesting; how fast I can pass that output to end users browsers window?

1) Time to process input and give output
2) Time to transmit the processed output to end users

This is first level approach to improve performance of any system according to me. Then what comes next is, system capacity thereafter all planning to scale in or scale out servers to support concurrent/user base count. Not to waste much time out here understanding those nitty-gritty’s. My focus areas are,
Part 1
1) Code review. Reduce Warnings. Apply best practices Common e.g make use of string.builder , string.empty, string.IsnullOrEmpty()==true, Remove unwanted references.
2) Check cyclomatic complexity. Terminate unnecessary looping ,apply break if possible
3) Always keep tracing and bebug false
4) Use Server.transfert wherever possible
5) Make use of datareader wherever possible. Reduce use of dataset
6) Open and close the connection in the method.
7) Explicitly close connections in case of data reader.
8) When using DataReaders, specify CommandBehavior.CloseConnection.
9) Do not explicitly open a connection if you use Fill(SQL dataadapter or Update for a single operation.
10) Avoid checking the State property of OleDbConnection.
11) Connection Pooling.
12) Check for number of tier database calls. Say for example –if one page makes 20 database calls then this is of concerns. Reduce number of database call. Keep tier less chatty. Identify this bottleneck using VS2010 Tool.

Part 2
1) Reduce Viewstate size. Tool Enable page trace=true at page level
2) Use JQuery +Jason for low weight data display. Popup etc.
3) Ajax
5) Remove Favicon.ico if not required .Use

Reduce javascript file size .use Minify JS tool
Reduce CSS fie size .Use Minify CSS tool
Smush and optimizes image. Use All tool. Check this out

. Select file such image folder , css and javascript..
2.Click the HTTP Headers tab.
Select the Enable content expiration check box.
Click Expire immediately, Expire after, or Expire on, and type the appropriate expiration information in the corresponding boxes.
Click OK.
On the website’s entry right click->properties.
Select the HTTP Headers tab.
Add a new entry with Etag as the name, leaving the value blank.
In production environment disable debug mode and tracing option.
· Detailed Code Component
· Database changes
· Frontend Changes
· Server side configuration changes/Tuning
· What are we going to do?
· What are we going to achieve?
· Areas of Improvement.
· Tools for Performance Engineering
· Recommendation & Suggestions
· Pagination using database
· Sorting using database
· Search employee using database
· DC View using database
· Time Booking using database
· Export excel using database
· Refresh employee popup
· ***Very very important – Move dropdowns code in Page_Init for DC view.
· < asp:DropDownList ID="drpCountry" OnInit="drpCountry_Init" DataTextField="value" DataValueField="key" runat="server" TabIndex="1">
· //save viewstate
· protected void drpCountry_Init(object sender, EventArgs e)
· {
· IDictionary countryList = new Dictionary();
· countryList.Add(00, "INDIA");
· countryList.Add(01, "SRILANKA");
· countryList.Add(02, "NEPAL");
· countryList.Add(03, "BUTAN");
· //*** Bind Grid
· drpCountry.DataSource = countryList;
· drpCountry.DataBind();
· }
Remove unwanted view states at control level
Disable Logging in IIS
Remove Sticky Session- Disadvantage if one server fails user stick to same server as session is sticky.
Factor Availability Architecture Best Practice and Norms.
Enabled HTTP Compression in IIS
Using HTTpWatch we can eliminate http request 400 and 500 error
Tools , That helps as Hook and Lever To drive this-
1) HttpWatch/fiddler
2) Performance counter
3) Logparser
4) Code aanlysis VS2010
5) FXcop
6) YSlow

The tuning process is an iterative processing that consists of the following set of activities.
We have to act methodically and with determination and be steadfast to overcome performance issue.
Combine all JavaScript and css files into one respectively.
Design Principle Guidelines

Friday, February 10, 2012

Performance Engineering -Unleash with YSLow Tool/Jslint

A Quick refresher on web page performance Tuning
YSlow is integrated into the Firebug web development tool for Firefox.
Note: YSlow is not integrated into Firebug Lite for Internet Explorer at this point in time.
1. Download and install Firefox:
2. Download and install Firebug:
Note: Cannot be downloaded from IE
3. Download and install YSlow

The parameter to test the web page for performance are listed Below

1. Make Fewer HTTP Requests
2. Compress Components with gzip
3. Minify JavaScript and CSS
4. Configure entity tags (ETags)
5. Reduce the number of DOM elements
6. Put CSS at top 7. Make JavaScript and CSS external
8. Avoid URL redirects
9. Make Ajax cacheable
10. Avoid HTTP 404 (not found) errors
11. Add Expires Headers
12. Put JavaScript at bottom
13. Remove Duplicate JavaScript and CSS
14. Use Get for Ajax Request
15. Reduce cookie size

The YSLow will list following details
The tool will show the details for each file:
· URL,
· when it expires
· the response time in ms to download the file
The bench mark for page performance:

· Page Size: 100K-150K
· Response Time: Less than 3000 ms in total

Additional Tool

  1. JSLint

  2. All JS

  3. All JS Beatified

  4. All CSS

  5. All

  6. All Js Minified

Hope this help.

Friday, January 20, 2012

IIS 7.5 Architecture Insights

Recently I started migration of applications from win 2003 OS platform to Win 2008. With this I decided to move to .net 4.0 and of course the IIS 7.5 What really surprise me the changes that has evolved in these technology, platform and environment in totally. The IIS and .net has matured lot and becoming stronger in each version releases Microsoft does.

IIS 6.0 vs 7.5 Architecture Insight
IIS6.0 -Web service Extension:We used to have web Server Extension. In IIS 6.0 is enabled only to support client static content and in order to enabled server side aspx, asp,.asmx, .svc, webdav, front page server extensions etc we have to make use of Web server Extension options in IIS( Inetmgr).
ALLOW and Prohibit Options Available.

IIS 7.5 -ISAPI & CGI this is exist in server extension in win server 2008 R2 or in Program On and Off feature in Control Panel. Once they are enabled it is available in IIS root.

IIS7.5 Integrated & Classic (6.0) mode of operatability.

IIS6.0- IIS and has its own authorization/authentication model.
IIS7.5 Integrated Mode combines IIS & Authentication/Authorization
IIS 6.0 Architecture
Lsass.exe: Security and SSL
Inetinfo.exe: hosts the non-HTTP services and the IIS Admin Service, including the Metabase.E.g SMTP, FTP
SvcHost.exe: host operating system services; in the case of IIS, it hosts the Web (HTTP) service. www services, asmx, WAS – Window activation services for WCF binding –TCP and MSMQ

It has W3SVC.exe is user mode component that bridge communication between user mode and kernel mode. http listener handles request for kernel http stack through http.sys protocol stack
W3wp.exe: multiple W3wp.exe processes, one for each application pool.
ISAPI Filter
ISAPI Extension
APP Domain
In Web-garden one application is divided into separate processes, -multiple instances of the same worker process.

IIS 7.5 Architecture
Additional Listener Adapter
Listener Adapter
World Wide Web Publishing Service (hosting the listener adapter)
NET.TCP listener adapter
NET.PIPE listener adapter
NET.MSMQ listener adapter

Protocol-specific listener adapters support all four WCF transports, instead of only HTTP in IIS 6.0. In addition, a new operating system service is available called Windows Activation Services (WAS). Both W3svc.exe and WAS are running inside an operating system host called SvcHost.exe
WAS is the new process activation service that is a generalization of Internet Information Services (IIS) features that work with non-HTTP transport protocols. WCF uses the listener adapter interface to communicate activation requests that are received over the non-HTTP protocols supported by WCF, such as TCP, named pipes, and Message Queuing.
WAS activation is not supported if the web server’s request processing pipeline is set to Classic mode. The web server’s request processing pipeline must be set to Integrated mode if WAS activation is to be used.