-
1. Re: mod cluster plugin for load balancer factor
brian.stansberry Oct 11, 2017 4:30 PM (in response to rocky13)How to wire a custom metric into WildFly is described in the "add-custom-metric / remove-custom-metric" section in mod_cluster Subsystem - WildFly 10 - Project Documentation Editor
The custom metric must implement the org.jboss.modcluster.load.metric.LoadMetric interface in a public class with a public no-arg constructor. It can expose configuration properties, a la what's shown in the doc I linked above. Your LoadMetric impl must expose a public setter for each property. Each configured property, along with the setWeight and setCapacity methods will be invoked before the system makes the first call to getLoad. The org.jboss.modcluster.container.Engine that gets passed to your getLoad(Engine) implementation gives you access to environmental information you may want to use in your calculation. You can also use standard JVM stuff like platform mbeans.
-
2. Re: mod cluster plugin for load balancer factor
rocky13 Oct 11, 2017 7:09 PM (in response to brian.stansberry)Thanks for your response Brian, its really helpful. One more query-
You mentioned about configuration properties in your response. I see below sample in the link you provided, what could be these property names and values?
custom-load-metric
class
=
"myclass"
>
<property name=
"pro1"
value=
"value1"
/>
<property name=
"pro2"
value=
"value2"
/>
</custom-load-metric>
I apologies if its too basic, i am new to this custom metric pluggin creation, so trying to understand.
-
3. Re: mod cluster plugin for load balancer factor
mbabacek Oct 12, 2017 2:13 AM (in response to rocky13)Hi Rocky, simply follow the example code, it is fairly easy: