Redis server

P4 Code Review uses Redis to manage cache data. The cache improves the performance of common searches and reduces load on the P4 Server. By default, P4 Code Review uses the bundled Redis server

For information about:

  • Configuring Redis.

  • Configuring a Redis connection.

  • Redis server settings.

  • Using a user-managed Redis server.

  • Using Valkey as a Redis-compatible cache server.

See Redis configuration.

Overview

If users or groups are added, modified, or deleted in the P4 Server while P4 Code Review is offline, the Redis cache can become out of sync with the P4 Server. After P4 Code Review restarts, you can manually verify the Redis caches. For details, see Manually verify the Redis caches.

When P4 Code Review starts, it verifies the Redis cache before allowing users to log in. The amount of time required depends on the number of users, groups, and projects stored in P4 Code Review.

A configuration change only takes effect when the configuration cache has been reloaded. You must be an admin or super user to reload the P4 Code Review config cache.

To reload the configuration:

  1. Open the user menu (top-right corner of P4 Code Review).

  2. Select System Information.

  3. Open the Cache Info tab.

  4. Click Reload Configuration.

If changes to the config.php file might have caused the P4 Code Review web interface to become unresponsive, remove the problematic changes from the config.php file, then clear the configuration cache by running this command: rm -f /opt/perforce/swarm/data/cache/module-config-cache.php

Redis connection settings

The redis connection settings are configured in the SWARM_ROOT/data/config.php file.

For details about:

  • Redis connection settings.

  • Configuration examples.

  • Redis namespaces.

  • Integrity checks.

  • Connection options.

  • Valkey configuration.

See Redis configuration.

Redis server configuration file

The Redis server configuration is stored in the /opt/perforce/etc/redis-server.conf file.

For information about:

  • Default Redis settings.

  • Redis startup configuration.

  • Performance tuning.

  • Redis services.

  • Laminas Redis adapter settings.

See Redis configuration.

Manually verify the Redis caches

In normal operation, the Redis cache and P4 Server remain synchronized and manual cache verification is not required. However, the cache can become out of sync in some situations, such as:

  • Changes are made in the P4 Server while P4 Code Review is offline.

  • Errors occur during cache updates.

If you suspect a cache issue, you can manually verify the cache from the System Information page. To learn more, see Cache Info.

Note:

  • Only admin and super users can verify Redis caches.

  • Cache verification can take time on systems with large numbers of users, groups, or projects.

  • On large systems, verifying individual caches is usually more efficient than using Verify All.

Cache batching

P4 Code Review batches Redis cache operations to prevent large single calls from blocking the Redis server. Two configuration keys in the redis block of SWARM_ROOT/data/config.php file control the batch sizes for write and read operations.

Key Operation Default Description

items_batch_size

Write (MSET) 10000

Maximum number of key/value pairs sent in a single MSET call when populating or updating the cache. Sets that exceed this limit are split into batches of this size.

items_read_batch_size

Read (MGET)

1000

Maximum number of keys sent in a single MGET call when reading cached records. Reads that exceed this limit are split into batches of this size. Available from P4 Code Review 2026.3 onwards.

Redis processes commands on a single thread. A single MGET or MSET call with hundreds of thousands of keys blocks all other Redis operations until it completes. In environments with large numbers of users, groups, or workflows, unbatched calls can block Redis for hundreds of milliseconds, degrading the entire P4 Code Review environment.

Batching configuration guidance:

  • The default values are suitable for most environments.

  • Smaller values reduce the time each Redis call blocks the server but increase the total number of round trips. In most cases the difference in round-trip overhead is negligible.

  • If you have more than 100,000 cached entities (users, groups, or workflows), the default items_read_batch_size of 1000 keeps individual MGET calls in the sub-millisecond range.

  • There is rarely a reason to change items_batch_size from its default. Cache population (writes) happens infrequently compared to reads.

Verify the User cache

  1. Open the user menu (top-right corner of P4 Code Review).

  2. Select System Information.

  3. Open the Cache Info tab.

  4. Click Verify User.

P4 Code Review displays a confirmation message when verification completes successfully.

If verification detects that the cache is out of sync with the P4 Server, P4 Code Review automatically updates the affected cache.

To learn more see Verify buttons

Check progress of the verification request

To check the progress of a verification request:

  1. Open the user menu (top-right corner of P4 Code Review).

  2. Select System Information.

  3. Select the Cache Info tab.

  4. Click Refresh Status.