locked
Poor FTP performance when sourcing files from network share RRS feed

  • Question

  • User1166740941 posted

    We have encountered a performance problem with the IIS FTP server when it is configured to source files from a network share and the FTP client is on a network with high latency.  This issue exists in both 2003/IIS6 and 2008/IIS7.

    The maximum amount of data sent by the server in a given TCP window is restricted by how the IIS server reads the source file on the CIFS share.

    When we configure the FTP server root as C:\Inetpub\ftproot, we get much higher transfer rates with the same network latency since we are able to fill the 64KB TCP window.  Simply changing the root of the FTP site to \\server\C$\inetpub\ftproot (share on the same computer!) kills performance.  Using a sniffer we see the server sends chunks less than 4KB when using the share.

    It seems like IIS uses a different buffer size depending on how the file is sourced (local vs. share).  This is a problem if the latency between the FTP client and server is high.

    Is there anyway we can tune the IIS FTP server to send larger chunks of files on a network share?

     

    Monday, February 16, 2009 4:21 PM

Answers

  • User1166740941 posted

    I finally got my support case escalated to an engineer that had the answer. 

    When the IIS FTP server sends a file, it passes this work down to Afd.sys (kernel-mode driver for winsock).

    There are registry settings that control the behavior of AFD:

    http://technet.microsoft.com/en-us/library/cc781532.aspx 

    In particular, TransmitIOLength is used when the file is cached, and LargeBufferSize is used when the file is not cached.  Adjusting the LargeBufferSize parameter resolved my issues with high latency FTP clients - In my experience the default value of 4K is way too small if you have anything over 50ms of latency. 


    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, April 1, 2009 10:31 AM

All replies

  • User1073881637 posted

    Did you try the FTP 7.0 service or the built-in FTP service?  BTW I've experienced the same thing and never found a workaround. 

    Monday, February 16, 2009 9:57 PM
  • User1166740941 posted

    I've tried FTP 7.0 on 2008 instead of the version that shipped with the OS.  It performed the same as IIS 6.0 on 2003.  I've also tried adjusting some LanmanWorkstation settings on the server, but I have not found anything that changes how IIS reads the files from the share. 

     

     

    Monday, February 16, 2009 11:40 PM
  • User1166740941 posted

     Some more info... After sniffing the server to network share traffic, It looks like IIS is buffering the FTP download when the file is on a network share.

    We are seeing SMB2 reads in 32KB blocks from the IIS server on the network share.  Then, the IIS server is only sending blocks around 4KB (Actually 3752 bytes) to the FTP client.  Another strange behavior is that IIS reads the 32KB from the storage in two requests - it requests 4KB and then immediately requests the remaining 28KB of the block.

    I would hope there is a reg key somewhere that controls the buffering used by IIS FTP when sending files from shared storage.  I'll probably open a support case with Microsoft soon unless someone knows how to change this behavior.

    Tuesday, February 17, 2009 2:19 PM
  • User1073881637 posted

    Sounds like you have some good info.  I would contact PSS.  I'm not aware of a 'magic' registry key.

    Tuesday, February 17, 2009 7:12 PM
  • User1166740941 posted

    I finally got my support case escalated to an engineer that had the answer. 

    When the IIS FTP server sends a file, it passes this work down to Afd.sys (kernel-mode driver for winsock).

    There are registry settings that control the behavior of AFD:

    http://technet.microsoft.com/en-us/library/cc781532.aspx 

    In particular, TransmitIOLength is used when the file is cached, and LargeBufferSize is used when the file is not cached.  Adjusting the LargeBufferSize parameter resolved my issues with high latency FTP clients - In my experience the default value of 4K is way too small if you have anything over 50ms of latency. 


    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, April 1, 2009 10:31 AM
  • User1073881637 posted

    Thanks for posting the fix and update.

    Friday, April 3, 2009 10:39 PM
  • User-1566626190 posted

    Thanks for posting this.  I'm curious what value you used for LargeBufferSize?  I know it could be different for different people, but just curious what most people use.

    Thanks

    Wednesday, May 25, 2011 6:09 PM
  • User919838419 posted
    On our Windows 2008 server SP2 these registry keys don't exist. We do have the exact same problem so I'm wondering if there's another way to change these afd.sys settings in 2008 server?
    Thursday, June 16, 2011 6:02 PM
  • User-1566626190 posted

    the key didn't exist for me either.  i had to create it and rebooted.  it worked fine afterwards.

    Thursday, June 16, 2011 6:25 PM
  • User919838419 posted
    Thanks for informing me about creating the key slhungry! I did the same and set the value to 32768 and after rebooting the download speed indeed trippled from 6 mbps to 18 mbps. What value did you use?
    Friday, June 17, 2011 5:12 AM