title: Start a process from WCF service - performance issue - CPU load multiplies
body: <p>I have a exe that process a document and generate another one from this. And i have a requeriment that need this process to be serve as a service, so i build a wcf service that internaly create a Process class to run this exe.</p>
  
  <p>This works fine, the documents are generaty correctly, but i noticed a performance issue.</p>
  
  <p>When a request come and the process is created, the cpu go this way:</p>
  
  <p>running 1 instance of the process (cpu 50%)
   ->> http:// i.stack.imgur.com/Y04qZ.png
  , running 2 instance of the process (cpu 100%)
  - >> http:// i.stack.imgur.com/ltuNw.png
  , running 4 instance of the process (cpu 100% more time)
  - >> http:// i.stack.imgur.com/V8v4v.png</p>
  
  <p>and when i start the same process from CMD, the CPU go this way running 4 instances (cpu low%)</p>
  
  <p>->> http:// i.stack.imgur.com/cLIZm.png</p>
  
  <p>the way im starting this process is this:</p>
  
  <pre><code>ProcessStartInfo startInfo = new ProcessStartInfo();
          startInfo.UseShellExecute = false;
          startInfo.FileName = @rutaExe;
          startInfo.RedirectStandardOutput = true;
          startInfo.RedirectStandardError = true;
          startInfo.Arguments = String.Format(" -subject {0} -file {1}",
              request.asunto,
              Path.Combine(rutaTemp, request.archivo_firmado));
  
  using (Process exeProcess = new Process { StartInfo = startInfo })
              {
                  exeProcess.OutputDataReceived += (sender, e) =&gt;
                  {
                      output = output + e.Data;
                  };
                  exeProcess.ErrorDataReceived += (sender, e) =&gt;
                  {
                      err = err + e.Data;
                  };
                  exeProcess.Start();
                  exeProcess.BeginOutputReadLine();
                  exeProcess.BeginErrorReadLine();
                  exeProcess.WaitForExit(1000 * 6 * 15);
              }
  </code></pre>
  
  <p>Extra info, i noticed that the EXE internally calls the java runtime.</p>
  
  <p>Is there a way this scenary can improve performance? </p>