title: ASP.NET Large Number Of Concurrent Downloads
body: <p>I currently have a web application online which has around 500 users. What i was not expecting was that the web app is performing horrible under such a load. Visiting any page results in minutes of waiting. Basically each user once he uses the web application main feature is invoking a process where i read a few bytes from another web server and then forward that data to the users browser. The page is performing normally until it reaches a certain load of of around 200-300 concurrent download processes as described earlier. </p>
  
  <p>I am using IIS 7.5 and ASP.NET (4). For database access i use LINQ TO SQL. I already tweaked IIS and removed any restrictions like max concurrent per cpu etc. I lost my hope that the IIS configuration is problematic in this case. What i fear is that my code produces such results for IIS or that even such a approach is the main cause of this issue.</p>
  
  <p>Currently it works the following way:</p>
  
  <ul>
  <li><p>User visits EG.aspx</p></li>
  <li><p>EG.aspx uses .NET HTTP Post and GET requests to authorize to another web server.</p></li>
  <li><p>EG.aspx opens a stream to read from the second web server (file download)</p></li>
  <li><p>EG.aspx reads 1024 bytes from the second web server and write those 1024 bytes to the browser</p></li>
  </ul>
  
  <p>All headers etc. are properly set. I am not invoking any new threads during this process. It's just a long method performing all those steps. The file downloads are pretty large (around 100MB). During all that time it takes to transfer such a file to the user the page is running the mentioned process. Each user can invoke this process multiple times (download multiple files).</p>
  
  <p>Are the number of streams a issue? Is there any way i could achieve the same results (your web server downloads files and sends it to the client without caching them on disk) with another approach? What would be that approach?</p>