Increasing the number of nginx worker connections

By default, each nginx worker process can open a maximum of 1024 simultaneous connections. You might need to increase the number of simultaneous connections for the worker processes if you encounter performance issues.

Best practice: You can run many of the commands in this task exactly as written if you set up environment variables for your installation. For instructions, see Setting up installation environment variables.

Ensure that you source the environment variables before you run the commands in this task.

Symptoms

When nginx worker processes need more connections, the nginx pods include the following error:

1024 worker_connections are not enough

Causes

At least one nginx worker process needs more than 1024 connections.

Diagnosing the problem

Run the following command to determine whether you need to adjust the number of worker connections:

oc logs -n ${PROJECT_CPD_INST_OPERANDS} -l=component=ibm-nginx | grep "worker_connections are not enough"

If the command returns one or more responses with worker_connections are not enough, proceed to Resolving the problem.

Resolving the problem

You must be either:

  • A cluster administrator
  • An instance administrator

To increase the number of nginx worker connections:

  1. Log in to Red Hat® OpenShift® Container Platform as a user with sufficient permissions to complete the task.
    ${OC_LOGIN}
  2. Set the WORKER_CONNECTIONS environment variable to the number of simultaneous connections to allow:
    export WORKER_CONNECTIONS=<number-of-connections>
  3. Run the following command to change the number of worker connections:
    oc patch configmap product-configmap \
    --namespace ${PROJECT_CPD_INST_OPERANDS} \
    --type=merge \
    --patch "{\"data\": {\"GATEWAY_WORKER_CONNECTIONS\":\"${WORKER_CONNECTIONS}\"}}"
  4. Restart the ibm-nginix deployments:
    oc rollout restart deployment/ibm-nginx \
    --namespace ${PROJECT_CPD_INST_OPERANDS}