Limit 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.

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.

To limit the number of commands that each user can run at the same time, see Limit the rate of user commands.

Commands that super and operator users can always run

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 the following commands to diagnose the problem.

  • p4 admin

  • p4 configure, p4 counter, p4 counters

  • p4 group, p4 groups

  • p4 help, p4 help-graph

  • p4 info

  • p4 journals

  • p4 lockstat, p4 login, p4 login2, p4 logout, p4 logtail

  • p4 monitor

  • p4 protect, p4 protects, p4 pull

  • p4 server, p4 servers

  • p4 user, p4 users

To disable the super and operator users from having this capability, see the server.maxcommands.allow configurable.