Running multiple P4 Server services on Windows

By default, the P4 Server installer for Windows installs one P4 Server instance and registers it as a single Windows service.

In some environments, you may want to host more than one P4 Server instance on the same Windows machine. For example, you might run a production server or a test/staging server.

On Windows, this is done by configuring multiple Windows services, each running its own P4 Server instance.

This is an advanced configuration, most installations require only one P4 Server service.

Supported ways to run multiple servers

To run multiple P4 Server instances on the same Windows machine, you can:

  • Configure additional Windows services using the Perforce-supplied svcinst.exe utility (recommended).

  • Manually run p4d.exe from the command line for temporary or testing purposes (advanced use only).

For most administrators, Windows services managed with svcinst.exe are the safest and most reliable approach.

License restrictions

Using multiple P4 Server services to increase the number of supported users without purchasing additional licenses is a violation of the Perforce End User License Agreement. Each server instance must be licensed appropriately.

Configuration and environment variables

When running multiple P4 Server services on the same Windows machine, it is important to understand how configuration values are resolved.

Each service has its own set of service‑specific environment variables, such as:

  • P4ROOT

  • P4PORT

  • P4LOG

  • P4JOURNAL

These values are associated with the specific Windows service, not with the machine as a whole.

Before configuring multiple services, make sure you understand configuration parameter precedence, especially how service-specific values override system and user settings.

Before you begin

We strongly recommend that you:

  • Install your first P4 Server using the standard Windows installer.

  • Allow the installer to create the default Windows service (usually named Perforce).

  • Use this initial installation as the basis for any additional services.

The server root directory created by the first installation contains tools and files that are required when creating additional services, including the svcinst.exe utility.

Example: Adding a second P4 Server service

This example shows how to create a second P4 Server service with:

  • Service name: Perforce2

  • P4ROOT: C:\p4root2

  • Port: 1667

In this example:

The first P4 Server installation is located in C:\perforce.

The svcinst.exe utility is available in that directory.

To add a second P4 Server service:

  1. Create a new P4ROOT directory to store the database and files for the new service:

    mkdir C:\p4root2
  2. Copy the server executables and license file from the existing server installation into the new P4ROOT directory:

    copy C:\perforce\p4d.exe C:\p4root2
    copy C:\perforce\p4d.exe C:\p4root2\p4s.exe
    copy C:\perforce\license C:\p4root2\license
    

    p4d.exe is the P4 Server executable

    p4s.exe is the same executable, renamed for use as a Windows service. To learn more about these executables see, Understanding p4s.exe and p4d.exe.

  3. Create the new Windows service with svcinst.exe. To register a new Windows service named Perforce2:

    svcinst create -n Perforce2 -e C:\p4root2\p4s.exe -a

    This creates the service and configures it to start automatically when Windows boots.

  4. Set the configuration values for the Perforce2 service using the -S option:

    p4 set -S Perforce2 P4ROOT=C:\p4root2
    p4 set -S Perforce2 P4PORT=1667
    p4 set -S Perforce2 P4LOG=log2
    p4 set -S Perforce2 P4JOURNAL=journal2
    

    These settings apply only to the Perforce2 service and do not affect any other P4 Server services on the system.

  5. Start the new service using svcinst:

    svcinst start -n Perforce2

The second P4 Server service is now running.

  • Both services (Perforce and Perforce2) are independent.

  • Each uses a unique P4ROOT and port.

  • Both services will start automatically the next time the system reboots.