Is there a registry setting or something to limit the number of individual services that are run within a single svchost
process?
I'm aware of the WIN32_SHARE_PROCESS
flag and the sc
app's ability to make individual services run in their own process, but I don't want the overhead of a process for each of the dozens of services. Ideally I would like to see the 30 services from Automatic Updates through Workstation that are currently hosted by a single process be shared among 3 to 5 processes.
-
You can control which services get bundled together into a single svchost process by modifying the Registry entries at
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/SvcHost
. You'll be modifying the values, each of which contains a list of the services that run within it (e.g. netsvcs).There's a bit more information about this out there, much of it related to the Conficker worm and cleaning up after it. This is based on research related to a situation where I had to manually clean out traces of some malware services.
Update with additional resources/information: There's not a lot of information out there and I haven't experimented with this yet, but the most useful information I found earlier while researching was:
- Separating SvcHost Services (sort of a howto),
- Description of Windows service wrappers which covers svchost.exe plus services.exe, dllhost.exe, lsass.exe, srvany.exe and has links to quite a few resources and further information, and
- Help with svchost.exe (Windows Update/wuauclt.exe) (possibly the whole thread, page 3 is where it gets relevant)
Tim Sylvester : I saw a reference to that path in a MS KB article (#314056), but I got the impression that I can't just change those values. For example, the `netsvcs` group has server, workstation, etc., in it, and if you look at the service descriptors for those services in `System\CurrentControlSet\Services`, they reference `netsvcs` in their `ImagePath` setting. Is it safe to re-arrange the groups as long as I update the `ImagePath` for all the services that are moved?fencepost : Post revised with additional resources including ones with step-by-step of changes needed.Tim Sylvester : That first link is just what I was looking for. Thanks!From fencepost -
You won't notice any improvement in performance by doing this...
If you want to start some services on demand, set them to Manual start and Windows will start the service when it is trying to be accessed.
If you want visibility into what service is causing a performance issue try launching a command prompt and using this command:
C:\>tasklist /svc /FI "IMAGENAME eq svchost.exe"
That will show you all svchost.exe instances, which services are running in each process, and the PID (process ID).
Once you know the PID you can launch Task Manager
(Ctrl+Alt+Del)
and in theProcesses
tab go toView > Select Columns...
and chose to show PIDs.Then you'll know which svchost.exe is causing your performance issue, and you can cross reference the PID to your list of services running in that instance of svchost.exe.
Hope this helps address the underlying reason for your question.
Tim Sylvester : I'm aware that running more hosts will actually *reduce* performance slightly since those services can no longer share resources. I want to be able to dynamically reduce the priority of processes that are using a lot of CPU without affecting nearly all the services at once, but I was also trying to find a balance between that and having every service use its own process. For a one-time analysis I would use the script from http://serverfault.com/questions/12278 to set them all to "own" and set them all back to shared when I found the problem, but I'm looking for something more dynamic.Garrett : SC ConfigType=own You can set them all to own, find your culprits, and then set everything back to share, except the culprits? From Garrett
0 comments:
Post a Comment