Performance improvements in Perforce releases
Proxy performance can suffer over high latency networks when syncing a lot of very small files. In these circumstances the overhead of proxy communication to the server might be larger than that of simply pulling files directly from the server.
This issue has been addressed in two ways:
2005.1 Perforce Proxy release and later
To address the proxy performance issue, the -e flag was introduced as an undocumented option. Note that this setting can also be set with the environment variable P4PFSIZE. From p4 help undoc:
p4p -e size ...
Start the Perforce Proxy with a size in bytes in which if a file
revision is smaller than this, that revision will not be cached
by the proxy. The proxy performs best with larger files so this
flag can tune proxy performance but lowering overhead for small
Identifying an appropriate -e value requires experimentation*. The general rule is: the higher the network latency; the higher the -e value.
Low bandwidth on the network has an opposite affect on the -e value. The lower the available bandwidth, the lower the -e value should be set. With low bandwidth you want the proxy to cache as much as possible, hence the low -e value.
* The "magic number" for P4PFSIZE for the network environment at Perforce was 9,157 bytes. Since each environment is different, you need to test other values, try compression on/off, and so on.
2005.2 Perforce Server release and later
A protocol change was introduced in the 2005.2 server release to further improve performance with the proxy. The version of your Perforce Proxy server does not matter, but a Perforce Server version of 2005.2 or higher is required to take advantage of this protocol change. Please note that this fix does not improve the performance of p4 sync -f.
When measured over a simulated slow link with a latency of 400msec, there was a significant improvement with this protocol change. Notably with a large set of sources:
| ||Changed Protocol||Original Protocol|
|Proxy fault sync||1:40||2:42|
|Proxy nofault sync||0:28||1:42|
|Proxy nofault sync -f||0:53||0:53|
On a Perforce Server running within a Windows environment that has a Perforce Proxy attached, the DefaultSendWindow size should be increased. You need to set the size to 32768 (0x8000), which involves a registry change. The applicable registry entry using Value Type: REG_DWORD is in:
The registry entry should appear as follows:
DefaultSendWindow REG_DWORD 0x00008000 (32768)
When this change has been made, a restart of the system is required.
Please Note, this should be done only on the Perforce Server machine and not the machine running the Perforce Proxy.
PPPoE on a VPN and MTU Values
A common solution for proxy latency is to adjust the MTU. You need to consult your vendor's instructions for setting MTU on your VPN device. To determine the optimal MTU setting for your system you can perform the following test from your Perforce Proxy server:
ping <perforce server> -f -l xxxx
where xxxx is the packet size.
Start with a packet size of 1500, and decrease the value until you do not get the error message "Packet needs to be fragmented but DF set". The packet size happened to be 1472 on the system at Perforce. For optimal performance use the largest packet size you can without getting the "Packet needs to be fragmented but DF set" message.
Other Windows parameters to tweak may be seen in
Windows 7, Vista, 2008 Tweaks but these have not been verified.
We have not verified the effect of net.tcpsize=2M nor filesys.bufsize=2M,
but you may want to try Improving Perforce Proxy throughput.
A good resource for operating system tuning is http://fasterdata.es.net.