Pages

Thursday, 24 November 2016

Web Server - ASP (Counters & Tuning Tips)

What is Web-Server?

A Web server is a system that delivers content or services to end users over the Internet. A Web server consists of a physical server, server operating system (OS) and software used to facilitate HTTP communication. A Web server is also known as an Internet server. Every Web server has an IP address and possibly a domain name. A Web server is a program that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users, in response to their requests, which are forwarded by their computers' HTTP clients. Leading Web servers include Apache, Microsoft's Internet Information Server (IIS) and ASP.net.
ASP (Active Server Pages) Web Server Counters:
a. Errors/sec: The average number of errors that occurred per second.  
b. Requests/sec: The average number of requests that were executed per second. 
c. Requests Executing The number of ASP requests currently executing (for example, the number of active worker threads). 
d. Requests Queued The number of queued ASP requests that are waiting to be processed. The maximum number for this counter is determined by the metabase property AspRequestQueueMax. 
e. Transactions/sec The average number of transactions that have been started, per second. 
Tuning Tips:
Below are some tuning tips for ASP servers. 
a. Tune the connection limit. Either limit maximum connections allowed or increase CPU power. 
b. Turn off ASP debugging by setting AppAllowDebugging and AppAllowClientDebug to false.
c. Set AspBufferingOn to true in order to collect the ASP output buffer before it is sent to the client. 
d. The AspProcessorThreadMax Metabase property specifies the maximum number of worker threads per processor that IIS can create. To find out the maximum number of worker threads that IIS allows per ASP process, multiply this value by the number of processors on your server. If you decrease this value, monitor performance to make sure that the lower thread limit does not degrade performance. If it does, increase the value again. 
e. The AspRequestQueueMax Metabase property specifies the maximum number of ASP requests that are permitted in a queue. The default value is 3,000, but the optimal setting depends on the behaviour of the application. If the execution time of the request is very short and the time in the queue is short, it is reasonable to decrease this value. 
f. Verify that the keep-alive state for each TCP connection is enabled (connection = keep-alive). 
g. Enable HTTP compression to increase the efficiency of bandwidth use. 
h. Set HTTP expire headers for all images and for HTML. 
i. Remove unnecessary file content. 
j. Remove unnecessary empty lines, tabs, characters, and so on. 
k. Use static files wherever possible in order to reduce processor demand as much as possible. 
l. Establish Web gardens, which are application pools that can run multiple worker processes. 
m. Set debug=”false” in web.config production environment.
n. Set trace=”false” in web.config production environment.
o. Try to decrease HTML page weight.
p. Use tables instead of using div tag and if possible then do not give big name to your control it will increase HTML bytes, as asp.net uses client Id to differentiate all the controls. If you are creating custom controls then you can overwrite your clientid and uniqueId.
q. Use cache api as much as possible it will decrease server roundtrip and boost application performance.
r. "sqlcachedependancy" validates cache with your database operation like insert,update and delete and if not possible with it then use the file base caching.
s. Remove blank spaces from HTMLpage, it increases throughput.
t. Try to use master pages.
u. Prefer database reader over dataset unless and until you have specific reason to use database.
v. Use ADO.NET asynchronous calls for ado.net methods. 
w. Do IIS performance tuning as per requirement.
x. Disable view state. Store view state in session or database by overriding the default methods for storing view state.
y. Always use inproc session state if possible.
z. Use Ajax for your application wisely. Lots of Ajax calls for a page will also decrease the performance.
aa. Right JavaScript in .JS files and place it as bottom of the application.
ab. Use Separate CSS files for styling of application.
ac. Use database paging over normal paging while displaying huge amount of data.
ad. Call web service from java script instead of server side. Use asynchronous calls to call a web method from web service. 
ae. Use System.Text.StringBuilder for string concatenation its 4 times more faster then the normal strings.
af. Use Server.Transfer instead of response.redirect. 

No comments:

Post a Comment