Increase the concurrent connections limit for IIS FTP site if you see server reset

If you have a FTP site hosted on IIS which receives a burst of client connections at specific intervals and you see the connections getting reset from server-end please read on.

Let's say you have over 1500 concurrent FTP client connections being made at every 'n' minute you may see that the IIS FTP server is resetting many of those client connections. From a FTP client (the typical ftp.exe from the command prompt) you may see the following:

"Connection closed by remote host"

At other times when there is less load on the server things will look good.

Capturing a network trace may show you that a 3-way handshake between the client and the server is taking place and after that server resets the connection. You don't even get to a point wherein you can enter your credentials to access the FTP site. FTP site's maximum concurrent connections property (MaxConnections) is well above this value.

If you are in a similar scenario wherein a sudden bursts of concurrent client connections is leading to the FTP server resetting the requests you may want to play with some combinations of the settings mentioned below. It may be that you are hitting some connection limit for your server. It may not be the total number of connections being made but the total number of simultaneous connections that is causing the problem.

You will have to play with the following settings on the IIS 6.0 server:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InetInfo\Parameters
ListenBacklog = xxx (Range: 1 -250, Default: 25)
MaxPoolThreads = xx (Range: 0 - 4,294,967,295 (unlimited), Default: 4)
DisableBacklogMonitor=1

And in the metabase, under /LM/MSFTPSVC/
    ServerListenBacklog=”xxx”

* The ServerListenBacklog property specifies the number of outstanding sockets that can be queued. The value is based on the AcceptEx operating system parameter, and the server size specified in the ServerSize property. Valid values for this property range from 5 to 500.

Reset IIS after making the above changes.

See this link for more details on the Global registry entries for IIS 6.0.   

The ListenBacklog setting in the registry controls how many active connections are queued by winsock if IIS is unable to service new requests.  ServerListenBacklog is used by IIS to proactively create sockets to handle incoming requests. This setting adjusts the number of outstanding sockets that your Web server can queue. Setting ServerListenBacklog to a higher value allows IIS to handle a larger number of requests, while ListenBacklog helps the system buffer the connection spikes if the number of new connections briefly exceeds what IIS can service immediately.

Although the range for ListenBacklog  & ServerListenBacklog is given I had seen a scenario wherein we had to adjust the value to a higher number than the given range. You may need to tweak the combination yourself!

*I give credit to Rob Patrick from PSS IIS Escalation team for this post