Limiting simultaneous connections

If monitoring is enabled (p4 configure set monitor=1 or higher), you can set the server.maxcommands configurable to limit the number of simultaneous command requests that the service will attempt to handle.

Ideally, this value should be set both:

  • low enough to detect a runaway script or denial of service attack before the underlying hardware resources are exhausted

  • high enough to maintain a substantial margin of safety between the typical average number of connections and your site’s peak activity.

If P4LOG is set, the server log contain lines of the form:

Server is now using nnn active threads.
Tip

You can use the server log to determine what levels of activity are typical for your site. Set server.maxcommands to a value higher than your anticipated peak activity. We recommend at least 200% to 500% higher.

Too many commands

Starting in 2019.1, if a problem occurs with server.maxcommands, users with the access level of super, or the user type of operator (see p4 user), can still run certain commands to diagnose the problem.