Performance and context switching

R

robm

Hi,

We have an ASP.NET 2 application that does some quite intensive work
in order to present data to the users. A particular function gathers
a lot of data from the database and as the objects are quite fine
grained it makes thousands of stored procedure calls. When under no
load the performance is fine, but when a few users use this at once
then the performance declines. With around 4 users executing this
intensive function at once, using performance monitor we see around
40% CPU usage but massive levels of context switching (~300 000/sec).
I understand that context switching increases with the number of
threads, but it doesn't seem to me that this web server is under
particular load (it's a fairly well spec'd server with dual-processor,
dual-core). If the CPU was maxed out I would just assume that the
server couldn't cope with the load that we are putting it under, but
it's not so it appears we are hitting some other server limit. Can
anyone give me any pointers about what could be causing such huge
context switching values?

Thanks,
Rob
 
B

bruce barker

every call to the o/s is a context switch. every i/o interrupt is a
context switch. as the database calls use the network, every packet is a
context switch.

most likely you are hitting blocking with database and thats your
limiting factor. you should not be doing 100's of sp calls per page
request, much less 1000's.

read the chapters on set operations and joins and try to get the sql
calls to 10 - 50 a page request.

-- bruce (sqlwork.com)
 
R

robm

@Bruce:Thanks for your reply. I'm working to reduce the stored
procedure calls so if this is the cause of the issue then I'm happy
with that.

Looking back through performance monitor logs though then the problem
(excessive context switching) and the perceived decrease in
performance did seem to get a lot worse after we carried out an
upgrade from .NET 1.1 to .NET 2.0; can anyone think of any plausible
explanation for this?

Thanks,

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top