Observing the effect of lockless reads
To determine whether read locks are impacting performance (and the
extent to which enabling lockless reads has improved performance), you
can examine the server logs, or you can use the -Ztrack
flag
to output, for any given command, the lines that would be written to the
P4LOG
. For example:
$ p4 -Zpeeking=1 -Ztrack sync
produces output for 11 database tables. The relevant lines here are
those that refer to "locks read/write
".
... --- db.counters --- pages in+out+cached 3+0+2 --- locks read/write 1/0 rows get+pos+scan put+del 1+0+0 0+0 --- db.user --- pages in+out+cached 3+0+2 --- locks read/write 1/0 rows get+pos+scan put+del 1+0+0 0+0 ...
The 1
appearing in ("locks read/write 1/0
")
every table’s locking results shows one read lock taken per table. By
contrast, the diagnostic output from:
$ p4 -Zpeeking=2 -Ztrack sync
... --- db.counters --- pages in+out+cached 3+0+2 --- locks read/write 0/0 rows get+pos+scan put+del 1+0+0 0+0 ...
shows that the sync operation completed without any read or write locks
required on db.counters
(if you try it yourself, on many
other tables); when peeking is enabled, many commands will show
read/write 0/0
locks (or at least, fewer locks) taken.