title: TFS Performance is slow
body: <p>I'm having issues with self hosted TFS environment in where the performing any action in Visual Studio or the Web Portal can take upwards of 20 to 30 seconds to complete.  The issue is intermittent and other developers are seeing the same symptoms.  Tracing the slow requests with Wireshark shows 3 REST requests to the TFS Server interface with first two requests returning with a 401 response and the third returning a 200 response.  </p>
  
  <p>The difference in the requests seem to be the authentication. The first request appends no explicit authentication method to the POST and returns a standard 401 response. The second request appends NTLMSSP_NEGOTIATE and fails with a 401 NTLMSSP_CHALLENGE response.  The third request appends NTLMSSP_AUTH to the request and passes in my AD user name and response with a standard 200.</p>
  
  <p>Symptoms:</p>
  
  <ul>
  <li>First two requests return a 401 failure</li>
  <li>Time between the requests seems to vary from a few ms to up to thirty seconds and the time between request and response is less than 100ms</li>
  <li>Connecting to TFS within the cloud environment being logged in as the same AD account that is connecting to TFS does yield display the same intermittent issue.</li>
  </ul>
  
  <p>Environment:</p>
  
  <ul>
  <li>Development systems are connecting over a VPN to a cloud environment</li>
  <li>TFS accounts are AD based with AD servers existing in the same cloud environment as TFS</li>
  <li>Development systems are joined to a different AD system that has no trust relationship with the AD system that TFS is joined to</li>
  <li>TFS Server version is 2018 (16.131.27701.1)</li>
  <li>TFS Datastore is SQL Server 2016 EE hosted on a separate instance.</li>
  <li>Visual Studio version is Pro 2017 (15.4.1)</li>
  </ul>
  
  <p>Seeing the symptoms in two independent environments tells me the issue is on the TFS Server however I'm able to identify any potential bottlenecks or blockers.  Also that the issue appears in the Visual Studio and the web interface the issue seems to be in the TFS Server and not the client but the delay in making the requests from the client points it right back to being a client configuration issue.  </p>
  
  <p>How can I identify what is causing the client to delay follow up requests when a prior response returns a 401 reply?</p>