Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Views: 21530
Number of votes: 6
Average rating:

Cache Update and Load Balancing for EPiServer CMS 5

In an enterprise setup of EPiServer CMS 5 with load balancing, the system must continuously update page information between all the Web sites. In the Enterprise Edition of EPiServer CMS 5, this is done using intelligent cache updates. In this article you will be guided through the configuration steps needed to set up the load balancing.

Local and Remote Cache Update

A feature that the Enterprise Edition has introduced is intelligent cache updates. From a .NET viewpoint, all your enterprise Web sites are completely separate applications, running in their own appDomains. Since all sites share the same database and may be affected by page updates on other sites, the system needs to be able to update page information between all the enterprise Web sites.

As from EPiServer CMS 5 R1, the cache update between sites, regardless of whether they are running on the same machine or not, is done via UDP network traffic. The only configuration that is needed is to make sure that enableEvents and enableRemoteEvents are both set to “true”. When a site starts, it registers its siteId in the database (if it's not already there). It then reads all siteId's back from the database and registers an interest in receiving cache notifications for each one.

If the cache update mechanism does not appear to work, the cause is most likely that you have network devices between your servers that prevent UDP broadcasts from being relayed. Software-based firewalls (i.e. the Windows Firewall) may also need to be configured to allow the UDP traffic to reach the machine. Find out more below.

Step One – Testing the Network

The first thing to do is to test the network for UDP communication. This is done with a listening/broadcasting tool, for instance the EPiServerRemoteEventsListener or Test TCP. Make sure that you test the UDP connection at least two times with the test tool and not just once. This is to ensure that  the connection is really working.

EPiServerRemoteEventsListener

EPiServerRemoteEventsListener is a diagnostics application for the EPiServer CMS 5 Events System. EPiServer CMS 5 uses Windows Communication Foundation technology to send events between a load balanced site.

The EPiServerRemoteEventsListener application listens on the same UDP channel as EPiServer CMS in order to display the events that are being transmitted by EPiServer CMS, both on the local machine and by other machines on the same network. This can be useful to determine if firewalls or other software are blocking the EPiServer CMS events.

The current version of the diagnostic application can be used both to send and receive events. The application requires .NET 2.0 and can be found at http://world.episerver.com/en/Download/Categories/Download-Type/Code-Samples1/File-System/Listening-to-EPiServer-File-Events/. The application is installed using a simple XCopy of the contents of the zip file.

Test TCP

Another tool that can be used to see if a route is open for TCP/UDP traffic is Test TCP (ttcp.exe). This ships with Windows Server 2003 in the ValueAdd folder. Please refer to http://technet.microsoft.com/en-us/library/bb877965.aspx   for more details.

Using the listening/broadcasting tool

On one server you configure the tool to send a message out over the network and on all the other servers you run the tool as is (listening):

  • To send, run the tool like this: “C:\nlb>EPiServerRemoteEventsListener.exe send” and simply write a small text message.
  • To listen, simply run the tool as is “C:\nlb>EPiServerRemoteEventsListener.exe”.

After sending a message it will automatically show up on the servers listening.  If it does not, contact the network people that configured the server and make sure the network supports UDP broadcasting on at least one port.

Step Two – Setting SiteID Values

In the <site> section in web.config, ensure that the <siteId> values are all the same on each of the servers.

Step Three – Configure enableEvents and enableRemoteEvents

In the <siteSettings> section in web.config, ensure that the following values are set as shown:

<configuration>
  <episerver>
    <sites>
      <site>
        <siteSettings enableEvents="true" enableRemoteEvents="true">

 
If enableEvents is set to “true” but enableRemoteEvents is set to “false”, then any events raised will only be distributed to subscribers within the same site. For load balanced or enterprise sites, enableRemoteEvents must also be set to “true” so that the events can be distributed to other sites both on the same server and on other servers.

Step Four – Check EventSubscriberHostModule

In the <httpModules> section in web.config, ensure the <add> element for the EventSubscriberHostModule is not commented out:

<configuration>
  <system.web>
    <httpModules>
        <add name="EventSubscriberHostModule" type="EPiServer.EventSubscriberHostModule, EPiServer" />

Step Five – Check system.serviceModel

In the <configuration> section in web.config, ensure the following <system.serviceModel> section exists and is not commented out. NOTE that if a special port was opened for the UDP broadcast, then this port must be configured in the <endpoint’s as shown below.

<system.serviceModel>
    <extensions>
      <bindingElementExtensions>
        <add name="udpTransport" type="Microsoft.ServiceModel.Samples.UdpTransportElement, EPiServer.Implementation" />
      </bindingElementExtensions>
    </extensions>
    <services>
      <!-- Before deployment, you should remove the returnFaults behavior configuration to avoid disclosing information in exception messages -->
      <service name="EPiServer.Events.Remote.EventReplication" behaviorConfiguration="DebugServiceBehaviour">
        <endpoint name="RemoteEventServiceEndPoint" contract="EPiServer.Events.ServiceModel.IEventReplication" binding="customBinding" bindingConfiguration="RemoteEventsBinding" address="soap.udp://239.255.255.19:5000/RemoteEventService" />
      </service>
    </services>
    <client>
      <endpoint name="RemoteEventServiceClientEndPoint" address="soap.udp://239.255.255.19:5000/RemoteEventService" binding="customBinding" bindingConfiguration="RemoteEventsBinding" contract="EPiServer.Events.ServiceModel.IEventReplication" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DebugServiceBehaviour">
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <customBinding>
        <binding name="RemoteEventsBinding">
          <binaryMessageEncoding />
          <udpTransport multicast="True" />
        </binding>
      </customBinding>
    </bindings>
  </system.serviceModel>

Step Six – UDP Multicast Address and Port

The address attribute values in both the service and client endpoint sections, specify a UDP multicast address and port. This may be changed as desired but the IP address MUST be a UDP multicast address. Firewalls will need to allow communication on the port chosen if multiple servers are used and are separated by firewalls.

Related reading

 
Configuring EPiServer CMS 5 Enterprise
http://world.episerver.com/en/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-SP2/Configuring-EPiServer-CMS-5-Enterprise/
 

Event Management System Specification
http://world.episerver.com/en/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-SP2/Event-Management-System-Specification/ 
   

Comments

Please login to comment.