Google
 

Wednesday, April 23, 2008

Performance Considerations While Calling Web Services from ASP.Net Page

Following are the considerations what affect performance while calling a web service from ASPX page:

1. HTTP two connections limit (not applicable for localhost case) as set under <connectionManagement >

Example:

<connectionManagement><add maxconnection="2" address="*" />
</connectionManagement>

2. Thread pool limits (IIS) as set under <processModel > and <httpRuntime >

Eaxmple:

<processModel minWorkerThreads="50" maxIoThreads="20"
maxWorkerThreads="20"/>


<httpRuntime minLocalRequestFreeThreads="4" minFreeThreads="8"
executionTimeout="90" />


Solution (1 & 2):

1. Tuning <connectionManagement>, <processModel> &
<httpRuntime> settings in Machine.config. Following are the attributes to understand:

  • maxWorkerThreads
  • minWorkerThreads
  • maxIoThreads
  • minFreeThreads
  • minLocalRequestFreeThreads
  • maxconnection
  • executionTimeout

Recommendations

The settings that are recommended in this section may not work for all applications. However, the following additional information may help you to make the appropriate adjustments. If you are making one Web service call to a single IP address from each ASPX page, Microsoft recommends that you use the following configuration settings:

  • Set the values of the maxWorkerThreads parameter and the maxIoThreads parameter to 100.
  • Set the value of the maxconnection parameter to 12*N (where N is the number of CPUs that you have).
  • Set the values of the minFreeThreads parameter to 88*N and the
    minLocalRequestFreeThreads parameter to76*N.
  • Set the value of minWorkerThreads to 50.

Remember, minWorkerThreads is not in the configuration file by default. You must
add it.

2. However, when you use this configuration, scenarios that involve one of the
following will probably use too many connections:

  • Requests are to multiple IP addresses.
  • Requests are redirected (302 status code).
  • Requests require authentication.
  • Requests are made from multiple AppDomains.

In these scenarios, it is a good idea to use a lower value for the maxconnection
parameter and higher values for the minFreeThreads parameter and the
minLocalRequestFreeThreads parameter.


3. When ASP.NET is running under IIS 6 in native mode, the IIS 6 process model
is used and settings in section are ignored. Please use the IIS administrative UI to configure things like process identity and cycling for the IIS worker process for the desired application

3. Hosting model

ASP.NET requires a host. On Windows Server™ 2003, the default host is
the Internet Information Services (IIS) 6.0 worker process (W3wp.exe). When you
use the ASP.NET Process Model, the host is the ASP.NET worker process
(Aspnet_wp.exe).


4. Cryptography

If your application only needs to ensure that information is not tampered with
during transit, you can use keyed hashing. Encryption is not required in this
case, and it is relatively expensive compared to hashing. If you need to hide
the data that you send over the network, you require encryption and probably
keyed hashing to ensure data validity. When both parties can share the keys,
using symmetric encryption provides improved performance in comparison to
asymmetric encryption. Although larger key sizes provide greater encryption
strength, performance is slower relative to smaller key sizes. You must
consider this type of performance and balance the larger key sizes against
security tradeoffs at design time.




More details on:

http://msdn2.microsoft.com/en-us/library/aa480507.aspx

http://msdn2.microsoft.com/en-us/library/ms998562(d=printer).aspx



No comments: