public class CountersLBSPolicy extends AbstractHostLBSPolicy
Note: This IHALoadBalancerPolicy has a dependency on the
PlatformStatsPlugIn. The plugin must be setup to publish out
performance counters using the CounterServlet. This policy will
periodically query the different HAJournalServer instances to
obtain their current metrics using that CountersServlet.
This is not as efficient as using ganglia. However, this plugin creates fewer dependencies and is significantly easier to administer if the network does not support UDP multicast.
| Modifier and Type | Class and Description |
|---|---|
static interface |
CountersLBSPolicy.InitParams
Servlet
init-param values understood by the
CountersLBSPolicy. |
journalRef, serviceIDRef, serviceTableRef| Constructor and Description |
|---|
CountersLBSPolicy() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the policy (stop any asynchronous processing, release any
resources).
|
protected String |
getDefaultScoringRule()
Return the name of the
IHostScoringRule that provides default
value for the AbstractHostLBSPolicy.InitParams.HOST_SCORING_RULE configuration
parameter. |
protected Map<String,IHostMetrics> |
getHostReportForKnownServices(IHostScoringRule scoringRule,
ServiceScore[] serviceScores)
Return a map from the known canonical hostnames (as self-reported by the
services) of the joined services to the
IHostMetricss for those
hosts. |
void |
init(javax.servlet.ServletConfig servletConfig,
IIndexManager indexManager)
Initialize the policy.
|
protected void |
toString(StringBuilder sb)
Extension hook for
AbstractLBSPolicy.toString() - implementation MUST NOT block. |
conditionallyForwardReadRequest, conditionallyUpdateServiceTable, getHostDiscoveryDelay, getReaderURI, setLocalForwardThreshold, updateHostTable, updateServiceTablegetJournal, getLeaderURI, getLocalServiceScore, getServiceScoreForHostname, notify, service, toStringprotected void toString(StringBuilder sb)
AbstractLBSPolicyAbstractLBSPolicy.toString() - implementation MUST NOT block.toString in class AbstractHostLBSPolicysb - Buffer where you can write additional state.public void init(javax.servlet.ServletConfig servletConfig,
IIndexManager indexManager)
throws javax.servlet.ServletException
IHAPolicyLifeCycleinit in interface IHAPolicyLifeCycleinit in class AbstractHostLBSPolicyjavax.servlet.ServletExceptionpublic void destroy()
IHAPolicyLifeCycledestroy in interface IHAPolicyLifeCycledestroy in class AbstractHostLBSPolicyprotected Map<String,IHostMetrics> getHostReportForKnownServices(IHostScoringRule scoringRule, ServiceScore[] serviceScores)
IHostMetricss for those
hosts.
This implementation issues HTTP requests to obtain the up to date performance counters for each host on which a service is known to be running.
getHostReportForKnownServices in class AbstractHostLBSPolicyscoringRule - The IHostScoringRule to be applied.serviceScores - The set of known services.UUID and
the host metrics were combined into the map once for each
service.protected String getDefaultScoringRule()
AbstractHostLBSPolicyIHostScoringRule that provides default
value for the AbstractHostLBSPolicy.InitParams.HOST_SCORING_RULE configuration
parameter.
Note: The policy needs to be specific to the LBS implementation since the names of the host metrics depend on the system that is being used to collect and report them.
getDefaultScoringRule in class AbstractHostLBSPolicyCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.