Skip to main content
Use NitroPack with Load Balancing
Updated over a week ago

What is Load Balancing?

Load balancing is the process of distributing network traffic across multiple servers, computers, or other resources to optimize resource utilization, improve performance, and increase the availability and reliability of applications or services.

Can NitroPack operate with Load Balancing?

NitroPack can work with Load Balancing.

However, you must ensure that the server stack have Redis installed and configured.

Once you have ensured that Redis is a part of your network, there is one last step to take.

That step will differ depending on your website’s platform.

WordPress

The configuration requires the following constants to be set within a website's wp-config.php file:

mceclip0.png
if (!defined("NITROPACK_USE_REDIS")) define("NITROPACK_USE_REDIS", false); // Set this to true to enable storing cache in Redis
if (!defined("NITROPACK_REDIS_HOST")) define("NITROPACK_REDIS_HOST", "127.0.0.1"); // Set this to the IP of your Redis server
if (!defined("NITROPACK_REDIS_PORT")) define("NITROPACK_REDIS_PORT", 6379); // Set this to the port of your Redis server
if (!defined("NITROPACK_REDIS_PASS")) define("NITROPACK_REDIS_PASS", NULL); // Set this to the password of your redis server if authentication is needed
if (!defined("NITROPACK_REDIS_DB")) define("NITROPACK_REDIS_DB", NULL); // Set this to the number of the Redis DB if you'd like not to use the default one

⚠️ Please note that the values should be adjusted according to your Redis configuration. You should be able to obtain this information from your hosting provider - the Redis IP address, port, passwords, and database (if any).

OpenCart

The OpenCart configuration has a few additional steps that need to be performed:

1. Navigate to the root folder of your website, and from there, go to system/config/nitropackio/

mceclip1.png

2. Look for the file default.php and open it.

mceclip2.png


There you will see a warning at the top stating:

Never modify this file. Instead, create a new file called override.php in the same directory as this file. If a constant in override.php exists, it takes precedence over the constant in this file.”

3. Create a new file in the same directory called override.php (or use the existing one if already created).

mceclip3.png

4. Copy the section responsible for Redis and place it in the override.php file.

// Redis connection settings, used in case the NITROPACK_STORAGE_DRIVER is REDIS
if (!defined('NITROPACK_REDIS_HOSTNAME')) define('NITROPACK_REDIS_HOSTNAME', "127.0.0.1");
if (!defined('NITROPACK_REDIS_PORT')) define('NITROPACK_REDIS_PORT', 6379);
if (!defined('NITROPACK_REDIS_PASSWORD')) define('NITROPACK_REDIS_PASSWORD', NULL);
if (!defined('NITROPACK_REDIS_DATABASE')) define('NITROPACK_REDIS_DATABASE', NULL);

⚠️ Please note that the values should be adjusted according to your Redis configuration. You should be able to obtain this information from your hosting provider - the Redis IP address, port, password, and database (if any).

Magento

To configure it, you must execute the following command via SSH.

php bin/magento setup:config:set --nitropack-cache-storage_type=<value> --nitropack-cache-redis_host=<value> --nitropack-cache-redis-pass=<value> --nitropack-cache-redis_db=<value> --nitropack-cache-redis-port=<value>

For further information, please refer to our dedicated article “Configure NitroPack for Magento with Redis.”

📌 If you need any assistance or have questions, reach out to our support team at [email protected] or via this link: https://support.nitropack.io

Did this answer your question?