Saturday, April 3, 2010

Please Wait Local Session Manager problem mitigation

EDIT 5-9-2010: MS has a hotfix that seems to address this.

Cross-posted

Hey, I've been running into the LSM issue on a 2008 32-bit Terminal Server for a few months now. I've been able to tie it down to either a high volume of handles (usually excess of 100K), competition of programs with Local Session Manager for CPU resources, or too many running processes (300-400). Mitigation strategies....

1. Disabled Windows Indexing service: this recovered 20-40K handles in itself.
2. Something I found today: a CPU load balancer that resets affinity on processes to individual CPUs. Running every 5 minutes.

BRELS CPU Balancer

3. The programs I run as login applications: I encapsulate them in a Ruby script that checks the user name & computer name against a text file; if there is a match, future login attempts fail; the file is cleared every 10 minutes by a scheduled task.
---- The following is a version of my script that calls a simple IE browser ----

# User throttle
# Michael Adams, unquietwiki.com, 2010

# Working class
class Working

 # Initialization
 def initialize(userlist)
  require 'CSV'
  @client_cpu = ENV['CLIENTNAME']
  @client_user = ENV['USERNAME']
  @userlist = userlist
 end
 
 # See if in userlist.txt
 def in_userlist
  found = false
  if File.exist?(@userlist)
   users = CSV.read(@userlist)
   users.each do |user|
    if(user[0] == @client_cpu)
     if (user[1] == @client_user)
     found = true
     end
    end
   end
  end
  return found
 end

 # Add to userlist.txt
 def add_userlist
  CSV.open(@userlist,'a') do |users|
  users << [@client_cpu,@client_user]
  end
 end
 
 # Del from userlist.txt
 def del_userlist
  begin
  oldusers = CSV.read(@userlist)
  CSV.open(@userlist,'w') do |newusers|
   oldusers.each do |user|
    if (user[0][0] == @client_cpu)
     if (user[0][1] == @client_user)
     else
      newusers << user
     end
    end
   end
  end
  rescue
  end
 end

 # Run program + variable
 def throttle(site)
  if in_userlist == false
   add_userlist
   system('dummie.exe '+site)
   del_userlist
  end
 end
end

# Check for aguments: quit if none
if ARGV.length < 2 then
 puts "Synatx: throttle.rb userfile site"
else 
 process = Working.new(ARGV[0])
 process.throttle(ARGV[1])
end

No comments:

Post a Comment