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
IHostMetrics s 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, updateServiceTable
getJournal, getLeaderURI, getLocalServiceScore, getServiceScoreForHostname, notify, service, toString
protected void toString(StringBuilder sb)
AbstractLBSPolicy
AbstractLBSPolicy.toString()
- implementation MUST NOT block.toString
in class AbstractHostLBSPolicy
sb
- Buffer where you can write additional state.public void init(javax.servlet.ServletConfig servletConfig, IIndexManager indexManager) throws javax.servlet.ServletException
IHAPolicyLifeCycle
init
in interface IHAPolicyLifeCycle
init
in class AbstractHostLBSPolicy
javax.servlet.ServletException
public void destroy()
IHAPolicyLifeCycle
destroy
in interface IHAPolicyLifeCycle
destroy
in class AbstractHostLBSPolicy
protected Map<String,IHostMetrics> getHostReportForKnownServices(IHostScoringRule scoringRule, ServiceScore[] serviceScores)
IHostMetrics
s 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 AbstractHostLBSPolicy
scoringRule
- 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()
AbstractHostLBSPolicy
IHostScoringRule
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 AbstractHostLBSPolicy
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.