Kentico CMS 7.0 Developer's Guide

Defining web farm servers

Defining web farm servers

Previous topic Next topic Mail us feedback on this topic!  

Defining web farm servers

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

You need to enter the internal URLs of all your servers into the system so that the web farm synchronization module knows which servers should be synchronized.


To add a server to the web farm:


1. Go to Site Manager -> Administration -> Web farm.

2. Click NewServer New server.

3. Fill in the following fields:


Server display name - a descriptive name for the server displayed in the administration interface.

Server code name - a unique code name of the server that will be used in the server's configuration file.

Server root URL - the URL of the root of the website on the server, such as You can check the availability of the server by clicking Check server availability (CheckServer).

Server enabled - this checkbox may be used to manually enable or disable web farm synchronization for the server.


4. Click Save Save to register the server.


Repeat the process for every server in your web farm.




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.


After you have defined your web farm servers, you need to enable the web farm module itself in the settings:


1.Navigate to Site Manager -> Settings -> Versioning & Synchronization -> Web farm.

2.Turn on Enable web farm.

3.Click Save Save.


You can perform additional low-level settings of web farm synchronization by adding the keys listed in Web farm synchronization settings into the /configuration/appSettings section of your web.config file.





Web farm license keys


Please be sure to enter an appropriate license key for the internal URLs of the web farm servers.


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



Enter separate license keys for, and in Site Manager -> Licenses. You only need to add the licenses on one server and restart the other instances using Site Manager -> Administration -> System -> Restart application.


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:


Add the CMSHashStringSalt key to the appSettings section of the web.config file on all web farm servers. You can use any string as the value, but the salt should be random and at least 16 characters long. For example, a randomly generated GUID is a strong salt:


<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 Macro security 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.Go to Site Manager -> Administration -> Scheduled tasks.

2.Select (global) in the Site selector at the top of the page.

3.Edit (Edit) the Synchronize web farm changes task.

4.Set an appropriate Task interval.

5.Check the Task enabled box.

6.Click Save 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 NewTask 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 Save to complete the process.


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 administration interface. Here, you can view information about all synchronization tasks that are currently active (waiting to be processed).


You can filter the tasks using the Server drop‑down list according to the server to which they are assigned, or select (all servers) to show all synchronization tasks in the entire web farm.


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


You can remove all listed tasks using the Clear task list button, or individual tasks via the Delete (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.


Creating web farm servers automatically


An alternative way of defining web farm servers is letting the system create them automatically on application start. You need to have web farm enabled via a setting or a web.config key on all the servers. Then add the following key


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


or turn on the following setting: Versioning & Synchronization -> Web farm -> Generate servers dynamically.


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