473,769 Members | 7,558 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="Re turns Northwind Customers",Enab leSession =false)]
public XmlDocument GetData()
{

SqlConnection conn = new SqlConnection(" Integrated Security=SSPI;P ersist
Security Info=False;Init ial Catalog=Northwi nd;Data Source=xxxxxxx" );
SqlDataAdapter cmd = new SqlDataAdapter( "Select * from Customers",conn );
DataSet ds = new DataSet();
cmd.Fill(ds,"Or ders");
XmlDataDocument doc = new XmlDataDocument (ds);
return doc;

Dec 17 '05 #1
1 1278
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="Re turns Northwind Customers",Enab leSession =false)]
public XmlDocument GetData()
{

SqlConnection conn = new SqlConnection(" Integrated Security=SSPI;P ersist
Security Info=False;Init ial Catalog=Northwi nd;Data Source=xxxxxxx" );
SqlDataAdapter cmd = new SqlDataAdapter( "Select * from Customers",conn );
DataSet ds = new DataSet();
cmd.Fill(ds,"Or ders");
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
2159
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 when I try to combine them I get this as soon as ./python is run: """ case $MAKEFLAGS in \ *-s*) CC='icc -pthread' LDSHARED='icc -pthread -shared' OPT='-DNDEBUG -O3 -xN' ./python -E ./setup.py -q build;; \ *) CC='icc -pthread' LDSHARED='icc...
1
1316
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 as my main tool, I was looking for some sites that explain some of the optimizations .Net may have that will make it more compatible with modern hardware. I'm also looking for info on the differences between traditional compilers and the Dot Net...
3
3760
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 to Below Normal, but I'm still getting reports that the service is making a noticable impact on overall machine performance. I stuck some Thread.Sleep calls in a various places in the code, but that doesn't help much, since the service makes...
3
2464
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 representing the "Idle" process. I would figure out what percentage of time the idle process has been running since my function last was called. Then the average CPU utilization would be 100 - average idle percentage. I figure out the average idle...
2
1299
by: john | last post by:
Is there a way, in C#, to query the OS for the processor % utilization.
0
1061
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 time of each processor in a system and this works most of the time except on 64-bit Windows 2003 server on some platforms. What makes me nervous is MS says it may drop support for this call in future OSes so I can't depend on it long term...
0
1322
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. But when I try to measure the network utilization with a particular utility that sends large data, then the values that I get exceed 100%. Even in the task-manager it shows similar graph (graph goes up above the 100% line and disappears and then...
29
1922
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 runs faster with -O2 than with -O3, even though -O3 is a higher optimization setting. Have I found a bug in gcc? Could I be doing something wrong?
0
2251
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 However it doesnt work in Windows XP... i wanna know wat class to use to get CPU utilization in win xp... also Processid is to be compared to get CPU utilization for Process to get info from both classes?
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10214
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10048
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6674
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3963
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 we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.