You can set up a cluster of Parasoft Virtualize servers to achieve horizontal scaling and fault tolerance. Horizontal scaling is commonly used to optimize performance testing and cloud-based infrastructures for continuous integration and continuous delivery. Fault tolerance is commonly used to increase uptime and/or facilitate disaster recovery for business-critical backend systems.

In this section

Prerequisites

Load Balancer Configuration

Configure your load balancer to route loads to each Virtualize server. If you are using Parasoft CTP or any other tool that interacts with assets through the Virtualize REST API, you will need to perform the additional configuration outlined in the following sections.

The following instructions apply to any load balancer, but we are using F5 Local Traffic Manager (LTM) as an example in order to provide general guidelines on load balancer configuration.

Configuring Source Address Affinity Persistence

This section describes how to configure source affinity persistence for Parasoft CTP. The same principles can also be applied to configure any other tool that interacts with assets through the Virtualize REST API.

Source address affinity persistence ensures that all calls from CTP are routed to the same node. Session affinity is sometimes called "sticky sessions."

Enable source address affinity persistence for the following ports:

With F5 Local Traffic Manager (LTM), source address affinity persistence is configured by enabling the Match Across Services and Match Across Virtual Servers options. You could, for example, use the default source_addr profile or create a custom profile to enable source address affinity persistence. The following table shows the settings and values for the default source_addr profile.

SettingDescription Default Value
NameDefines a unique name for the profile. Required.No default value
Persistence TypeDefines the type of persistence profile. Required.Source Address Affinity
Match Across ServicesIndicates that all persistent connections from a client IP address which go to the same virtual IP address should also go to the same node.Enabled
Match Across Virtual ServersIndicates that all persistent connections from the same client IP address should go to the same node.Enabled
Match Across PoolsIndicates that the LTM system can use any pool that contains this persistence entry.Disabled
TimeoutIndicates the number of seconds at which a persistence entry times out.180
MaskDefines the mask the LTM system should use before matching with an existing persistence entry.0.0.0.0
Map ProxiesEnables or disables proxy mapping.Enabled

Using Priority-based Member Activation

Priority-based member activation ensures that all calls from any origin will go to the main machine first (if possible). To configure this, set the first machine as the highest priority. For example, the following is a sample pool configuration file from F5 documentation for Local Traffic Manager:

pool my_pool {
         lb_mode fastest
         min active members 2
member 10.12.10.7:80 priority 3
member 10.12.10.8:80 priority 3
member 10.12.10.9:80 priority 3
member 10.12.10.4:80 priority 2
member 10.12.10.5:80 priority 2
member 10.12.10.6:80 priority 2
member 10.12.10.1:80 priority 1
member 10.12.10.2:80 priority 1
member 10.12.10.3:80 priority 1
}

Virtualize Configuration

Ensure that the load balancer is configured so that changes are propagated to only one node before configuring Virtualize for load balancing. 

  1. Share the VirtualAssets project and all of its associated content (.pmpdd, .pvadd, .pjcdd, VirtualAssets.xml, .git, etc.) across the cluster. We recommend using a git fetch command as a post commit trigger to synchronize sharing.
  2. Enable refreshing using native hooks or polling:
  3. Add the following Java option to your startup command on all nodes in the cluster to put the server. 

    -J-Dparasoft.auto.deploy.new=false

  4. Restart your servers.

Deployments in the Virtualize cluster will eventually synchronize. When a request deploy is sent, a single server processes the request and then returns a response. The file system will notify the other servers in the cluster to make the changes required for consistency. In some cases, this may take several seconds. As a result, there may be a brief time when some servers are not yet aware of a deployment that happened on another server.

Parasoft Data Repository Configuration

Parasoft Data Repositories, which are based on MongoDB, should be configured for clustering by identifying a primary Data Repository (the one that has the data you want replicated) and creating a replicate set. To do this, follow this procedure (taken and modified from the MongoDB documentation):

  1. Stop all of the Data Repositories you want to become part of the replica set.
  2. Start the primary repository server:

    ./bin/mongod --port 2424 --dbpath repositories

    If the "repositories" directory does not exist, you should create it.

  3. Connect to the mongo shell and create the admin database.

    ./bin/mongo --port 2424
    use admin
  4. Run the following command to create admin users:

    db.createUser({user:"<username>",pwd:"<password>",roles:[{role:"root",db:"admin"}]});

    If the command fails because the user already exists, run the following command:

    db.grantRolesToUser('admin',[{role:"<role>"}])
  5. Stop the primary mongo server.
  6. Create your key file. The following example shows the basic commands:

    openssl rand -base64 741 > mongodb-keyfile
    chmod 600 mongodb-keyfile
  7. Copy the key file to each member of the replica set.

  8. Start each member of the replica set with the following command:

    ./bin/mongod --replSet "rs0" --dbpath repositories --port 2424 --auth --keyFile <mongodb-keyfile>
  9. On the primary server, connect to the mongo shell and provide the password when prompted:

    ./bin/mongo localhost:2424/admin -u <admin_user> -p
  10. Run the following commands to verify authentication:

    use admin
    db.auth("<siteRootAdmin>", "<password>");

    The shell should return 1.

  11. Initiate the replica set with the following command:

    rs.initiate()
  12.  Verify your replica set configuration with the following command:

    rs.conf()

    If the host for your primary server is incorrect, use the following commands to change the host:

    cfg = rs.conf()
    cfg.members[0].host = "mongodb1.example.net:27017"
    rs.reconfig(cfg)
  13.  For each secondary server, run the following command in the primary server's mongo shell:

    rs.add("<secondary>:<port>")

Additional Information