11 Dynamic Clusters

This chapter introduces dynamic clusters and how to create, configure, and use dynamic clusters in WebLogic Server 12.1.3.

This chapter includes the following sections:

What Are Dynamic Clusters?

Dynamic clusters consist of server instances that can be dynamically scaled up to meet the resource needs of your application. A dynamic cluster uses a single server template to define configuration for a specified number of generated (dynamic) server instances. When you create a dynamic cluster, the dynamic servers are preconfigured and automatically generated for you, enabling you to easily scale up the number of server instances in your dynamic cluster when you need additional server capacity. You can simply start the dynamic servers without having to first manually configure and add them to the cluster.

If you need additional server instances on top of the number you originally specified, you can increase the maximum number of servers instances (dynamic) in the dynamic cluster configuration or manually add configured server instances to the dynamic cluster. A dynamic cluster that contains both dynamic and configured server instances is called a mixed cluster.

The following table defines terminology associated with dynamic clusters:

Term Definition
dynamic cluster A cluster that contains one or more generated (dynamic) server instances that are based on a single shared server template.
configured cluster A cluster in which you manually configure and add each server instance.
dynamic server A server instance that is generated by WebLogic Server when creating a dynamic cluster. Configuration is based on a shared server template.
configured server A server instance for which you manually configure attributes.
mixed cluster A cluster that contains both dynamic and configured server instances.
server template A prototype server definition that contains common, non-default settings and attributes that can be assigned to a set of server instances, which then inherit the template configuration. For dynamic clusters, the server template is used to generate the dynamic servers. See "Server Templates" in Understanding Domain Configuration for Oracle WebLogic Server.

You cannot configure dynamic servers individually; there are no server instance definitions in the config.xml file when using a dynamic cluster. Therefore, you cannot override the server template with server-specific attributes or target applications to an individual dynamic server instance. Example 11-1 shows an example config.xml file that includes a dynamic cluster.

Example 11-1 Example config.xml File Using a Dynamic Cluster

<server-template> 
    <name>dynamic-cluster-server-template</name>
    <accept-backlog>2000</accept-backlog>
    <auto-restart>true</auto-restart>
    <restart-max>10</restart-max>
    <startup-timeout>600</startup-timeout>
</server-template>
 
<cluster>
    <name>dynamic-cluster</name>
    <dynamic-servers>
      <server-template>dynamic-cluster-server-template</server-template>
      <maximum-dynamic-server-count>10</maximum-dynamic-server-count>
      <calculated-machine-names>true</calculated-machine-names>
      <machine-name-match-expression>dyn-machine*</machine-name-match-expression>
      <server-name-prefix>dynamic-server-</server-name-prefix>
    </dynamic-servers>
</cluster>

Why Do You Use Dynamic Clusters?

With dynamic clusters, you can easily scale up your cluster when you need additional server capacity by simply starting one or more of the preconfigured dynamic server instances. You do not need to manually configure a new server instance and add it to the cluster or perform a system restart.

How Do Dynamic Clusters Work?

The following sections describe using dynamic clusters:

Creating and Configuring Dynamic Clusters

When you create a dynamic cluster, you perform the following actions:

  • specify the number of server instances you anticipate needing at peak load

  • create or select the server template upon which you want to base server configuration

  • define how WebLogic Server should calculate server-specific attributes

WebLogic Server then generates the specified number of dynamic server instances and applies the calculated attribute values to each dynamic server instance.

Note:

Ensure you have the performance capacity to handle the maximum number of server instances you specify in the dynamic cluster configuration. For information on design and deployment best practices when creating a cluster, see "Clustering Best Practices."

You create dynamic clusters using WebLogic Scripting Tool (WLST) or the WebLogic Server Administration Console. Example 11-2 demonstrates using WLST. For information about using the WebLogic Server Administration Console, see "Create dynamic clusters" in the Oracle WebLogic Server Administration Console Online Help. When creating a dynamic cluster in the WebLogic Server Administration Console, WebLogic Server creates the server template, dynamic cluster, and specified number of server instances for you. You do not have to specify them individually. You can configure dynamic clusters using any of the administration tools listed in "Summary of System Administration Tools and APIs" in Understanding Oracle WebLogic Server.

Using Server Templates

Server templates define common configuration attributes that a set of server instances share. Dynamic clusters use server templates for dynamic server configuration. For more information about server templates, see "Server Templates" in Understanding Domain Configuration for Oracle WebLogic Server.

Calculating Server-Specific Attributes

You cannot configure individual dynamic server instances or override values in the server template at the dynamic server level when using a dynamic cluster. Server-specific attributes, such as server name, machines, and listen ports, must be calculated using the information provided when creating the dynamic cluster.

WebLogic Server calculates and applies the following server-specific attributes using the instance ID of the dynamic server:

  • Server name

  • (Optional) Listen ports (clear text and SSL)

  • (Optional) Network access point listen ports

  • (Optional) Machines or virtual machines

Calculating Server Names

The calculated server name is controlled by the ServerNamePrefix attribute. Server names are the specified prefix followed by the index number. For example, if the prefix is set to dyn-server-, then the dynamic servers will have the names dyn-server-1, dyn-server-2, and so on for the number of server instances you specified.

Calculating Listen Ports

The settings in the dynamic cluster configuration or server template determine the listen ports for the server instances in your dynamic cluster. If you do not calculate listen ports when creating your dynamic cluster, WebLogic Server uses the value in the server template. If you do not define listen ports in the dynamic cluster configuration or server template, WebLogic Server uses the default value. Listen port settings are controlled by the CalculatedListenPorts attribute. For more information about these settings, see "Create dynamic clusters" in the Oracle WebLogic Server Administration Console Online Help.

If you explicitly define a listen port for your dynamic cluster in the server template or the dynamic cluster configuration, that value will be used for the first generated server instance and incremented by one for each additional server instance. If the default listen port is indicated, WebLogic Server increments the "hundreds" digit by one and continues from there. Table 11-1 shows examples of calculated listen port values.

Table 11-1 Calculating Listen Ports

Listen Port Type Configuration Setting in Server Template Dynamic Server Listen Port Values

Server listen port

Listen port not set

dyn-server-1: 7101

dyn-server-2: 7102

...

Server listen port

Listen port set to 7300

dyn-server-1: 7301

dyn-server-2: 7302

...

Server SSL listen port

SSL listen port not set

dyn-server-1: 8101

dyn-server-2: 8102

...

Server SSL listen port

SSL listen port set to 8200

dyn-server-1: 8201

dyn-server-2: 8202

...

Server network access point listen port

Network access point listen port not set

dyn-server-1: 9101

dyn-server-2: 9102

...

Server network access point listen port

Network access point listen port set to 9200

dyn-server-1: 9201

dyn-server-2: 9202

...

Server replication ports

Replication ports set to 8100

dyn-server-1: 8100

dyn-server-2: 8101

...

Server replication ports

Replication ports set to 8100-8104

dyn-server-1: 8100-8104

dyn-server-2: 8105-8109

dyn-server-3: 8110-8114

...


You can override listen ports at server startup by using system properties. For example:

To override the listen port:

-Dweblogic.ListenPort=7305

To override the SSL listen port:

-Dweblogic.ssl.ListenPort=7403

To override the listen port of the network access point named mynap:

-Dweblogic.networkaccesspoint.mynap.ListenPort=8201

Calculating Machine Names

The dynamic cluster attributes CalculatedMachineNames and MachineNameMatchExpression control how server instances in a dynamic cluster are assigned to a machine. If the CalculatedMachineNames attribute is set to false, then the dynamic servers will not be assigned to a machine. If the CalculatedMachineNames attribute is set to true, then the MachineNameMatchExpression attribute is used to select the set of machines used for the dynamic servers. If the MachineNameMatchExpression attribute is not set, then all of the machines in the domain are selected. Assignments are made using a round robin algorithm. Table 11-2 shows examples of machine assignments in a dynamic cluster.

Table 11-2 Calculating Machine Names

Machines in Domain MachineNameMatchExpression Configuration Dynamic Server Machine Assignments

M1, M2

Not set

dyn-server-1: M1

dyn-server-2: M2

dyn-server-3: M1

...

Ma1, Ma2, Mb1, Mb2

Ma1, Mb*

dyn-server-1: Ma1

dyn-server-2: Mb1

dyn-server-3: Mb2

dyn-server-4: Ma1

...


Starting and Stopping Servers in Dynamic Clusters

You can start and stop server instances in dynamic clusters using the same methods you use to start and stop server instances in configured clusters: the WebLogic Server Administration Console, WLST, Node Manager, or start scripts. You may have to follow several other procedures before you can start server instances, based on the startup method you choose and the tasks you have already performed. For more information, see "Starting and Stopping Servers" in Administering Server Startup and Shutdown for Oracle WebLogic Server 12.1.3.

Note:

Before you begin, ensure that WebLogic Server is installed on all hosts where you want to run your server instances. If you want to use Node Manager to start and stop your server instances, then you must also run Node Manager on these hosts.

Using Whole Server Migration with Dynamic Clusters

WebLogic Server supports whole server migration with dynamic and mixed clusters. While configuration differs depending on the cluster type, whole server migration behavior is the same for all clusters. For information on how to enable whole server migration for dynamic clusters, see "Whole Server Migration with Dynamic and Mixed Clusters."

Expanding or Reducing Dynamic Clusters

When you create a dynamic cluster, WebLogic Server generates the number of dynamic servers you specify. Before you decide upon the number of server instances, ensure you have the performance capacity to handle the desired number.

The dynamic server instances are based on the configuration you specified in the server template and calculated attributes. When you need to expand your cluster, start any number of the preconfigured dynamic servers. To shrink your dynamic cluster, shut down the excess number of dynamic servers.

If you need additional server capacity on top of the number of server instances you originally specified, you can increase the maximum number of dynamic servers in the dynamic cluster configuration. To reduce the number of server instances in the dynamic cluster, decrease the value of the maximum number of dynamic servers attribute. Before lowering this value, shut down the server instances you plan to remove.

Deploying Applications to Dynamic Clusters

When deploying applications to a dynamic cluster, you must target the application to the entire cluster. You cannot target an application to an individual server instance because dynamic clusters do not have individual dynamic server configuration. When you deploy an application to the dynamic cluster, all servers in the cluster, both dynamic and static, will deploy the application.

To deploy an application to a dynamic cluster, follow the same process as deploying to configured clusters. For more information, see "Deploy Applications" and "Application Deployment for Clustered Configurations."

For a broad discussion of deployment topics, see Deploying Applications to Oracle WebLogic Server.

Using WebLogic Web Server Plug-Ins with Dynamic Clusters

Dynamic clusters provide the same WebLogic Web server plug-in support as configured clusters. By default, a Web server plug-in uses the DynamicServerList parameter to receive information about cluster changes, such as new server instances in a configured or dynamic cluster. Upon recognizing a cluster membership change, the plug-in automatically updates its server list.

For general information about using Web server plug-ins with WebLogic Server, see Using Oracle WebLogic Server Proxy Plug-Ins 12.1.3. For more information about the DynamicServerList parameter or the WebLogicCluster parameter (required when proxying to a WebLogic Server cluster), see "General Parameters for Web Server Plug-Ins" in Using Oracle WebLogic Server Proxy Plug-Ins 12.1.3.

Limitations and Considerations When Using Dynamic Clusters

When using dynamic clusters with WebLogic Server, note the following limitations and considerations:

  • You cannot override values in the server template at the individual dynamic server level because there are no individual server definitions in the config.xml file when using dynamic clusters.

  • You must ensure you have the performance capacity to handle the maximum number of server instances you specify in the dynamic cluster configuration.

  • Dynamic clusters do not support targeting to any individual dynamic server instance. Therefore, the following cannot be used with dynamic clusters:

    • Deployments that cannot target to a cluster, including migratable targets. Therefore, you cannot create a migratable target for a dynamic cluster.

    • Configuration attributes that refer to individual servers. This includes JTA migratable targets, constrained candidate servers, user preferred server, all candidate servers, and hosting server. Therefore, you cannot specify a dynamic server as the user preferred server for a migratable target.

    • Configuration attributes that are server specific. This includes replication groups, preferred secondary groups, and candidate machines (server level).

    • Constrained candidates for singleton services. You cannot limit a singleton service to dynamic servers.

  • For whole server migration with a dynamic cluster, you cannot limit the list of candidate machines that the dynamic cluster specifies, as the server template does not list candidate machines.

  • Dynamic clusters also have JMS limitations. For more information, see "Simplified JMS Cluster Configuration" in Administering JMS Resources for Oracle WebLogic Server.

Dynamic Clusters Example

Example 11-2 demonstrates using WLST to create a dynamic cluster. The example includes inline comments and describes how to:

  1. Create a server template and specify the desired server attributes in the server template.

  2. Create a dynamic cluster and specify the desired cluster attributes.

  3. Set the server template for the dynamic cluster.

  4. Set the maximum number of server instances you want in the dynamic cluster.

  5. Start and stop the server instances in the dynamic cluster.

Example 11-2 Creating Dynamic Clusters with WLST

#
# This example demonstrates the WLST commands needed to create a dynamic cluster
# (dynamic-cluster). The dynamic cluster uses a server template     
# dynamic-cluster-server-template. To keep this example simple, error handling
# was omitted.
#
connect()
edit()
startEdit()
#
# Create the server template for the dynamic servers and set the attributes for
# the dynamic servers. Setting the cluster is not required.
#
dynamicServerTemplate=cmo.createServerTemplate("dynamic-cluster-server-template")
dynamicServerTemplate.setAcceptBacklog(2000)
dynamicServerTemplate.setAutoRestart(true)
dynamicServerTemplate.setRestartMax(10)
dynamicServerTemplate.setStartupTimeout(600)
#
# Create the dynamic cluster, set the number of dynamic servers, and designate the server template.
#
dynCluster=cmo.createCluster("dynamic-cluster")
dynServers=dynCluster.getDynamicServers()
dynServers.setMaximumDynamicServerCount(10)
dynServers.setServerTemplate(dynamicServerTemplate)
#
# Dynamic server names will be dynamic-server-1, dynamic-server-2, ...,
# dynamic-server-10.
#
dynServers.setServerNamePrefix("dynamic-server-")
#
# Listen ports and machines assignments will be calculated. Using a round-robin
# algorithm, servers will be assigned to machines with names that start with
# dyn-machine.
#
dynServers.setCalculatedMachineNames(true)
dynServers.setMachineNameMatchExpression("dyn-machine*")
#
# activate the changes
#
activate()

The resulting config.xml file is:

<server-template> 
    <name>dynamic-cluster-server-template</name>
    <accept-backlog>2000</accept-backlog>
    <auto-restart>true</auto-restart>
    <restart-max>10</restart-max>
    <startup-timeout>600</startup-timeout>
</server-template>

<cluster>
    <name>dynamic-cluster</name>
    <dynamic-servers>
      <server-template>dynamic-cluster-server-template</server-template>
      <maximum-dynamic-server-count>10</maximum-dynamic-server-count>
      <calculated-machine-names>true</calculated-machine-names>
      <machine-name-match-expression>dyn-machine*</machine-name-match-expression>
      <server-name-prefix>dynamic-server-</server-name-prefix>
    </dynamic-servers>
</cluster>