Slashdot Mirror


Setting CPU Priority on NT/Citrix?

Broue Master asks: "I was recently faced with the task of finding a way to prevent some users from taking 100% cpu time in Citrix. I'm no MS certified anything (but I am a Citrix certified admin) and I couldn't find a built in way to do this. After someone on the NTSysAdmin List suggested trying to set the CPU priority to low from the command line, I investigated and found a small freeware that did the trick: PrioSet. I don't have a big user base: 3 power users (who are my problem with their Access and Excel use) and 10 regular users (and the people most affected by the problem). I'd like to know if any of you have previously tried this software, or if you've run into the particular problem when one user is getting 99% of the CPU for a long time while all other users only share the spare 1%. Did the software solve the problem or did you solve the situation by other means?"

23 of 48 comments (clear)

  1. i thought it said 'selling CPU time.... by avi33 · · Score: 2, Interesting

    ...like the old days...

    Though if you could find a way to do that, you might be able to convince your 'power users' to mind their manners. How about a contest every week...whoever uses the least CPU gets free beer?

  2. command line by sql*kitten · · Score: 3, Informative

    After someone on the NTSysAdmin List suggested trying to set the CPU priority to low from the command line, I investigated and found a small freeware that did the trick: PrioSet.

    Type start /? into the prompt - it can start processes at different priorities. So you can replace direct shortcuts to your applications with .bat files that in fact start the application at a different priority.

    1. Re:command line by Henry+V+.009 · · Score: 2

      Okay. But what I really want to know is how to throttle off those old DOS games without running a program that simply works by using up the rest of the computers processing power.

    2. Re:command line by delus10n0 · · Score: 2
      --
      Not All Who Wander Are Lost
  3. Easy by duffbeer703 · · Score: 3, Informative

    Change the shortcut that users launch Access & Excel with to point a CMD, shell or Perl script that launches Access or Excel, then sets drops the priority. It's pretty easy to use Perl to launch and control office applications.

    Another route may be to move the access database to an RDBMS, which may use less CPU horsepower than using Access as a client/server.

    --
    Conformity is the jailer of freedom and enemy of growth. -JFK
  4. archeology by NeoEinstein · · Score: 2, Funny

    NT on Citrix ? Wow, that's an archeological found :D !

    just kiddin'

    --
    n-e
  5. Might not apply, but by Asprin · · Score: 4, Informative


    If the problem is 16 bit DOS apps, Tame can help.

    Also, when you installed Office, did you run the appropriate app-tuning script afterward? (Search in x:\wtsrv for *.cmd and you'll find a whole bunch of them.) These scripts can make a big difference with certain versions of Windows.

    You might also try the MetaFrame Installation and Tuning Tips. You might find a more recent version if you dig around.

    --
    "Lawyers are for sucks."
    - Doug McKenzie
    1. Re:Might not apply, but by Asprin · · Score: 2


      I used X: as a variable since I don't know on which drive his %systemroot% folder is located. Citrix allows you to remap the local drive letters (C, D, E, etc.) on installation to something that won't conflict with the client PC's (M, N, O, etc.). This is taught in the Citrix cert classes, so he'll be aware of it.

      I guess on second thought, I should have sent him to search %systemroot% and avoided the issue, but I haven't managed a Citrix network in a few months, so I'm a bit rusty.

      --
      "Lawyers are for sucks."
      - Doug McKenzie
    2. Re:Might not apply, but by Frank+T.+Lofaro+Jr. · · Score: 2

      No one uses 16 bit apps anymore. This is 2003, for cryin out loud!

      --
      Just because it CAN be done, doesn't mean it should!
    3. Re:Might not apply, but by Asprin · · Score: 2


      Uhh, yes they do, just not the kinda of apps *everyone* uses.

      Thankfully, they are in fact dying off, however slowly.

      --
      "Lawyers are for sucks."
      - Doug McKenzie
  6. why are you asking this here? by kevin+lyda · · Score: 4, Insightful

    ask microsoft or citrix. go buy their books or their cdrom reference libraries.

    you paid for licenses and support, now go get your money's worth. why are you asking a bunch of (mainly) free software people who probably don't know the best answer?

    and if you think we do, why don't you use the software we use?

    --
    US Citizen living abroad? Register to vote!
    1. Re:why are you asking this here? by bofkentucky · · Score: 2, Funny

      Perhaps he is one of those "software pirates" we keep hearing about?

      --
      09f911029d74e35bd84156c5635688c0
  7. Throttle the processes programmatically by m8pple · · Score: 2, Informative
    If you have a bit of C knowledge then you could write something to throttle the processes back via API calls. Simplest would be to find all the access processes (via toolhelp), then every once in a while enumerate all the threads in each process and suspend them for a fraction of a second (SuspendThread/ResumeThread).

    As long as the suspensions are done quick and often there is usually no visible difference, except that the process takes a lower percentage of cpu time. Admittedly I've only used this sytem before to make processes self throttling, but there is no reason why it shouldn't work for third party processes.

    Obviously it would take a bit of tuning to get right, particularly if the access processes aren't competing with anything else most of the time, but it shouldn't take more than a hundred lines of code.

    Erm, yeah, or you could just run them at a lower priority.

    1. Re:Throttle the processes programmatically by borgboy · · Score: 4, Informative

      Actually, if he's running Win2k server, he can use the Job Object API
      This API allows you to set per-process limits on cpu, memory, user mode execution time, min/max working set, processor affinity, thread priority, UI restrictions, and security restrictions.
      I believe that Win2k Datacenter Server comes with a Job Object MMC for creating Job Objects / adding processes to a Job Object.

      --
      meh.
    2. Re:Throttle the processes programmatically by m8pple · · Score: 2, Informative
      Yeah, I though about mentioning it, but it seems like he's tied to NT. I'm using them for the same thing that I used to use the manual throttling for, and they are great, particularly when spawning lots of third party tools like compilers.

      AFAIK they work on any W2k or higher machine, but I could be wrong; I don't think I use any machines that aren't server (rather than pro) for my stuff.

    3. Re:Throttle the processes programmatically by borgboy · · Score: 2, Informative

      Yeah. According to the API docs, it works on W2k any edition, XP Pro and .Net Server. No go for NT, but I feel sorry for anyone still working in NT anyways.

      --
      meh.
  8. A similar problem by Kj0n · · Score: 4, Interesting

    I once heard of a similar problem with a NT server running Terminal Server and several users accessing it from a UNIX machine. The CPU usage of Excel would suddenly go to 100% and stay there.

    Apparently, users used Shift + arrow key to switch to another virtual desktop. Unfortunately Excel went into a busy loop after the Shift key was pressed (it was busy waiting for the next key) and stayed there until the user switched back to the Terminal Server window. This resulted in Excel taking the entire CPU.

  9. Not the answer you are looking for by iangoldby · · Score: 2

    I know this is not the answer you are looking for, but wouldn't it just be so much easier to let the three power users run Excel locally on their own PCs rather than on the server? They are probably already using 800MHz+ PCs as the 'thin clients' - that is more than adequate for most Excel tasks.

    Unless they really need to jump from desk to desk, I'm sure they'd get much better performance, and the other users would be happier too.

    1. Re:Not the answer you are looking for by larien · · Score: 2
      Some thin clients really are just that; "toasters" with little/no CPU power.

      There's also the issue about licenses; while there may be licences for the server, buying licenses for all the clients might be expensive.

    2. Re:Not the answer you are looking for by digidave · · Score: 2

      I'm pretty sure that with Citrix all the clients need software licenses as well. At least I think they do for MS apps. This should mean that there will be no licensing problems, assuming that the licenses used with Citrix can be used as local installations.

      --
      The global economy is a great thing until you feel it locally.
  10. Re:ulimit? jeez by larien · · Score: 3, Informative
    Ulimit isn't the same thing; ulimit limits on total CPU time, not % CPU at any given time.

    Thus, if they run an app for some time (e.g. over a few days) they might run up 30 minutes total CPU time with no real problems. On the other hand, someone could start an app, peg it at 99% for 10 minutes and completely hammer the server.

    Operating systems like Solaris have add-ons to achieve system limits like CPU allocations to individual users/groups, but that is NOT ulimit.

  11. Re:ulimit? jeez by photon317 · · Score: 2


    Fair enough. I was quick to reply, and ulimit cpu limits aren't quite what the guy is looking for. I bet if there was sufficient demand for such a thing, this could be hacked in as another setrlimit (ulimit) value with minimal effort.

    Just to continue being a "12 year old microsoft basher" as the AC response put it: Maybe we haven't seen a need in unix because schedulers work better there, and apps are better behaved?

    --
    11*43+456^2
  12. Re:ulimit? jeez by larien · · Score: 2

    Like I said, you can get similar things and Sun sell some resource management software which is used to guarantee that users/groups get a specified amount of CPU time. In short, there can be a need in Unix, although the schedulers do tend to work a little better.