[THIN] Re: Context Switches

  • From: "Pfeifer, Bruce A MSER:EX" <Bruce.A.Pfeifer@xxxxxxxxxxxxxxx>
  • To: "'thin@xxxxxxxxxxxxx'" <thin@xxxxxxxxxxxxx>
  • Date: Thu, 13 Mar 2003 13:12:48 -0800

We found that Pviewer.exe will display context switches based on the threads
of a process.

We traced our problem to termsrv.exe.  When termsrv.exe goes nuts with
context switches and hangs IMA, we were able to drop the context switches
back to normal by running the kill command agains termsrv.  Althogh termsrv
could not really be killed, the threads that were going nuts terminated.  
Our logged in users could continue to work but with IMA hung, the server
will not except new logins.  A reboot is still needed to get IMA working
again.  No fix yet but at least we are closer, we got some userdumps of
termsrv.exe when it is context switching at 120,000 and sent them to
Microsoft.  maybe they can come up with somthing for us..  BTW this is W2K
SP3 and MF XPE FR2 .

Bruce Pfeifer
Platform Infrastructure, Planning and Engineering
Common IT Services, Ministry of Management Services 
Province of British Columbia
Phone:  250-387-6869, Fax:  250-356-1960 
mailto:bruce.a.pfeifer@xxxxxxxxxxxxxxx
http://www.mser.gov.bc.ca



-----Original Message-----
From: Bernd Harzog [mailto:Bernd.Harzog@xxxxxxxxxxx]
Sent: Thursday, March 13, 2003 02:19 AM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: Context Switches



Neil (and Chad),

I spoke to Kevin Goodman about this (the person who founded our company
and who wrote TScale). He said that there is some debate about whether
the switch from user to kernel mode within a process triggers a context
switch - so Neil, you are probably right. He did offer one insight as to
what might be happening to cause the number to go through the roof. He
said that it is likely that two or more processes are competing for a
locked resource, and the CPU is simply continuously switching between
them to see which one gets the locked resource first. His suggestion as
to how to track this down is to do the following. Go into PerfMon and
look at the Process Performance Object. This object allows you to track
counters on a per process basis (per instance of a program running on
the server). Unfortunately, you cannot track context switches this way,
but you can track threads. So, his suggestion is to select Threads as
the object, and then to select all of the instances of the main
applications that are running (you are going to end up with 25 sets of
thread data if you have 25 users of an application).

The behavior that you ought to see is that when the context switch
problem occurs, a set of processes will drive the thread count counters
for themselves through the roof. Then you will know which set of
processes is causing the problem. Once you know that then you are going
to have to backtrack through the configuration of those applications on
your servers (and whatever else supports the client running on the
terminal servers), and possibly also backtrack into the source code (if
it is your application).

Hope this helps,

Bernd Harzog
CEO
RTO Software
678-455-5506 x701
bernd@xxxxxxxxxxx
www.rtosoft.com


 -----Original Message-----
From:   Braebaum, Neil [mailto:Neil.Braebaum@xxxxxxxxxxxxxxxxx]=20
Sent:   Thursday, March 13, 2003 4:35 AM
To:     'thin@xxxxxxxxxxxxx'
Subject:        [THIN] Re: Context Switches


Bernd - the "two kinds of context switches" - really equates to one.

It really is just the OS switching from a user mode to kernel mode for a
process. When this occurs between two (pseudo) concurrent sessions, you
have
to realise a certain degree of this is inevitable.

There is no discernable different in "types" of context switch, though.
Merely the cause.

If the OS switches / timeslices between user mode processes - you have
to
realise and accept that in doing so, some kernel process activity will
occur. And to be fair, some user mode activity may well produce or spawn
some kernel mode activity.

There is no true distinction in the type of context switch - so it's a
bit
unfair to say that MS don't differentiate or provide a mechanism to
measure
this - there is no true difference. What matters is the cause.

Neil

> -----Original Message-----
> From: Bernd Harzog [mailto:Bernd.Harzog@xxxxxxxxxxx]=20
> Sent: 12 March 2003 18:04
> To: thin@xxxxxxxxxxxxx
> Subject: [THIN] Re: Context Switches
>=20
> Let me add my two cents. There are as Ron said two kinds of=20
> context switches. One kind occurs when the processor switches=20
> between two user mode tasks. So, if Ron and I are both=20
> running an application on the same server when the CPU=20
> switches between doing work for Ron and work for me, that=20
> causes a context switch. That is a GOOD context switch,=20
> because it is indicative of the CPU doing what it is suppose=20
> to do, which is move so rapidly between doing work for=20
> different users that each user never notices. The second type=20
> of context switch occurs when the CPU goes from user mode to=20
> kernel mode, and then back again (two Context Switches).=20
> These are BAD context switches, because when the CPU goes=20
> into Kernel mode it blocks user mode operations and slows=20
> everything down.
>=20
> So, you need to find out what kind of context switches you=20
> are getting. Since MS does not do us the favor of breaking=20
> them out, the only way to find out is to look at other=20
> indicators of heavy Kernel Mode operations and see if they=20
> are pegged as well. Try looking at pages/sec and page=20
> faults/sec. If you see a heavy correlation between these and=20
> the context switches you may have an indicator that it is=20
> kernel mode related. If it is, call me, because I have=20
> something new that I cannot talk about on the list that we=20
> might want to discuss.
>=20
>  -----Original Message-----
> From:         Ron Oglesby [mailto:roglesby@xxxxxxxxxxxx]=3D20
> Sent: Wednesday, March 12, 2003 12:30 PM
> To:   thin@xxxxxxxxxxxxx
> Subject:      [THIN] Re: Context Switches
>=20
>=20
> Well context switches are really the processor switching=20
> between tasks or going between user mode and kernel mode tasks.
>=20
> A lot of time I think this can be due to the TYPE of=20
> application and what it does. I have a document=20
> imaging/managing software at a client that will get the=20
> context switches up in the 30 - 35,000 range with a low proc=20
> queue and proc utilization at about 60%. This software uses a=20
> tome of different types of databases (SQL, Oracle, and=20
> something else) as different backend servers and is a little=20
> graphic intense. The NICs, Memory, Disk, Proc all are still=20
> ok, but every time we get these things up to 30,000=20
> performance starts to degrade. Now of course this is 30,000=20
> steadily, not spikes. And only 27-30 users on DL 360 G2's Of=20
> course on the same hardware and builds I am hosting Office=20
> apps for like 50 and 60 users with context switches not a problem.
>=20
> Anyway, haven't found a relief for it yet. Hoping hyper=20
> threading has an effect on this.
>=20
> -----Original Message-----
> From: Schneider, Chad M. [mailto:CMSchneider@xxxxxxxxx]=3D3D20
> Sent: Wednesday, March 12, 2003 11:20 AM
> To: 'thin@xxxxxxxxxxxxx'
> Subject: [THIN] Re: Context Switches
>=20
> I know one really spiked, as the chart now shows the 125,000 marker.
>=20
> -----Original Message-----
> From: Ron Oglesby [mailto:roglesby@xxxxxxxxxxxx]
> Sent: Wednesday, March 12, 2003 11:02 AM
> To: thin@xxxxxxxxxxxxx
> Subject: [THIN] Re: Context Switches
>=20
> 100,000... Cooooool
>=20
> What type of hardware. DL 360s start to get slow at like 30,000
>=20
> -----Original Message-----
> From: Schneider, Chad M. [mailto:CMSchneider@xxxxxxxxx]=3D3D3D20
> Sent: Wednesday, March 12, 2003 10:50 AM
> To: 'thin@xxxxxxxxxxxxx'
> Subject: [THIN] Context Switches
>=20
> Any way to tell which app/apps are causing my large context=20
> switch usage?
>=20
> My servers run high all day, some spikes over 100,000.
>=20

***********************************************************************
This e-mail and its attachments are intended for the above named=20
recipient(s) only and are confidential and may be privileged.
If they have come to you in error you must take no action based=20
on them, nor must you copy or disclose them or any part of=20
their contents to any person or organisation; please notify the=20
sender immediately and delete this e-mail and its attachments from=20
your computer system.

Please note that Internet communications are not necessarily secure=20
and may be changed, intercepted or corrupted. We advise that=20
you understand and observe this lack of security when e-mailing us=20
and we will not accept any liability for any such changes,=20
interceptions or corruptions.=20

Although we have taken steps to ensure that this e-mail and its=20
attachments are free from any virus, we advise that in keeping=20
with good computing practice the recipient should ensure they=20
are actually virus free.

Copyright in this e-mail and attachments created by us belongs=20
to Littlewoods.=20

Littlewoods takes steps to prohibit the transmission of offensive,=20
obscene or discriminatory material.  If this message contains=20
inappropriate material please forward the e-mail intact to=20
postmaster@xxxxxxxxxxxxxxxxx and it will be investigated.=20
Statements and opinions contained in this e-mail may not=20
necessarily represent those of Littlewoods.

Please note that e-mail communication may be monitored.

Registered office:=20
Littlewoods Retail Limited,=20
Sir John Moores Building,=20
100 Old Hall Street,=20
Liverpool,
L70 1AB=20
Registered no: 421258=20

http://www.littlewoods.com=20
***********************************************************************
*********************************************************
This Week's Sponsor - RTO Software / TScale
TScale increases terminal server capacity.=20
Get 30-40% more users per server to save $$$ and time.=20
Add users now! - not more servers. If you're using Citrix,=20
you must learn about TScale!  Free 30-day eval:
http://www.rtosoft.com/Enter.asp?ID=3D79
**********************************************************

For Archives, to Unsubscribe, Subscribe or=20
set Digest or Vacation mode use the below link:
http://thethin.net/citrixlist.cfm


*********************************************************
This Week's Sponsor - RTO Software / TScale
TScale increases terminal server capacity. 
Get 30-40% more users per server to save $$$ and time. 
Add users now! - not more servers. If you're using Citrix, 
you must learn about TScale!  Free 30-day eval:
http://www.rtosoft.com/Enter.asp?ID=79
**********************************************************

For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thethin.net/citrixlist.cfm
*********************************************************
This Week's Sponsor - RTO Software / TScale
TScale increases terminal server capacity. 
Get 30-40% more users per server to save $$$ and time. 
Add users now! - not more servers. If you're using Citrix, 
you must learn about TScale!  Free 30-day eval:
http://www.rtosoft.com/Enter.asp?ID=79
**********************************************************

For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thethin.net/citrixlist.cfm

Other related posts: