Perforce Public Knowledge Base - How to Monitor a Swamped Perforce Server
Downloads Blog Company Integrations Careers Contact Try Free
Menu Search
Reset Search



How to Monitor a Swamped Perforce Server

« Go Back


How do I monitor a swamped Perforce server that is not responding to p4 monitor show commands?

In most circumstances, you can run the p4 monitor command to identify the client processes currently running on your Perforce Server. However, it is possible that a long-running Perforce command can block other Perforce processes, including the p4 monitor request.

Important note: Perforce Server 2014.1 uses shared memory to store db.monitor by default. To use the solution below, you need to disable in-memory storage of the monitor information with "p4 configure set db.monitor.shared=0":

    #711155 **
        The monitor information, the table db.monitor, will now be
        maintained in shared memory by default.  Enabling monitor
        information will require a server restart.  The tunable
        db.monitor.shared can be set to 0 to disable shared memory
        or set to a number of pages of shared memory should the
        default (1Mbyte) be too small.  All changes to this
        require a server restart.
You can prevent the blocking of p4 monitor on a Perforce Server running on UNIX or MacOS (or other operating systems that natively support symbolic links). To do so, you must create a new Perforce Server instance that shares the db.monitor table by means of a symlink.

Configuring for Unix

Below is an example of configuring a new "monitor server" for most Unix based systems:
  1. Create a new monitor server P4ROOT directory:
    mkdir /perforce/monitor
  2. Link the production server monitor table into the new P4ROOT directory:
    ln -s /perforce/production/db.monitor /perforce/monitor/db.monitor
  3. Start up the new "monitor server" (with journaling off):
    p4d -r /perforce/monitor -J off -p 1999 -d
  4. Remember to enable monitoring by setting the monitor counter to 1 on the new server:
    p4 -p 1999 counter -f monitor 1
  5. Stop and restart the monitor server for the new monitor setting to take effect:
    p4 -p 1999 admin stop
    p4d -r /perforce/monitor -J off -p 1999 -d
Note: The new monitor server runs in a different P4ROOT (/perforce/monitor) location and on a different port (1999) than the production server

Once the monitor server instance is set up (as above), you can then monitor your production server by running the p4 monitor command on the new monitor server. For example:
p4 -p 1999 monitor show

Configuring for Windows

The same general technique used for Unix based systems, as described above, will also work for Windows based operating systems, though there are some differences related to how Windows works with services:
  1. Setup and start a second Perforce service under Windows by following the instructions in the Perforce System Administrator's Guide.
  2. Enable monitoring for the new Perforce service. For this example the port 1665 is being used for the new "monitor" server, but you can use any unused port:
    p4 -p 1665 configure set monitor=2
  3. Stop the new monitor server instance:
    p4 -p 1665 admin stop
  4. In the monitor instance Perforce server root directory delete the monitor table (db.monitor).
  5. Create a hardlink in the monitor instance server root directory to the production server root directory's copy of db.monitor:
    fsutil hardlink create db.monitor c:\{path to production root directory}\db.monitor
  6. Restart the Perforce monitor service instance.

To test the new Perforce monitor instance, run a monitor command against that instance:
p4 -p 1665 monitor show -ale

Compare the resulting output to the live server monitor output:
p4 -p 1666 monitor show -ale
Related Links



Was this article helpful?



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

Characters Remaining: 255