Web farm synchronization mechanisms

When editors make changes to the content or physical files on a web farm server, the system logs the changes into the database as web farm tasks. This server then notifies other servers in the web farm to retrieve the web farm task data from the database and make appropriate changes in their file system or memory.

The system provides the following ways for notifying the other servers about changes in the web farm:

When you are setting up a web farm, study the synchronization mechanisms properly and choose a single mechanism that suits your environment the best. Please do not use both URL notifications and database notifications at the same time. See the following table for a summary of the synchronization mechanisms.

Synchronization mechanism

Advantages

Disadvantages

Suitable for

URL notifications

Synchronization happens each time a web farm task is created

Servers need to see each other

High number of synchronizations can cause overhead

Web farms with known number of servers

Database updater

Works in every environment

Can be used with  automatic web farm configuration

Web farms on Azure or Amazon services

Web farms with dynamic number of servers

Scheduled task

The synchronization period can be adjusted

Can be configured to run through an external service

High traffic projects where it is possible to configure the Scheduler service

Enabling a web farm synchronization mechanism after all mechanisms have been disabled

If you want to enable a synchronization mechanism after you have accidentally disabled all of them, the system will have no means of propagating the new settings through the web farm. Therefore, you need to restart the whole web farm in such situations:

  1. Open the System application.
  2. Click Restart all web farm servers.

The web farm is now using the new settings.

Web farm synchronization using URL notifications

Every Kentico instance contains a page that web farm servers can send HTTP requests to when generating web farm tasks. The other web farm servers don’t get involved in the process until they are notified about the changes. When this happens, each server fetches its tasks and processes them accordingly. For this method to work, all servers in a web farm must be able to see each other.

Synchronization by request is not suitable for projects that are heavily edited. This is because a lot of tasks can be generated in a short time period, which means an excess traffic for the target servers and clearing of the cache too often (especially under heavy load). This method is recommended for projects with defined, static number of servers.

Synchronization by request is the default option on instances not running on Microsoft Azure.

To enable URL notifications synchronization mechanism:

  1. Navigate to Settings application -> Versioning & Synchronization -> Web farm.
  2. Select the Update within request setting.
  3. Configure web farm servers.

The synchronization by request mechanism uses the Server root URL value stored in the web farm server object.

Web farm synchronization using database notifications

With the database notifications mechanism (also called the database updater), the system uses the CMS_WebFarmServerTask database table to find tasks created for the current server. On the application side, a routine runs in a separate long running thread which continuously polls the database to find the tasks.

This mechanism is used on Azure by default and it does not require any configuration in this environment. The database updater is also the only supported option for automatically generated web farm servers. Use this mechanism in all environments where the number of web farm servers dynamically changes in time.

To enable the database updater mechanism:

  1. Navigate to Settings application -> Versioning & Synchronization -> Web farm.
  2. Select the Use web farm database updater setting.
  3. Configure web farm servers.

Web farm synchronization using a scheduled task

Synchronizing web farm tasks using the scheduled task allows you to set the periodicity of the synchronization. This way, you can configure the system to process the web farm task in a batch, as opposed to synchronization by every request.

You can also set the scheduled task to run in a separate thread. By configuring the scheduler to run as an external Scheduler service, you can transfer the processing of web farm tasks outside of the website.

Synchronization using a scheduled task offers enhanced performance and wider possibilities of configuration at the cost of enabling the Scheduler service.

To use the scheduled task to process web farm tasks:

  1. Make sure that the Update within request and Use web farm database updater settings in Settings -> Versioning & Synchronization -> Web farm are disabled.
  2. Make sure that the Synchronize web farm changes scheduled task in Scheduled tasks application is enabled.
  3. Configure web farm servers.
  4. Configure the Synchronize web farm changes scheduled task to be executed on each web farm server. See Configuring scheduled tasks to be executed on every server of a web farm.

Modifying the synchronization interval

By default, the Synchronize web farm changes scheduled task is configured to run every minute. You can configure this interval to better suit the needs of your website: 

  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 the required task interval.
  5. Make sure that the Task enabled check-box is selected.
  6. Click Save.