Is this really the version you are looking for? Kentico 8 documentation is no longer updated. Use the switch in the header to choose your Kentico version.

Defining web farm servers

To use web farm synchronization, you need to enter the internal URLs of all your servers into the system. Perform at least the following steps:

  1. Add web farm servers.
  2. Enable web farm functionality.
  3. Add license keys for your web farm servers.

Adding web farm servers

To add a server to the web farm:

  1. Open the Web farm application.
  2. Click New server.
  3. Fill in the following fields:

    • Server display name - a descriptive name for the server displayed in the administration interface.
    • Server root URL - the URL of the root of the website on the server, such as http://192.168.1.2/Kentico. You can check the availability of the server by clicking Check server availability.
    • Server enabled - allows you to manually enable or disable web farm synchronization for the server.

  4. Click Save to register the server. 

Repeat the process for every server in your web farm.

Adding a new web farm server

You also need to update the web.config file on each server and add the CMSWebFarmServerName key into the appSettings section:

<add key="CMSWebFarmServerName" value="servername"/>

Where servername is the code name that the system created for the server (or the code name that you manually entered). Every server must contain only one such key with its own name.

Enabling web farm functionality

After you define your web farm servers, you need to enable web farm synchronization in the settings:

  1. Open the Settings application.
  2. Expand the Versioning & Synchronization -> Web farm category.
  3. Check the Enable web farm setting.
  4. Click Save.

Enter an appropriate license key for the internal URLs of all your web farm servers.

For example, if you use the web farm for domain name example.com and access the servers internally through URLs like:

  • http://192.168.1.2
  • http://192.168.1.3

Enter separate license keys for example.com, 192.168.1.2 and 192.168.1.3 in the Licenses application. You only need to add the licenses on one server and restart the other instances using the System application (click Restart application).

Adding licenses for domains with a different number of allowed web farm servers

When you enable web farm functionality on a Kentico instance, we recommend that you use only those website domains, for which you have licenses with the same number of web farm servers allowed. If you have a website which can be run on multiple servers, adding another website with fewer allowed web farm servers can cause "License web farm server count exceeded." errors.

Website licensing when using web farms

These are the possible solutions for this problem:

  • Obtain additional licenses for your websites so that they can be run on the same number of web farm servers.
  • Use completely separate infrastructures (different servers and databases) for each website.

 

Configuring servers for synchronizing macros

The system uses signatures to ensure the security of macro expressions. Macro signatures contain the user name of the macro's author and a hash of the given expression.

The hash function used to create the signatures appends a salt to the input. To ensure that macro expressions work correctly in a web farm environment, you need to configure all servers to use the same hash salt:

  • Set the CMSHashStringSalt key in the appSettings section of the web.config file to the same value on all web farm servers. For example:

    <add key="CMSHashStringSalt" value="e68b9ad6-a461-4707-8e3e-ece73f03dd02" />

The best option is to set the hash salt value before you start creating content for your website. Changing the salt causes all current hash values to become invalid. To fix existing macro expressions in the system after changing the hash salt, you need to re-sign the macros. See Working with macro signatures for more information.

Setting the server synchronization interval

By default, web farm servers are updated with changes made on other servers once per request. Synchronizing this frequently may be impractical for high‑traffic websites. To change the synchronization interval, set the value of the CMSWebFarmUpdateWithinRequest web.config key to false:

<add key="CMSWebFarmUpdateWithinRequest" value="false"/>

and use the Synchronize web farm changes scheduled task instead, which has a configurable execution interval:

  1. Open the Scheduled tasks application.
  2. Select (global) in the Site selector at the top of the page.
  3. Edit () the Synchronize web farm changes task.
  4. Set an appropriate task interval.
  5. Select the Task enabled check box.
  6. Click Save.

You also need to create the task for each server in the web farm. To create the tasks quickly:

Note: All web farm servers that you wish to use need to be registered in the system before performing the following steps.

  1. Return to the list of scheduled tasks.
  2. Click New task.
  3. Fill in the same properties as those of the Synchronize web farm changes task (the Task name must be different)
  4. Check Create tasks for all web farm servers below the Server name property.
  5. Click Save.

Your web farm now synchronizes according to the interval of the scheduled tasks.

Monitoring web farm synchronization tasks

If synchronization doesn't work as expected, you can check the Tasks tab of the Web farm application's interface. The tab provides information about all synchronization tasks that are currently active (waiting to be processed).

Click Run tasks to manually execute tasks, regardless of how the synchronization interval is currently configured.

You can remove all listed tasks by clicking Clear task list, or individual tasks via the Delete () action. Clearing the list is not necessary if the web farm is working correctly — the system automatically removes successfully processed tasks.

A similar user interface can be found on the Anonymous tasks tab. This tab displays a list of currently active (waiting to be processed) anonymous synchronization tasks. These tasks are logged by external applications (e.g. Windows services) to ensure that changes made by the external application are reflected in the web application cache. Tasks are logged as anonymous only if the application is NOT configured to run in a web farm. If it is configured to run in a web farm, these tasks are logged as standard synchronization tasks on the Tasks tab.

See also: Debugging web farms

Creating web farm servers automatically

An alternative way of defining web farm servers is letting the system create the servers automatically on application start.

Prerequisite: You need to have web farm synchronization enabled on all the servers.

  1. Open the Settings application.
  2. Select the Versioning & Synchronization -> Web farm category.
  3. Enable the Generate servers dynamically setting.
  4. Click Save.

Alternatively, you can add the following key to the appSettings section of your web.config file:

<add key="CMSWebFarmGenerateServers" value="true"/>

All servers with enabled web farm support add themselves into the list of servers when the application starts. If a server doesn't have a server name defined in the web.config, it uses its machine name.