I'm using winrs
to run a test client against some server software that I'm developing. I'm using the client to generate load on the server under test for profiling. Both the machine that I'm running the server software and winrs
on and the machine that I'm running the test client on (using winrs
on the first machine to run it) are Win7 boxes, x64, lots of memory. All processes are run as admin.
When I run the test client by hand it can generate 6000 concurrent connections and saturate a 100mb link (the machines in question have Gb networking so I'm only loading the link between them to around 10%) When I run it via winrs
around half of the connections fail with what seems to be memory related errors in OpenSSL.
I'm sure there's something odd going on in my test client, BUT it would be useful to know what, if any, restrictions might be in place on processes that winrm runs on behalf of a request from winrs. I haven't been able to find any docs which suggest that there are restrictions, but I may not be looking hard enough.
Update: Having thought about this some more it seems that it's likely that the processes are being run under a job object with a memory limit in place, this kinda makes sense, but I would assume that if this were the case that it would be something that could be configured on the server side...
Yes, it is configurable. From the command line this would set the limit to 500MB
winrm set winrm/config/winrs @{MaxMemoryPerShellMB="500"}
search msdn docs on "winrm configuration" for more info.
Well, it seems that I'm right. Commands executed by Winrs are run inside of a job object and the job object is restricted.
Here's what a simple program to dump these job restrictions says about a process being executed on one of my Windows 7 boxes.
The limits that were causing me problems are the bottom two. The memory limits. I still don't know if these are configurable per machine or per user or at all...
The good news is that the job has
JOB_OBJECT_LIMIT_BREAKAWAY_OK
set which means that I can simply write a program launcher that I run via Winrs which itself runs the actual target command and launches the new process with theCREATE_BREAKAWAY_FROM_JOB
flag. This causes my real target process to run outside of the WinRs job restrictions.