I would like to run a live and staging environment on the same server. To do this, I wish to run two cache services. The rest of the microservices have good support for this in their installation scripts, allowing you to set the port number, as well as various other parameters like the Name of the service and DependsOn.

In the case of the cache service, there are fewer possibilities. I could solve some of the issues by making a custom version of the installation script, but I don't see a way to run the cache service on a different port. Is there a reason for this? Is it reasonable to want to run two cache services? If I tried to use one service for both staging and live, I'd expect problems: should I?


I've figured it out. There are two things necessary:

  1. Give the service a different name
  2. Specify a different port.

To do this, edit the installService.ps1 script. Locate the line where the first argument to procrun is added:

$arguments += "//IS//SDLWebCacheService"

... and modify it to be different to the cache service you already have running. e.g.:

$arguments += "//IS//SDLWebStagingCacheService"

Where ever this name is used, you'll also have to modify it, so at the bottom of the script where sc.exe is invoked, and also in the matching uninstall script.

Find the part of the script where ++StartParams is added to $arguments, and add the following line (of course you can choose your own port number):

$arguments += "++StartParams=localhost:2099"

I'd have preferred not to modify the script shipped by SDL, but that would only be possible if they parameterised these things, and I hope they will in a future version.

Edit: For completeness, and after further reflection, I suppose I should answer my bonus question about whether I should expect problems when attempting to share a CCS between staging and live. As far as I know, invalidation messages are purely on the basis of the item ID, so presumably publishing to staging or live would invalidate the cached item both on staging and live. So the downside would be that you'd get some unnecessary cache invalidation, and some extra load because of it. I suspect in practice, you may not even notice.

Your Answer

