To enable horizontal scaling of content, you can add multiple servers for any environment and set up an internal process to connect each server.
Add multiple servers within the environment
Now, on the configuration window, click on the Advanced option of the environment. Under the Deploy Content to Server(s) section, add the names of servers that you wish to add for this environment.
Finally, after adding the servers in an environment, you need to run your app on the servers.
Start the app in individual servers
To start your app on all the servers, run the following command in all of them, along with the corresponding server details.
set NODE_ENV=<<YOUR_ENV_NAME>>&& set SERVER=<<YOUR_SERVER_NAME>>&& npm run start
To run ‘Server 1’ and ‘Server 2’ in Windows, run the following commands in the respective servers:
- Server 1:
set NODE_ENV=production&& set SERVER=Server 1&& npm run start
set NODE_ENV=production&& set SERVER=Server 2&& npm run start
NODE_ENV=<<YOUR_ENV_NAME>> SERVER=<<YOUR_SERVER_NAME>> npm run start
To run ‘Server 1’ and ‘Server 2’ in Linux, run the following commands in the respective servers:
- Server 1:
NODE_ENV=production SERVER=Server 1 npm run start
NODE_ENV=production SERVER=Server 2 npm run start
Publish content in the environment
Once you perform the above steps, publish the entries in the environment. The published content will reflect in all the servers.