Perforce Public Knowledge Base - Proxy Performance
Downloads Blog Company Integrations Careers Contact Try Free
Menu Search
Reset Search



Proxy Performance

« Go Back



How to tune the proxy server for better performance.


Set net.tcpsize and filesys.bufsize

On Linux, start p4p with the "-v net.tcpsize=2000000 -v filesys.bufsize=2000000". 

For example:

On Linux:

p4p -v net.tcpsize=2000000 -v filesys.bufsize=2000000 -p 1669 -t gabriel:1666 -r /home/perforce/p4pcache -v 3 -e 500000 -v proxy.monitor.level=2 -L proxylog -d

or better yet, on Linux, turn on net.autotune for the proxy and master servers.  See Autotune - Improved performance over long latency TCP connections.

On Windows, set P4POPTIONS:

p4 set -S "Perforce Proxy" P4POPTIONS="-v net.tcpsize=2000000 -v filesys.bufsize=2000000"

Configure duplexing

As seen in our release notes:

#671142 (Bug #53464) **
The network-related performance of a 'p4 sync -f', 'p4 sync -p', or 'p4 print' command issued via a proxy over a long-haul network is improved by performing fewer network duplex flush operations. The new behavior, if problematic, may be disabled using the undocumented tunable 'rpc.deliver.duplex=1'.

To set rpc.deliver.duplex, run

p4 configure set rpc.deliver.duplex=0

but change run "p4 configure set rpc.deliver.duplex=1" if the proxy hangs.

Set the -e flag to ignore small files

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 9157 -p 1669 -t gabriel:1666 -r ./p4pcache -v 3 -e 500000 -v proxy.monitor.level=2 -L proxylog -d

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

Direct Sync



Proxy fault sync



Proxy nofault sync



Proxy nofault sync -f




Modify the Windows DefaultSendWindow

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.

Check MTU values

A common solution for proxy latency is to adjust the MTU especially on Windows.  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 things to try

Other Windows parameters to tweak may be seen in
Windows 7, Vista, 2008 Tweaks but these have not been verified.

A good resource for operating system tuning is

Don't forget to try parallel syncs.  See Parallel sync and parallel submit in P4V.

Related Links



Was this article helpful?



Please tell us how we can make this article more useful.

Characters Remaining: 255