473,503 Members | 10,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Optimizations for Web Services Processor Utilization?

I have written a web service that returns an XmlDocument. The code is similar
to the example below, except it returns an XmlDocument rather than an
XmlDataDocument. When I run the service from the test harness in VS (or from
a client page), CPU utilization on the Web server spikes to over 50% and
returns quickly to around 0-5% after it has completed. I have tried the
following:
1) Changed the type returned by the web service to type string.
2) Turned off Session State on the web server
3) Turned off logging on the Web server
4) Use anonymous authentication.

I would like to limit the amount of processor used on the web server when
the service is called. My client is concerned about this, because eventually
there will be hundreds of concurrent users. What other steps can I take to
limit the amount of CPU used?

[WebMethod( Description="Returns Northwind Customers",EnableSession =false)]
public XmlDocument GetData()
{

SqlConnection conn = new SqlConnection("Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=Northwind;Data Source=xxxxxxx");
SqlDataAdapter cmd = new SqlDataAdapter("Select * from Customers",conn);
DataSet ds = new DataSet();
cmd.Fill(ds,"Orders");
XmlDataDocument doc = new XmlDataDocument(ds);
return doc;

Dec 17 '05 #1
1 1259
Hi.

There are some ways you can take to reduce the use of CPU. But all of them
should be carefully measured before taking any action.

Some advices are:
-Use asynchronous server-side processing: This reduces the number of threads
used by ASP.NET and makes your code more effective
-Try using DataReaders to read data from the database
-Ensure that the database uses indexes (you have a great article on
http://www.sql-server-performance.co...ce_audit7.asp),
correctly indexed databases consume a lot less cpu power (this is significant
if you have the appserver and dbserver on the same machine)
-Use connection pooling (by default the SqlProvider uses this)
-Ensure that your IIS is configured to mantain connections
-If you use SSL ensure that the full SSL Handshake is performed on the first
connection only
-Use a profiler

Some of the advices are pretty obvious, I hope it helps.

"John Doe" wrote:
I have written a web service that returns an XmlDocument. The code is similar
to the example below, except it returns an XmlDocument rather than an
XmlDataDocument. When I run the service from the test harness in VS (or from
a client page), CPU utilization on the Web server spikes to over 50% and
returns quickly to around 0-5% after it has completed. I have tried the
following:
1) Changed the type returned by the web service to type string.
2) Turned off Session State on the web server
3) Turned off logging on the Web server
4) Use anonymous authentication.

I would like to limit the amount of processor used on the web server when
the service is called. My client is concerned about this, because eventually
there will be hundreds of concurrent users. What other steps can I take to
limit the amount of CPU used?

[WebMethod( Description="Returns Northwind Customers",EnableSession =false)]
public XmlDocument GetData()
{

SqlConnection conn = new SqlConnection("Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=Northwind;Data Source=xxxxxxx");
SqlDataAdapter cmd = new SqlDataAdapter("Select * from Customers",conn);
DataSet ds = new DataSet();
cmd.Fill(ds,"Orders");
XmlDataDocument doc = new XmlDataDocument(ds);
return doc;

Dec 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2142
by: Michael Hoffman | last post by:
Just out of curiosity, I was wondering if anyone has compiled Python 2.4 with the Intel C Compiler and its processor specific optimizations. I can build it fine with OPT="-O3" or OPT="-xN" but...
1
1296
by: VM | last post by:
Does Studio Dot Net include any optimizations that make it the appropriate tool for Pentium 4 processors? I'm writing a paper on compiler optimizations for modern hardware. Since I chose .Net...
3
3743
by: Dathon | last post by:
I have a Windows service that's built with .NET. The process is meant to run in the background and not suck up too much CPU time. I set the thread priority for the various threads in the service...
3
2451
by: john | last post by:
I don't want to know what the CPU utilization is right now. I want to get the average utilization over the last, for example, hour. So I came up with a method where I would get a Process object...
2
1286
by: john | last post by:
Is there a way, in C#, to query the OS for the processor % utilization.
0
1039
by: dtp | last post by:
This one has got me stumped. Is there a way to figure out the utilization of each processor in an MP system? (2P and above) Right now I use the NtQuerySystemInformation API to get busy and idle...
0
1305
by: bimalendug | last post by:
Hi All, I'm using the .NET performance counters to calculate the network utilization. But this value exceeds 100%. In most of the cases, it is very similar to the one shown in the task-manager....
29
1874
by: sammy | last post by:
Word up! If there are any gcc users here, maybe you could help me out. I have a program and I've tried compiling it with -O2 and -O3 optimization settings. The wired thing is that it actually...
0
2223
by: PRR | last post by:
with WMI class Win32_Process i can get most details of Processes running one Pc.. except CPU utilization... THe class for CPU utilization u need to use Win32_PerfFormattedData_PerfProc_Process ...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.