Dynamic Metrics
Dynamic metrics are registered (for required node types) in the applicationContext.xml
file (RED5_HOME/webapps/streammanager/WEB-INF/applicationContext.xml
).
<bean id="freeConnectionSlotsMetric"
class="com.red5pro.services.streammanager.nodes.metrics.MetricRule">
<property name="metricName">
<value>clientCount</value>
</property>
<property name="unit">
<value>PERCENTAGE</value>
</property>
<property name="minValue">
<value>0</value>
</property>
<property name="maxValue">
<value>100</value>
</property>
<property name="direction">
<value>LOWERBETTER</value>
</property>
<property name="metricWeight">
<value>${instanceevaluator.streams.metricweight}</value>
</property>
</bean>
<bean id="streamCountMetric"
class="com.red5pro.services.streammanager.nodes.metrics.MetricRule">
<property name="metricName">
<value>publisherCount</value>
</property>
<property name="unit">
<value>PERCENTAGE</value>
</property>
<property name="minValue">
<value>0</value>
</property>
<property name="maxValue">
<value>100</value>
</property>
<property name="direction">
<value>LOWERBETTER</value>
</property>
<property name="metricWeight">
<value>${instanceevaluator.streams.metricweight}</value>
</property>
</bean>
<bean id="availableMemoryMetric"
class="com.red5pro.services.streammanager.nodes.metrics.MetricRule">
<property name="metricName">
<value>availableMemory</value>
</property>
<property name="unit">
<value>PERCENTAGE</value>
</property>
<property name="minValue">
<value>0</value>
</property>
<property name="maxValue">
<value>100</value>
</property>
<property name="direction">
<value>HIGHERBETTER</value>
</property>
<property name="metricWeight">
<value>${instanceevaluator.memory.metricweight}</value>
</property>
</bean>
<bean id="subscriberCountMetric"
class="com.red5pro.services.streammanager.nodes.metrics.MetricRule">
<property name="metricName">
<value>edgeSubscriberCount</value>
</property>
<property name="unit">
<value>PERCENTAGE</value>
</property>
<property name="minValue">
<value>0</value>
</property>
<property name="maxValue">
<value>100</value>
</property>
<property name="direction">
<value>LOWERBETTER</value>
</property>
<property name="metricWeight">
<value>${instanceevaluator.subscribers.metricweight}</value>
</property>
</bean>
<bean id="restreamerCountMetric"
class="com.red5pro.services.streammanager.nodes.metrics.MetricRule">
<property name="metricName">
<value>restreamerCount</value>
</property>
<property name="unit">
<value>PERCENTAGE</value>
</property>
<property name="minValue">
<value>0</value>
</property>
<property name="maxValue">
<value>100</value>
</property>
<property name="direction">
<value>LOWERBETTER</value>
</property>
<property name="metricWeight">
<value>${instanceevaluator.restreamer.metricweight}</value>
</property>
</bean>
<bean id="serverMetricsEvaluator" class="com.red5pro.services.streammanager.nodes.component.InstanceMetricsRuleManager">
<property name="originMetricRules">
<list value-type="com.red5pro.services.streammanager.nodes.metrics.MetricRule">
<ref bean="freeConnectionSlotsMetric"></ref> <!-- dynamically injected metrics -->
<ref bean="streamCountMetric"></ref> <!-- dynamically injected metrics -->
<ref bean="subscriberCountMetric"></ref> <!-- dynamically injected metrics -->
</list>
</property>
<property name="edgeMetricRules">
<list value-type="com.red5pro.services.streammanager.nodes.metrics.MetricRule">
<ref bean="freeConnectionSlotsMetric"></ref> <!-- dynamically injected metrics -->
<ref bean="availableMemoryMetric"></ref> <!-- dynamically injected metrics -->
</list>
</property>
<property name="relayMetricRules">
<list value-type="com.red5pro.services.streammanager.nodes.metrics.MetricRule">
<ref bean="restreamerCountMetric"></ref> <!-- dynamically injected metrics -->
<ref bean="availableMemoryMetric"></ref> <!-- dynamically injected metrics -->
</list>
</property>
</bean>
Each of the above dynamic metrics is expressed in percentage
. The weight value, supplied via the configuration file during initialization is attached to the max possible value (100%) for that metric. As the connection, memory load of the node increases, the overall evaluated weight
for it decreases. This is then compared with the evaluated weight
of other candidate nodes in the category to select the best node.
Each metric rule
property, listed under the serverMetricsEvaluator
java bean, groups individual dynamic metrics required for evaluation of node score
for a specific node type.
- To exclude a dynamic metric from
origin
score calculation, omit or comment out the metric from theoriginMetricRules
list property in theserverMetricsEvaluator
bean. - To exclude a dynamic metric from
edge
score calculation, omit or comment out the metric from the ‘edgeMetricRules’ list property in theserverMetricsEvaluator
bean. - To exclude a dynamic metric from
relay
score calculation, omit or comment out the metric from the ‘relayMetricRules’ list property in theserverMetricsEvaluator
bean.
Generally, you do not need to edit anything in the applicationContext file. You can control most of the required settings from the red5-web.properties
file.
Refer to METRIC WEIGHTS FOR BEST NODE EVALUATION SECTION discussed in the Stream Manager Configurable Properties topic.