473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Poor performance under IIS

Hi all

I have an application which brings back 1000 records from a sql server
database. Under the local asp.net development server provided with
Visual Studio 2008, it takes about 1.8 seconds

When I place this application in IIS it takes 16 seconds for the exact
bit of code. I have narrowed the code down to loopoing around the
dataset and creating an object for every row in the dataset. My
question is why does it take so long under IIS but not under the local
asp.net development server?

Any ideas? How can I get this 16 seconds down to a more acceptable
level eg 2-3 seconds? Is this a configuration issue? I have tried
deploying this to 2 different IIS servers and the same bit of code
takes 16 seconds on both IIS boxes

The application is developed using .net framewor 3.5 and c#, asp.net

Ilyas
Jun 27 '08 #1
12 2466
"Ilyas" <il***@igsoftwaresolutions.co.ukwrote in message
news:36**********************************@t54g2000 hsg.googlegroups.com...
I have an application which brings back 1000 records from a sql server
database. Under the local asp.net development server provided with
Visual Studio 2008, it takes about 1.8 seconds

When I place this application in IIS it takes 16 seconds for the exact
bit of code. I have narrowed the code down to loopoing around the
dataset and creating an object for every row in the dataset. My
question is why does it take so long under IIS but not under the local
asp.net development server?

Any ideas? How can I get this 16 seconds down to a more acceptable
level eg 2-3 seconds? Is this a configuration issue? I have tried
deploying this to 2 different IIS servers and the same bit of code
takes 16 seconds on both IIS boxes
1) When the code is running on the development server, is the database it's
connecting to also on the development server?

2) When the code is running on the remote server, is the database it's
connecting to on a different remote server? If so, have you got networking
issues. Also, what database is it and how are you connecting to it?

3) Can you be a bit more specific about what you mean by "looping around the
dataset"? What is actually happening here?

4) Can you confirm that, wherever the bottleneck is, it's not in the actual
retrieval of the data from the database...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #2
On 20 Jun, 17:02, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
"Ilyas" <il...@igsoftwaresolutions.co.ukwrote in message

news:36**********************************@t54g2000 hsg.googlegroups.com...
I have an application which brings back 1000 records from a sql server
database. Under the local asp.net development server provided with
Visual Studio 2008, it takes about 1.8 seconds
When I place this application in IIS it takes 16 seconds for the exact
bit of code. I have narrowed the code down to loopoing around the
dataset and creating an object for every row in the dataset. My
question is why does it take so long under IIS but not under the local
asp.net development server?
Any ideas? How can I get this 16 seconds down to a more acceptable
level eg 2-3 seconds? Is this a configuration issue? I have tried
deploying this to 2 different IIS servers and the same bit of code
takes 16 seconds on both IIS boxes

1) When the code is running on the development server, is the database it's
connecting to also on the development server?

2) When the code is running on the remote server, is the database it's
connecting to on a different remote server? If so, have you got networking
issues. Also, what database is it and how are you connecting to it?

3) Can you be a bit more specific about what you mean by "looping around the
dataset"? What is actually happening here?

4) Can you confirm that, wherever the bottleneck is, it's not in the actual
retrieval of the data from the database...?

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
They are no networking issues as there is no problems fetching the
data.

Yes the same database is being used throughtout. I have used Sql
Prolfiler and can definatly confirm that its not sql server causing
the delay. Sql server splits out the record in under a second

By looping around the dataset, I mean for each row in the dataset,I am
creating a business object, and setting its properties. The problem is
when the code to do this is deployed in IIS the code it takes about 16
seconds while under asp.net development server (built in visual studio
2008 web server) it takes 2 seconds. I have determined this using
trace.axd with custom messages that I have written at various stages
of this process. Why is there such a big difference in the times?

Surly IIS would give better timings than this as its an enterprise web
server...?
Jun 27 '08 #3
"Ilyas" <il***@igsoftwaresolutions.co.ukwrote in message
news:e0**********************************@m44g2000 hsc.googlegroups.com...
By looping around the dataset, I mean for each row in the dataset,I am
creating a business object, and setting its properties. The problem is
when the code to do this is deployed in IIS the code it takes about 16
seconds while under asp.net development server (built in visual studio
2008 web server) it takes 2 seconds. I have determined this using
trace.axd with custom messages that I have written at various stages
of this process. Why is there such a big difference in the times?
Impossible to tell without knowing more about what the business objects are
and how you're creating them...
Surly IIS would give better timings than this as it's an enterprise web
server...?
Not necessarily... When you're using the VS.NET development server, you're
the only user. Is the IIS box being used for anything else other than this
app...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #4
re:
!when the code to do this is deployed in IIS the code it takes about 16
!seconds while under asp.net development server (built in visual studio
!2008 web server) it takes 2 seconds. I have determined this using
!trace.axd with custom messages that I have written at various stages
!of this process. Why is there such a big difference in the times?

How isolated is your application in the IIS Server ?

In the ASP.NET Development Server, your app can use up to 100% of the CPU time.

In the IIS Server :

1. Is the app running in its own Application Pool ?
If the app is sharing the Application Pool with other applications,
that could have an impact on performance.

Simply isolating the app in its own App Pool will improve performance.

2. How many processors does the IIS Server have ?
If the application is critical enough, and you have a quad processor,
for example, you could allocate 2 processors to ASP.NET

Look up the processModel and cpuMask configuration parameters in machine.config.

ASP.NET launches one worker process for each qualified CPU.

If the webGarden attribute is configured to true,
doing this limits worker processes to the number of qualified CPUs.

The maximum for worker processes is equal to the number of CPUs.
If webGarden is false, this attribute is ignored and only one worker process will run.

This is the default behavior, which is why it needs to be configured
to be able to take advantage of your unused processing power.

Be careful when configuring the cpuMask, as it needs a hexadecimal value.
The default is "0xffffffff", which enables one processor only.

The cpuMask hexadecimal value 0x0d represents the bit pattern 1101.

On a computer with four CPUs, this indicates that ASP.NET
processes can be scheduled on CPUs 0, 2, and 3, but not on CPU 1.

Make sure you use the correct hexadecimal value desired if you're configuring the cpuMask.

Note that, if you want to use the cpuMask, you must set "Webgarden" to true.

Otherwise, the cpuMask parameters will be ignored, and Windows will schedule
cpu usage to its convenience, which means that other processes might get more
priority, instead of ASP.NET being the most prioritized Windows process.

See :
http://msdn.microsoft.com/en-us/library/5dws599a.aspx

<quote>
When an ASP.NET Web page calls an external resource, such as when performing database access requests,
the page request stops until the external resource responds, freeing the CPU to process other threads.

If another request is waiting to be processed and a thread is
free in the thread pool, the waiting request begins processing.

The result can be a high number of concurrently executing requests and many waiting threads
in the ASP.NET worker process or application pool, which hinders the Web server's throughput,
adversely affecting performance.

To work around that, you can manually set the limit on the number of threads in the process by changing
the MaxWorkerThreads and MaxIOThreads attributes in the processModel section of the machine.config file.
</quote>

Be very careful when you do this...and test each Max parameter you change, in isolation.

You might want to, initially, set the processModel to autoConfig="true".
The built-in parameters usually provide enough performance.

You did not reply to Mark when he asked you whether SQL Server
is located on the same machine as the IIS web server.

If you need more processing power, and your IIS server has 2 processors, and if SQL Server
is located on the same machine as the IIS web server, you might want to set the cpuMask
so that one processor is used by ASP.NET and the other is specialized for SQL Server.

You can set the SQL Server's processor affinity in Task Manager.

Also in Task Manager, you can increase the Priority for the ASP.NET process (w3wp.exe)for your app.
That will effectively dedicate more cpu time to ASP.NET/IIS.

The throughput gains by configuring the above suggestions are mind-boggling.

3. Have you disabled Debug mode for the application ?
IIS responds more slowly when applications are running in Debug mode.
Make sure you disable debugging for the IIS application in the app's web.config

I hope these tips help you configure your IIS web server to achieve more throughput.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Ilyas" <il***@igsoftwaresolutions.co.ukwrote in message
news:e0**********************************@m44g2000 hsc.googlegroups.com...
On 20 Jun, 17:02, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
>"Ilyas" <il...@igsoftwaresolutions.co.ukwrote in message

news:36**********************************@t54g200 0hsg.googlegroups.com...
I have an application which brings back 1000 records from a sql server
database. Under the local asp.net development server provided with
Visual Studio 2008, it takes about 1.8 seconds
When I place this application in IIS it takes 16 seconds for the exact
bit of code. I have narrowed the code down to loopoing around the
dataset and creating an object for every row in the dataset. My
question is why does it take so long under IIS but not under the local
asp.net development server?
Any ideas? How can I get this 16 seconds down to a more acceptable
level eg 2-3 seconds? Is this a configuration issue? I have tried
deploying this to 2 different IIS servers and the same bit of code
takes 16 seconds on both IIS boxes

1) When the code is running on the development server, is the database it's
connecting to also on the development server?

2) When the code is running on the remote server, is the database it's
connecting to on a different remote server? If so, have you got networking
issues. Also, what database is it and how are you connecting to it?

3) Can you be a bit more specific about what you mean by "looping around the
dataset"? What is actually happening here?

4) Can you confirm that, wherever the bottleneck is, it's not in the actual
retrieval of the data from the database...?

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net

They are no networking issues as there is no problems fetching the data.

Yes the same database is being used throughtout. I have used Sql
Prolfiler and can definatly confirm that its not sql server causing
the delay. Sql server splits out the record in under a second

By looping around the dataset, I mean for each row in the dataset,I am
creating a business object, and setting its properties. The problem is
when the code to do this is deployed in IIS the code it takes about 16
seconds while under asp.net development server (built in visual studio
2008 web server) it takes 2 seconds. I have determined this using
trace.axd with custom messages that I have written at various stages
of this process. Why is there such a big difference in the times?

Surly IIS would give better timings than this as its an enterprise web server...?


Jun 27 '08 #5
1800 milliseconds is a very long time for a web response
anything longer than 100 milliseconds is bad news

profile your code using NProf or add some timing code - then you have
your answer

juan has highlighted some interesting points but playing with those
settings is just guesswork

find the problem - then fix it

IMO datasets should be avoided as they very inefficient
Jun 27 '08 #6
re:
!profile your code using NProf or add some timing code - then you have your answer

John, Ilyias already knows where the problem is, according to what he posted :

!I have narrowed the code down to looping around the
!dataset and creating an object for every row in the dataset.

The problem, as I see it, is that Ilyias stated that the *same*
code works slower in IIS than in the ASP.NET Dev Server.

His question boils down to :
!why does it take so long under IIS but not under the local asp.net development server?

That's why I suggested a few things he could look into, germane to his problem.

re:
!juan has highlighted some interesting points but playing with those settings is just guesswork

Profiling under IIS *will* reveal the problem, as you say.
The *solution*, however, is probably found in the tips I suggested.

The tips offered target the possible causes for the same
code to work slower in IIS than in the ASP.NET Dev Server.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"John Rivers" <fi*****@btinternet.comwrote in message
news:2e**********************************@c58g2000 hsc.googlegroups.com...
1800 milliseconds is a very long time for a web response
anything longer than 100 milliseconds is bad news

profile your code using NProf or add some timing code - then you have
your answer

juan has highlighted some interesting points but playing with those
settings is just guesswork

find the problem - then fix it

IMO datasets should be avoided as they very inefficient

Jun 27 '08 #7
randomly changing settings in IIS till the problem stops = guessing

none of the things you mentioned would cause such a huge slow down

he does not know where the delay is EXACTLY

if he profiled or timed his code he could identify a method call where
a delay is caused
from there he could determine the actual cause of the delay

it is probably some nonsense concerning microsoft networking or
authentication or that pig Kerberos

combining the data from profiling his code with a sql profile he could
match up the timestamps and KNOW
for sure the delay occurs after the dataset is filled etc.

the real challenge in developing is not writing code - but debugging
and profiling it

use NProf - use SQL Profiler - use WireShark - use TDIMon etc. etc.
and you will find a real answer

plus you will learn the skills you need to debug ANYTHING

thrashing around in IIS settings like a wild bull in a china shop
hoping your problem will disappear is not the right approach
Jun 27 '08 #8
re:
!randomly changing settings in IIS till the problem stops = guessing
!none of the things you mentioned would cause such a huge slow down

For someone who has a grand total of 106 posts to
43 newsgroups, in the last 3 years, you sure are opinionated.

Can't you consider that you might, possibly,
not be as correct as you think you are ?

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"John Rivers" <fi*****@btinternet.comwrote in message
news:37**********************************@j22g2000 hsf.googlegroups.com...
randomly changing settings in IIS till the problem stops = guessing

none of the things you mentioned would cause such a huge slow down

he does not know where the delay is EXACTLY

if he profiled or timed his code he could identify a method call where
a delay is caused
from there he could determine the actual cause of the delay

it is probably some nonsense concerning microsoft networking or
authentication or that pig Kerberos

combining the data from profiling his code with a sql profile he could
match up the timestamps and KNOW
for sure the delay occurs after the dataset is filled etc.

the real challenge in developing is not writing code - but debugging
and profiling it

use NProf - use SQL Profiler - use WireShark - use TDIMon etc. etc.
and you will find a real answer

plus you will learn the skills you need to debug ANYTHING

thrashing around in IIS settings like a wild bull in a china shop
hoping your problem will disappear is not the right approach

Jun 27 '08 #9
"After all, the techniques I outlined have been *proven* to increase
throughput."
he does not have a "throughput" problem - he has a serious blocking
issue with one request
your tips are for increasing throughput of a busy web server

BTW those urls you provided are for books - not websites
All of which include the word "Beginning" in the title and I would not
buy or recommend

I do not need to provide URLs because I am not camping on this
newsgroup like I own it
handing out copy and paste responses which are mostly rubbish. You are
not helping anybody.

What actual commercial experience do you have?

I am only antagonistic towards you because you give bad information
and I doubt your skill, knowledge and experience.

Three years was the last time I visited this newsgroup and you were a
fool then - to quote you:
"If you intend to use IHttpHandlers for a web app, exactly how are you
going to do that without an ASPX page?"
you may as well have written "I do not know anything about ASP.NET"

In three years not much has improved - if you have time to write all
these posts and co-author books why have you not created some
demonstration websites - showing how it should be done?

Jun 27 '08 #10
re:
!You are not helping anybody

I have HUNDREDS of thank-you notes from grateful
programmers whom I have given very specific help.

You love to flame, huh ?

Talk to yourself from now on.

<plonk>

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"John Rivers" <fi*****@btinternet.comwrote in message
news:be**********************************@x35g2000 hsb.googlegroups.com...
"After all, the techniques I outlined have been *proven* to increase
throughput."
he does not have a "throughput" problem - he has a serious blocking
issue with one request
your tips are for increasing throughput of a busy web server

BTW those urls you provided are for books - not websites
All of which include the word "Beginning" in the title and I would not
buy or recommend

I do not need to provide URLs because I am not camping on this
newsgroup like I own it
handing out copy and paste responses which are mostly rubbish. You are
not helping anybody.

What actual commercial experience do you have?

I am only antagonistic towards you because you give bad information
and I doubt your skill, knowledge and experience.

Three years was the last time I visited this newsgroup and you were a
fool then - to quote you:
"If you intend to use IHttpHandlers for a web app, exactly how are you
going to do that without an ASPX page?"
you may as well have written "I do not know anything about ASP.NET"

In three years not much has improved - if you have time to write all
these posts and co-author books why have you not created some
demonstration websites - showing how it should be done?

Jun 27 '08 #11
- Juan says randomly change settings in IIS - you might get lucky
- John says use profiling and timers and debugging tools to determine
the EXACT cause of the issue and then resolve it
- Juan says because he has posted so many messages on the internet he
is qualified to say that John's approach should NOT be used

Here is another thank-you note from me "Thankyou for providing a few
moments amusement and making me feel superior"

When you get round to building something using ASP.NET please let me
know


Jun 27 '08 #12
I am not "flaming"

I am criticising you - with good reason

You have the opportunity to respond to the criticism and either:

- illustrate why I am wrong - and I will learn something
- or agree that I have a point - and you will learn something

But you have not done either - you have just run away

And this topic will be here for the next 10 years as proof of your
folly
Jun 27 '08 #13

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

Similar topics

7
by: qvx | last post by:
Hi all, I have a performance problem in my app. It is a poor man's version of OCR app. I started this app as a prototype before implementing it in C++. But now, after I have a working copy in...
10
by: AC Slater | last post by:
I have 1 table (out of many) that has very poor performance when performing a select into on. The select statement is called multiple times. We've found each call to take almost 1 second... we...
1
by: Evan Smith | last post by:
My database is suffering from poor performance of late. Reports that used to run in a reasonable time, now take a while. The explain output show that the query is fully indexed, and the statistics...
3
by: sac | last post by:
I am using DB2 v8.1 on UNIX. At times the database shows extremely poor performance. I do not have dba/admin rights nor do I have the web based client for db2 v8.1. I have only command line...
4
by: Bill Thorne | last post by:
We have a COM object that has been wrappered for use in .NET and which can make calls which can take a while to execute. These are mainframe integration calls that might perform a lot of data...
20
by: John Mark Howell | last post by:
I had a customer call about some C# code they had put together that was handling some large arrays. The performance was rather poor. The C# code runs in about 22 seconds and the equivalent...
4
by: Jim Devenish | last post by:
I have converted an Access back-end to SQL Server back-end but am having some problems. The Access to Access application has been running well for some years. I have successfully copied all the...
1
by: BAS | last post by:
Hi , Can anyone throw some light on this, We have test,dev and production environments with DB2 8.1 fix pack10 running on aix 5.3. Ours is an ERP finance application module, The reports which...
1
by: Billy | last post by:
Hi All, I'm attempting to use the MapNetworkDrive <snippedbelow from entire code below with very poor performance results. Basically, I have very small 73kb text files that are rewritten daily...
4
by: joa2212 | last post by:
Hello everybody, I'm posting this message because I'm quiet frustrated. We just bought a software from a small software vendor. In the beginning he hosted our application on a small server at...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...

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.