title: How to scale an application with 50000 Simultaneous Tasks
body: <p>I am working on a project which needs to be able to run (for example) 50,000 tasks simultaneously. Each task will run at some frequency (say 5 minutes) and will be either a url ping or an HTTP GET request. My initial plan was to create thread for each task. I ran a basic test to see if this was possible given available system resources. I ran the following code as a console app:</p>
  <pre><code>public class Program
  {
      public static void Test1()
      {
          Thread.Sleep(1000000);
      }
  
      public static void Main(string[] args)
      {
          for(int i = 0; i &lt; 50000; i++)
          {
              Thread t = new Thread(new ThreadStart(Test1));
              t.Start();
              Console.WriteLine(i);
          }
      }
  }
  </code></pre>
  <p>Unfortunately, though it started very fast, at the 2000 thread mark, the performance was greatly decreased. By 5000, I could count faster than the program could create threads. This makes getting to 50000 seem like it wouldn't be exactly possible. Am I on the right track or should I try something else? Thanks</p>