SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Server Agent Powershell Subsystem with only 2 worker threads


SQL Server Agent Powershell Subsystem with only 2 worker threads

Author
Message
Alexander G.
Alexander G.
Old Hand
Old Hand (381 reputation)Old Hand (381 reputation)Old Hand (381 reputation)Old Hand (381 reputation)Old Hand (381 reputation)Old Hand (381 reputation)Old Hand (381 reputation)Old Hand (381 reputation)

Group: General Forum Members
Points: 381 Visits: 315
My Sql Server Agent can only run two powershell jobsteps at one time which apparently is caused by the max_worker_threads setting:

SELECT subsystem, max_worker_threads FROM msdb.dbo.syssubsystems

subsystem max_worker_threads
TSQL 240
ActiveScripting 120
CmdExec 120
Snapshot 1200
LogReader 300
Distribution 1200
Merge 1200
QueueReader 1200
ANALYSISQUERY 1200
ANALYSISCOMMAND 1200
SSIS 1200
PowerShell 2


Why are so little PowerShell threads allowed compared to other subsystems? Is it save to set the value to say 10?
MysteryJimbo
MysteryJimbo
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2225 Visits: 15344
No reason why you cant increase it.

I've got it increased to 1/4 of my available cores on all servers. I dont expect to ever use that many but it allows more flexibility.
Jeffrey.Simmons
Jeffrey.Simmons
Grasshopper
Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)

Group: General Forum Members
Points: 10 Visits: 366
I have been trying to change this in SQL 2012. Every time I change the value for PowerShell in the syssubsystems table when I restart the SQL agent it is set back to 2. SQL 2008R2 persisted this change. Anyone been able to change it in 2012?
bgreco
bgreco
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 285
I just noticed this 2008-2012 difference myself when looking at the max_worker_threads for the TSQL subsystem.

I think sp_verify_subsystems must run whenever SQL agent starts. In 2008, it only inserts into the syssubsystems table if there are entries missing, so your modifications persist across restarts. In 2012, it truncates the table and re-inserts every time!

All of the subsystems except Powershell are set to be multiples of the server's CPU count. The Powershell subsystem is hardcoded to 2, go figure. Hehe
trayalacheruvu
trayalacheruvu
Valued Member
Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)

Group: General Forum Members
Points: 69 Visits: 181
Hi Thanks for your feedback. On this i am having similar issue and i am trying change the CmdExec Worker thread value , but after restarting the SQL Agent the value is rolling back. As you said this CmdExec is multiplies of CPU. Can you please let me know what is digit we need multiply for this subsystem? do we have any documentation on this from MS?

Thanks for your reply in advance.

Regards,
Thulasi.
wannabe1
wannabe1
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 489
edit sp_verify_subsystems in msdb. This inserts the value to subsystems table by multiplying an arbitrary number to the no.of processors. you can manipulate this number to get the desired worker threads

For powershell, just change 2 to the number you want

INSERT syssubsystems
VALUES
(
12, N'PowerShell', 14698, @InstRootPath + N'SQLPOWERSHELLSS.DLL', @SQLPSPath, N'PowerShellStart',N'PowerShellEvent',N'PowerShellStop',2
)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search