Creating Multiple Velocity Instances on a Single Machine

This article will guide you through the process of creating more than one instance of Microsoft project code named "Velocity" (henceforth referred to as "Velocity" for the remainder of the article) on one standalone machine. All such instances created on this machine can form a cluster (or multiple clusters), just like it were installed on different machines.

Currently "Velocity" runs as a 32 bit process (even on 64 bit OS) with address space limited to 2GB. So, by creating multiple instances of "Velocity" you will be able to leverage the capabilities of a machine with lot of memory and CPU power.

By default "Velocity" will be installed in " %Program Files%\Microsoft Distributed Cache". This directory contains

  • "Velocity" DLL’s / EXE’s
  • Configuration file DistributedCache.exe.config
  • Other supporting files

The “default” installer that we ship can only install one instance of "Velocity" on a given node. In order to install multiple instances, follow these steps.

[Each "Velocity" instance is referred to as a cache host which is actually a windows service. We will create multiple "Velocity" windows services and add them to the "Velocity" cluster.]

  1. Make sure that you have "Velocity" installed on the machine where you want to run multiple services. Stop the cluster (if it is already running) from the Administration Console (e.g., MyCluster> stop cluster)

  2. Create directories for each of the hosts to be set up in this machine. E.g., If you want to create two more instances other than the one installed, then create directories like "Microsoft Distributed Cache Instance-2" and "Microsoft Distributed Cache Instance-3". Copy all the contents from the installation directory (default: %Program Files%\Microsoft Distributed Cache\V1.0) to these directories.

  3. Create a new Windows service for each of the instances using following command

    sc create <serviceName> binPath= "<newCacheHostDir>\DistributedCache.exe" DisplayName= "<displayName>"

    Where,

    • serviceName – Name of the service to run the new instance.
    • displayName – Service name displayed on the services tab.
    • newCacheHostDir - Full path of the directory for new cache host.

    C:\>sc create DCacheHost2 binPath= "C:\Cluster\Microsoft Distributed Cache Instance-2\DistributedCache.exe" displayName= "My Cache Host 2"

    C:\>sc create DCacheHost2 binPath= "C:\Cluster\Microsoft Distributed Cache Instance-2\DistributedCache.exe" displayName= "My Cache Host 2"

  4. Each newly created Windows service will represent a cache host in the "Velocity" cluster. Modify the 'DistributedCache.exe.config' file in respective directories using notepad as follows

    1. Modify the cacheHostName to match the “serviceName” specified during the “sc” command above.
    2. Set desired log location for new cache host.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <configSections>
    <section name="dcacheConfig" type="System.Data.Caching.LocalConfigReaderWriter, CacheBaseLibrary, Culture=neutral, PublicKeyToken=null" allowLocation="true" allowDefinition="Everywhere" />
    </configSections>

    <dcacheConfig clusterName="MyCluster" hostName="IMDBSTRS01" cacheHostName="DCacheHost2">
    <config location="C:\ConfigStore\MyCluster" />
    <log location="C:\Cluster\Microsoft Distributed Cache Instance-2\logs" />
    </dcacheConfig>

    </configuration>

  5. Modify the clusterconfig.xml file to configure the cluster for these newly created cache hosts. The clusterconfig.xml fill can be found on the network share you specified during installation

    Update the 'ClusterConfig.xml' by adding entries for the new cache hosts in the hosts section. You can copy the existing entry and modify following parameters

    • hostName – Modify the hostname to match the “hostName” in the DistributedCache.exe.config
    • cacheHostName – Modify the cacheHostName to match the “serviceName” specified during the “sc” command above.
    • clusterPort and cachePort – These ports should not conflict with other ports on the network (or other cache hosts)
    • hostId – Unique identifier for the cache host in the cluster.
    • You can choose to edit some of the other parameters for experimenting with "Velocity".

    E.g., if you create a cache service with name "DCacheHost2" and "DCacheHost3", example entries would be like:
     

    <hosts>
    <host name="IMDBSTRS01" hostId="1552752876" quorumHost="True"
    cacheHostName="DistributedCacheService" cachePort="22233"
    clusterPort="22234" size="2048"
    lowWaterMark="70" highWaterMark="90" />
    <host name="IMDBSTRS01" hostId="1552752877" quorumHost="False"
    cacheHostName="DCacheHost2" cachePort="22333"
    clusterPort="22334" size="2048"
    lowWaterMark="70" highWaterMark="90" />
    <host name="IMDBSTRS01" hostId="1552752878" quorumHost="False"
    cacheHostName="DCacheHost3" cachePort="22433"
    clusterPort="22434" size="2048"
    lowWaterMark="70" highWaterMark="90" />
    </hosts>

  6. Now all the services should be available as part of the windows services.

  7. You can start the services using start cluster command from "Velocity" Administration Tool.

Your 3 node cluster is now up and running! Happy Testing!!!

Sudhir Jorwekar, Arun K S
(Microsoft project code named "Velocity" Team)