Perforce Public Knowledge Base - Putting db.monitor on tmpfs
Reset Search



Putting db.monitor on tmpfs

« Go Back



Server log shows lots of long write waits on db.monitor -- and you are running a recent Linux distribution.

For example:

Perforce server info:
        2012/06/26 00:02:00 pid 31334 billw@bill_ws [P4V/v61] 'user-filelog -L //depot/path/to/some/file.ini'
--- lapse 460s
--- db.monitor
---   total lock wait+held read/write 0ms+0ms/457660ms+0ms
---   max lock wait+held read/write 0ms+0ms/457660ms+0ms



The db.monitor table tracks running Perforce Server processes. You can access db.monitor information by running the p4 monitor show command. The p4 monitor command is similar to the Linux ps command.

The information in the db.monitor database table is transient and is not included in checkpoint operations. 

In general, access to db.monitor by the server should be very quick. However, if you are seeing long write holds on the db.monitor table, those long locks can indicate a slow or overworked I/O system. 

In this case, putting db.monitor on a temporary filesystem (tmpfs) can be a solution to the long write locking and associated performance problems.  

The size of tmpfs depends on how big your db.monitor grows. In general, 20MB is more than sufficient size for most Perforce deployments..

Below is a good reference for creating a tmpfs.

Some Linux distributions mount tmpfs at the /dev/shm location by default.

Moving db.monitor to tmpfs

To move your db.monitor to tmpfs, first stop the server, then move the db.monitor file (using mv), and then create a symlink from P4ROOT/db.monitor to a db.monitor on tmpfs. For example:

     cd /p4root

     mv db.monitor db.monitor.old

     ln -s /dev/shm/db.monitor db.monitor

You can perform this move without shutting down the server, if you use the global -c flag to lock the server database files first..
     p4d -r . -c "mv db.monitor db.monitor.old;ln -s /dev/shm/db.monitor db.monitor"

If you would like to keep the existing process info, move db.monitor to tmpfs and soft link it with one step, as follows:

     p4d -r . -c "mv db.monitor /dev/shm;ln -s /dev/shm/db.monitor db.monitor"


Related Links



Was this article helpful?



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

Characters Remaining: 255