Slow clone transfer speed on Windows Server 2008
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Git clones are slow due to lower transfer speeds (typically less than 200 KB/s), especially on higher latency connections.
Diagnosis
Environment
- Windows Server 2008
Diagnostic Steps
- The clone speed can be tested outside of Bitbucket Server by using
git daemon
to host the repository with the Git protocol. The same clone speed should be seen this way as well. - If Git pushes are slow, it's also possible to be running into Git push operations extremely slow on Windows
Cause
The slow clones are caused by the size of the TCP packets being limited to 9,000 bytes or below. This is likely due to the architectural behavior of the Windows Socket API in Windows Server 2008. More details on this can be found at Slow performance occurs when you copy data to a TCP server by using a Windows Sockets API program.
Workaround
Clone speeds can be improved by using the blocking Java connector and adjusting the socketBuffer in Tomcat. In $BITBUCKET_HOME/shared/server.xml
make the following changes:
- Change the protocol to
org.apache.coyote.http11.Http11Protocol
- Add the
socketBuffer
parameter
<Connector port="7990" protocol="org.apache.coyote.http11.Http11Protocol"
connectionTimeout="20000"
useBodyEncodingForURI="true"
redirectPort="8443"
compression="on"
socketBuffer="65000"
socket.rxBufSize="65000"
socket.txBufSize="65000"
compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript" />
This workaround will not be viable in Bitbucket Server 5.0+ due to the blocking connector being removed from Tomcat 8.5.
Resolution
Upgrade to Windows Server 2012 or migrate to Linux, see Migrating Bitbucket Data Center to another server for details.
Linux is the recommended option for larger instances.