0

I have a signalr server which is hosted in IIS. There is a function in the hub which starts 600 processes in windows and then kills them.

    //start 600 processes
        for (int i = 0; i < 600; i++)
        {
            try
            {
                Process myProcess = Process.Start(startInfo);
                proclist.Add(myProcess);
                Task.Delay(10).Wait();
            }
            catch(Exception e)
            {
                 feedback = "Process " + i + " cannot be started: " + e.Message;
                 break;
            }
            feedback = "All processes are running.";
        }
        //kill them
        foreach (var proc in proclist)
        {
            try
            {
                proc.Kill();
                Task.Delay(10).Wait();
            }
            catch (Exception e)
            {
                feedback = "Process " + proclist.IndexOf(proc) + " cannot be killed: " + e.Message;
                break;
            }
            feedback = "All Processes are killed.";
        }

However, when I call this function in Client I get an Exception whiling killing the processes:

Process 104 cannot be killed: Die Anforderung kann nicht verarbeitet werden, da der Prozess beendet wurde(The request cannot be proceeded, because the process is already terminated.)

It seems that I can only keep 104 processes runing. And the rest of them terminate immediately after start.

  • I tried the same thing in a Console Application, and all processes can be started and killed.
  • I tried to consume a lot of memory using another application and I could also keep 104 processes running.
  • I tried to consume a lot of memory using another application and I could also keep 104 processes running.
  • I also checked all possible IIS configuration and I could not find any settings which is related to this issue.

So I would like to ask whether anyone knows how to start more procecces in an ASP.NET application.

I will appreciate it very much if someone can help me. Thanks!

F.Gu
  • 3
  • 1
  • 2
    Why do you need to start 600 processes? This does not sound like a good idea to be honest. – Jason Evans May 10 '16 at 12:23
  • @JasonEvans , I am currently implementing a lasttest tool for a large server. This server will create a process for each user who is connected to it. I tried to generate 200 virtuell users in the lasttest tool and only around 60 can work properly. I then traced the beaviour of the server and doubted that some processes are not runnung. This is the reason why I implemented this small test server and started 600 processes in it. – F.Gu May 10 '16 at 12:51

1 Answers1

0

I strongly suggest you do not execute 600 (or any multiple of hundred) processes under ASP.NET. You will really strain the resources on the Aspnet_wp.exe process which could hurt the performance of the IIS box.

You need to re-think the design.

If this was me, I would consider creating an external process outside of ASP.NET which could do the hard work for you. For example, maybe you can create a Windows service (or even just a .NET console application running on the server) that waits (i.e. listens) on a file system folder for a file (you can name the file anything you like e.g. start.txt) to be created which you could do when a request to your website is made. That service will then execute the 600 exe files for you.

I'm not familiar with lasttest, so my suggestion might not be adequate. However, I do not believe you will achieve what you are looking for using your current design. It's going to hurt performance, and in fact, I'm not suprised that a limit of running processes has been reached. I do not know of any documentation that points to how many exe files you can run in Aspnet_wp.exe, but that's likely because the ASP.NET team never expected anyone to attempt this.

Jason Evans
  • 28,906
  • 14
  • 90
  • 154
  • Thanks for the relply! Your suggestment is very helpful! With "Lasttest" I meant actually "Stresstest". I just talked to my chef about this and they will improve the Server later. We tried out many possible tricks these days, and the conclution we have so far is that each application pool in IIS can start maximal 104 processes(at least in Windows 7 and windows server 2008r2-64bit ). – F.Gu May 12 '16 at 10:09
  • I'm glad that my answer provided some value to you. Also thanks for the detail about running 104 processes in an app pool. I've learned something new myself :) – Jason Evans May 12 '16 at 11:58