Skip to main content
Version: 8.5.X

Steps to Increase the Connection Limit

Effectively managing system resources is essential to ensure the performance and stability of applications, particularly those handling numerous concurrent connections or large datasets. By default, the Motadata server supports a fixed number of open files or connections, which may be insufficient for high-performance or resource-intensive applications. To address this limitation, increasing the open file or connection limit is necessary. This article provides a step-by-step guide to help you adjust these limits, ensuring your system can easily handle demanding workloads.

note

This document applies to Linux, Nginx, and Meshcentral servers.

Procedure

To increase the connection limit and enhance performance, you must perform configurations from the Linux, Nginx, and MeshCentral servers.

Linux Server

To increase the limit from the Linux OS side:

  1. Login to the Terminal server.

  2. Navigate to the etc. folder and copy or take the backup of the “sysctl.conf” file using the below command:

    cp /etc/sysctl.conf /etc/sysctl.conf.bkp

  3. Edit the “sysctl.conf” file and add the following two parameters towards the end of the file. Here, the maximum limit is set.

    vim /etc/sysctl.conf` 
    fs.file-max = 262144
    vm.max_map_count=262144

  1. Save and exit.

  2. To replicate the immediate changes, apply the below command:

    sysctl –p

    OR

    sudo sysctl -w vm.max_map_count=262144  
    sudo sysctl -w fs.file-max=262144
note

If you face any issue or error, revert the changes on the sysctl.conf file.

  1. Check the current open limit from the Linux machine side using the below commands:
    ulimit –a
    ulimit -n

  1. Update the limit using the below commands:

    ulimit -n 262144

    echo "ulimit -n 262144" >> ~/.bashrc

note

The root user is required to apply the commands.

Nginx Server

To increase the limit from the Nginx server:

  1. Login to the Terminal server.

  2. Navigate to the "/lib/systemd/system/nginx.service" file path:

  3. Copy and take the backup of the nginx.service file using the below command.

    cp /lib/systemd/system/nginx.service /backupfolder/nginx.service

  4. Edit the "nginx.service" file and add the below line.

    LimitNOFILE= 262144

  1. Next, apply the below commands:
    sudo systemctl daemon-reload 
    sudo systemctl restart nginx

Nginx Configuration File

To increase the limit from the Nginx configuration file:

  1. Navigate to the "/etc/nginx/nginx.conf" file path.

  1. Take the backup of the nginx.conf file.
  2. Edit the "nginx.conf" file and add the below lines:
    worker_processes 4;  
worker_rlimit_nofile 65536;
events {
worker_connections 65536;
multi_accept on;
}

  1. Once done, save the file, and verify the file using the below command:

    nginx -t

  2. Restart the nginx service using the below command:

    sudo systemctl restart nginx 
    sudo systemctl status nginx