Fixing cache synchronization in a web farm configuration

Overview

When page content updates are not synced between the web servers in the web farm, this may mean that web farm cache synchronization has been failing.  


 

Prerequisites

  • Access to a SuperUser account.
  • Access to the DNN file structure and IIS configuration.


Diagnosis

  • There is a provider called WebRequestCachingProvider. This provider synchronizes the cache between the enabled web servers automatically. This provider sends a request called SynchronizeCache.aspx, which is generated by a DNN handler.

  • When there is more than one server in the server list, a web farm flag is enabled and the SynchronizeCache.aspx request is then sent to the servers on the list. The request reaches the uniquely defined server URLs in the list to synchronize the cache between the servers.

  • Every time the request returns a 200 message, this means that the SynchronizeCache request was successful and the cache has been synced between the webheads.

Web Farm cache synchronization issues occur when any of the points above have failed to complete.

You can also confirm you are having cache synchronization issues by going into the SiteRoot/Portals/_default/Logs folder and seeing the following error:

Synchronization Error in Request:
[Thread:55][ERROR] DotNetNuke.Services.Exceptions.Exceptions - System.Exception: Synchronization Error in Request: http://www.website.com/SynchronizeCache.aspx?message=1yDD6Y0tSOM%3d&data=bYPl_hRFaUFi3RPdZCZLRy608cAwf-HVD2nEq5COLZ8%3d ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 0.0.0.0.0.
at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at DotNetNuke.Professional.Providers.CachingProviders.WebRequestCachingProvider.WebRequestCachingProvider.OnSynchronizeResponseCallback(IAsyncResult asynchronousResult)

StackTrace:
InnerMessage: The remote server returned an error: (404) Not Found.

 

Another error you may encounter is:

Message: Synchronization Error in Request

InnerMessage: The underlying connection was closed: An unexpected error occurred on a send.
InnerStackTrace: at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at DotNetNuke.Professional.Providers.CachingProviders.WebRequestCachingProvider.WebRequestCachingProvider.OnSynchronizeResponseCallback(IAsyncResult asynchronousResult)


 

Solution

There are two solutions to this problem:

Solution #1: Synchronization Errors caused by server connectivity

From the error message, it is obvious that the connection failed because it could not connect to the host. This error may be caused by one of the following reasons:

  • There are old/unused servers in the server list.
    1. You need to delete the old servers or run the TRUNCATE TABLE webservers query through Settings > SQL Console.
    2. Recycle the application pool. This will clear out the webservers list. By recycling the application pool, the application will regenerate the Web Server entries. Alternatively, you can enable the webserver monitor scheduled tasks to perform the same process.

  • The Unique URLs defined for the webheads are not accessible from the webhead that sends the SynchronizeCache request.
    1. This can be verified by accessing each web server remotely (use the server's unique URL).
    2. From the remote server, make a request to other servers (use the server's unique URL, not the URL of the load balancer).
    3. If any errors are returned, you will need to check the connection between the webheads. You can also verify this by checking the IIS logs for the corresponding webhead (find the SynchronizeCache request and make sure it returns a 200 message).

 

Solution #2: WebRequestCachingProvider Is Not Being Used

Caching issues might be caused by the fact that WebRequestCachingProvider is not being used. Hence, you will need to make sure that it is being used:

  1. From Persona Bar, navigate to Settings > Servers > Server Settings > Web Servers.
  2. From the Server Web Request Adapter drop-down, select DotNetNuke.Entities.Host.ServerWebRequestAdapter.
  3. Click Save.


Testing

To test that the cache synchronization has been resolved:

  1. Make a content update on any modules and publish the page on one web server.
  2. Go to Settings > Servers > Clear Cache.
  3. Go to another web server in the web farm by using its unique URL.

You should see that the content is consistent between the servers.

 

Related Articles

 

 Back to top

Comments

1 comment

  • Avatar
    FPCU IT team

    Tried recommended solution, it doesn't work, are you able to provide me your calendar schedule a remote session with us? It's been couple of weeks that we couldn't make any change with some pages on the site

    0
    Comment actions Permalink

Please sign in to leave a comment.