Dynamically setting values

The configuration system can dynamically determine values to apply to servers at deployment. You specify alternative values for configuration settings on the channel templates, channels, and environments associated with a deployment. 

Note

Configuration settings on templates, channels, and environments are always in the form of Name=Value pairs. They do not follow the bracketed convention described earlier. The configuration values for these objects are used only to resolve values for specific properties.

For example, suppose you have an environment that contains several MySQL servers. As a general default, you want the MySQL connection timeout value to be 10 seconds for all the MySQL servers in that environment. However, one server uses old hardware and needs more time to respond. So, you want the timeout value on that particular server always to be 60 seconds. First, you specify the environment level default by adding the following text to the environment properties:

MYSQL_CONNECT_TIMEOUT=10

Next, you specify the longer timeout on the channel configuration data for the slow MySQL server in the group:

MYSQL_CONNECT_TIMEOUT=60

You have defined a variable called MYSQL_CONNECT_TIMEOUT on both the environment and the channel, each with a different value. To use these values during deployment, you simply change the reference configuration entry to use this variable:

[Mysql_5][Server][global]connection_timeout=${MYSQL_CONNECT_TIMEOUT}

When this reference is deployed, the value of MYSQL_CONNECT_TIMEOUT is expanded. The deployment process looks for this variable first in the environment configuration settings and next in the channel configuration settings. All of the MySQL servers in the environment initially have a value of 10 for the connect timeout, and that value is set on the target server, except for the special-case server. When deployment occurs to that server, the timeout value on the channel takes precedence and overrides the environment value. This changes the value of the connect timeout to 60 when this configuration setting is applied to that channel.

This expansion mechanism allows different groups of servers to alter configuration data depending on specific environmental needs. The application can specify configuration changes necessary for proper deployment while still allowing server-specific adjustments.

Value expansion also provides for conditional replacement to avoid changing configuration values that might break unrelated but co-installed applications. As an example, suppose an application needs a heap size of at least 10 megabytes. Normally, you would specify a configuration setting to apply this value to the target server:

[MyApp][MyConfig]heap_size_in_meg=10

When this example application is deployed, the heap size is set to 10 MB. A problem occurs if another application on that same server requires 20 MB of heap memory. When this application is deployed, it lowers the setting and breaks the other application. So, you can set property values conditionally. For example, to avoid lowering the configuration value, specify the value as an expansion of the property name with a slight modification:

[MyApp][MyConfig]heap_size_in_meg=${heap_size_in_meg>10}

Adding >10 at the end of the variable name tells the system to look in the channel template, environment, channel, and current configuration for the server for the value of heap_size_in_meg and to use the largest value that is at least 10. If another application has set the value to 20, the system detects that value, which is greater than the requested value, so it sets the value to 20. If no current setting exists or all of the current settings are under 10, then the specified minimum of 10 is used.

You can use name<value to adjust a setting to the lowest current value that is no greater than value.

You can use name=value so that, if name is not found, value is used as a default.

Was this page helpful? Yes No Submitting... Thank you

Comments