0

I am amazed with the speed differences between when you place the file in Content folder and let user download it, and when you send the file.

This result in 100KB/s in my dedicated server with 2 open section

public FilePathResult GetFile()
{
return File("c:\\a.pdf", "application/octet-stream");
}

When I play the same file in "WebRoot\Content\a.pdf" and download it, it is capable to open 10 sections and the speed is 1000KB/s. This is 10 times faster.

Can anybody indicate how to send a file to a user with max speed?

I tried various methods, like:

  1. The one above (return File)
  2. Using Response.Write using loop and buffer and detecting HTTP Header that request partial content
  3. The FDM (Free Download Manager) software also by default opens around only 3 sections. But the download manager acts strange when the file is served via "Content/" folder which is capable to open 10 sections with no configuration changes.
tereško
  • 58,060
  • 25
  • 98
  • 150
Bla Anima
  • 29
  • 5
  • Have you seen this: http://stackoverflow.com/questions/5826649/returning-a-file-to-view-download-in-mvc I'm not sure why it's throttled though; may be processing done on the server end? – Brad Christie Aug 18 '13 at 17:56
  • i read that questions, it is not helping. I am wondering can anybody explain this? No answer so far? While so many website out here provide high speed download via linux, Microsoft product can't even solve this simple problems? I am really desperate for answer – Bla Anima Aug 19 '13 at 13:42
  • To be clear: Files outside of the site path are being throttled, but not those inside--correct? And you don't have [bit throttling](http://www.iis.net/downloads/microsoft/bit-rate-throttling) on the server, right? – Brad Christie Aug 19 '13 at 13:45
  • Yes correct. And I don't have bit throttling. – Bla Anima Aug 20 '13 at 03:36

1 Answers1

-1

I finally found the answer, and this is related to the ProcessModel of ASP.NET

Allow me to show you how to maximize the potential of your server which Microsoft limited you by default. You don't need to pay more to upgrade to managed dedicated server or hire microsoft professional to configure your web server for high speed, because i am telling you the secret in this post.

OPTIMIZE YOUR SERVER SENDING FILE SPEED

  1. Optimize Worker Threads, Application Web.config
   <system.web>
   <processModel maxWorkerThreads="1000" maxIoThreads="1000" minWorkerThreads="10" minIoThreads="10"/>
   </system.web>
  1. Set C:\Windows\Microsoft.NET\Framework and C:\Windows\Microsoft.NET\Framework64 file ASPNet.config
<configuration>
    <system.web>
    <applicationPool 
        maxConcurrentRequestsPerCPU="5000"
        maxConcurrentThreadsPerCPU="0" 
        requestQueueLimit="5000" />
    </system.web>  
</configuration>
  1. Configure in IIS, Max Worker Processes : 20 (in the application pool)

  2. Configure Machine.config in C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config and C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config

    search for ProcessModel, and change MachineOnly to MachineToApplication

<section name="processModel" type="System.Web.Configuration.ProcessModelSection, System.Web,

Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineOnly" allowLocation="false" />

to
<section name="processModel" type="System.Web.Configuration.ProcessModelSection, System.Web,

Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication" allowLocation="false" />

  1. You must restart the application pool to take effect

Once the IIS has full power, it will send file to for user downloading in high speed, which my user get the highest speed he can get with his ISP package. By default Microsoft limit the potential of your server because they assume your server is intel atom.

Thank you

Bla Anima
  • 29
  • 5