0

a long used software deployed on many servers has on a new installation an issue. It seems linked to Windows 2016 Server, but we are not sure. Parts of a software often calls a ManualResetEvent like : _exitRequestEvent.WaitOne(1, false); Unfortunateley on the Server System it takes 15 times longer than on the developer notebook. We updated dotnet Framework, installed additionally SDK, and at last the Visual Studio to eliminate differences between the developer notebooks and the Server. No change. Also Calls to Monitor.Wait seems to be a lot slower. Does anyone have a similiar experience?

TargetFramework is 4.6.2

Thanks for hints, Frank

abrams
  • 38
  • 4
  • 1
    How long that takes entirely depends on how many active threads compete for service. That will typically always be a lot more on a server than on a notebook. Unless you can dedicate a server to running just your program, it isn't unusual to do so given adequate amounts of dollars. – Hans Passant Nov 14 '19 at 15:40
  • 1
    Can you define "15 times longer" in actual time? Calling `_exitRequestEvent.WaitOne(1, false);` will wait until either the `ManualResetEvent` is signalled (by another part of your code calling `_exitRequestEvent.Set()`), or for 1 millisecond, whichever comes first. So are you saying it takes 15ms? – Gabriel Luci Nov 14 '19 at 15:41
  • @GabrielLuci Yes, in fact on my (and 2 other) machine it runs slightly above 1ms, on different the server with 2016 it is above 15ms. We had an 2012 Server wich was faster, but I did not get the benchmark results. – abrams Nov 14 '19 at 16:05
  • @HansPassant I was able to reproduce it an a fresh installed server with "only" an SQL server additionally on it. On my Laptop the software ran under visual studio in debug mode beside office, outlook, teams and browsers. I assume the number of threads on my laptop were many more than on the server where the benchmark ran. The Thread behavior itself was simple, two threads in one process. – abrams Nov 14 '19 at 16:09
  • 1
    Answer here may be relevant: https://stackoverflow.com/a/3961849/224370 – Ian Mercer Nov 14 '19 at 17:02
  • @ianmercer thanks a lot, I think this is a good point ! I will investigate a bit more in that direction. – abrams Nov 14 '19 at 18:14
  • Checked again @IanMercer note, following code: `while (true) { int start = Environment.TickCount; System.Threading.Thread.Sleep(2); int result = Environment.TickCount - a; }` showst on my laptop often 0 sometimes 15, on the Server everytime 15, sometimes more. For me it looks like the smallest scheduler time on the server is 15ms. – abrams Nov 15 '19 at 06:20

0 Answers0