use of io.netty.util.HashedWheelTimer in project pinot by linkedin.
the class BrokerServerBuilder method buildNetwork.
public void buildNetwork() throws ConfigurationException {
// build transport
Configuration transportConfigs = _config.subset(TRANSPORT_CONFIG_PREFIX);
TransportClientConf conf = new TransportClientConf();
conf.init(transportConfigs);
_registry = new MetricsRegistry();
MetricsHelper.initializeMetrics(_config.subset(METRICS_CONFIG_PREFIX));
MetricsHelper.registerMetricsRegistry(_registry);
_brokerMetrics = new BrokerMetrics(_registry, !emitTableLevelMetrics());
_brokerMetrics.initializeGlobalMeters();
_state.set(State.INIT);
_eventLoopGroup = new NioEventLoopGroup();
/**
* Some of the client metrics uses histogram which is doing synchronous operation.
* These are fixed overhead per request/response.
* TODO: Measure the overhead of this.
*/
final NettyClientMetrics clientMetrics = new NettyClientMetrics(_registry, "client_");
// Setup Netty Connection Pool
_resourceManager = new PooledNettyClientResourceManager(_eventLoopGroup, new HashedWheelTimer(), clientMetrics);
_poolTimeoutExecutor = new ScheduledThreadPoolExecutor(50);
// _requestSenderPool = MoreExecutors.sameThreadExecutor();
_requestSenderPool = Executors.newCachedThreadPool();
final ConnectionPoolConfig connPoolCfg = conf.getConnPool();
_connPool = new KeyedPoolImpl<ServerInstance, NettyClientConnection>(connPoolCfg.getMinConnectionsPerServer(), connPoolCfg.getMaxConnectionsPerServer(), connPoolCfg.getIdleTimeoutMs(), connPoolCfg.getMaxBacklogPerServer(), _resourceManager, _poolTimeoutExecutor, _requestSenderPool, _registry);
// MoreExecutors.sameThreadExecutor(), _registry);
_resourceManager.setPool(_connPool);
// Setup Routing Table
if (conf.getRoutingMode() == RoutingMode.CONFIG) {
final CfgBasedRouting rt = new CfgBasedRouting();
rt.init(conf.getCfgBasedRouting());
_routingTable = rt;
} else {
// Helix based routing is already initialized.
}
// Setup ScatterGather
_scatterGather = new ScatterGatherImpl(_connPool, _requestSenderPool);
// Setup Broker Request Handler
ReduceServiceRegistry reduceServiceRegistry = buildReduceServiceRegistry();
_requestHandler = new BrokerRequestHandler(_routingTable, _timeBoundaryService, _scatterGather, reduceServiceRegistry, _brokerMetrics, _config);
LOGGER.info("Network initialized !!");
}
use of io.netty.util.HashedWheelTimer in project async-http-client by AsyncHttpClient.
the class DefaultAsyncHttpClient method newNettyTimer.
private Timer newNettyTimer() {
HashedWheelTimer timer = new HashedWheelTimer();
timer.start();
return timer;
}
use of io.netty.util.HashedWheelTimer in project bookkeeper by apache.
the class TestRackawareEnsemblePlacementPolicyUsingScript method setUp.
@Before
public void setUp() throws Exception {
conf.setProperty(REPP_DNS_RESOLVER_CLASS, ScriptBasedMapping.class.getName());
conf.setProperty(CommonConfigurationKeys.NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY, "src/test/resources/networkmappingscript.sh");
timer = new HashedWheelTimer(new ThreadFactoryBuilder().setNameFormat("TestTimer-%d").build(), conf.getTimeoutTimerTickDurationMs(), TimeUnit.MILLISECONDS, conf.getTimeoutTimerNumTicks());
repp = new RackawareEnsemblePlacementPolicy();
repp.initialize(conf, Optional.<DNSToSwitchMapping>empty(), timer, DISABLE_ALL, NullStatsLogger.INSTANCE);
}
use of io.netty.util.HashedWheelTimer in project bookkeeper by apache.
the class TestRegionAwareEnsemblePlacementPolicy method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
StaticDNSResolver.reset();
updateMyRack(NetworkTopology.DEFAULT_REGION_AND_RACK);
LOG.info("Set up static DNS Resolver.");
conf.setProperty(REPP_DNS_RESOLVER_CLASS, StaticDNSResolver.class.getName());
addr1 = new BookieSocketAddress("127.0.0.2", 3181);
addr2 = new BookieSocketAddress("127.0.0.3", 3181);
addr3 = new BookieSocketAddress("127.0.0.4", 3181);
addr4 = new BookieSocketAddress("127.0.0.5", 3181);
// update dns mapping
StaticDNSResolver.addNodeToRack(addr1.getHostName(), "/r1/rack1");
StaticDNSResolver.addNodeToRack(addr2.getHostName(), NetworkTopology.DEFAULT_REGION_AND_RACK);
StaticDNSResolver.addNodeToRack(addr3.getHostName(), NetworkTopology.DEFAULT_REGION_AND_RACK);
StaticDNSResolver.addNodeToRack(addr4.getHostName(), "/r1/rack2");
ensemble.add(addr1);
ensemble.add(addr2);
ensemble.add(addr3);
ensemble.add(addr4);
writeSet = writeSetFromValues(0, 1, 2, 3);
timer = new HashedWheelTimer(new ThreadFactoryBuilder().setNameFormat("TestTimer-%d").build(), conf.getTimeoutTimerTickDurationMs(), TimeUnit.MILLISECONDS, conf.getTimeoutTimerNumTicks());
repp = new RegionAwareEnsemblePlacementPolicy();
repp.initialize(conf, Optional.<DNSToSwitchMapping>empty(), timer, DISABLE_ALL, NullStatsLogger.INSTANCE);
}
use of io.netty.util.HashedWheelTimer in project bookkeeper by apache.
the class TestRackawarePolicyNotificationUpdates method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
conf.setProperty(REPP_DNS_RESOLVER_CLASS, StaticDNSResolver.class.getName());
StaticDNSResolver.reset();
StaticDNSResolver.addNodeToRack(InetAddress.getLocalHost().getHostAddress(), NetworkTopology.DEFAULT_REGION_AND_RACK);
StaticDNSResolver.addNodeToRack("127.0.0.1", NetworkTopology.DEFAULT_REGION_AND_RACK);
StaticDNSResolver.addNodeToRack("localhost", NetworkTopology.DEFAULT_REGION_AND_RACK);
LOG.info("Set up static DNS Resolver.");
timer = new HashedWheelTimer(new ThreadFactoryBuilder().setNameFormat("TestTimer-%d").build(), conf.getTimeoutTimerTickDurationMs(), TimeUnit.MILLISECONDS, conf.getTimeoutTimerNumTicks());
repp = new RackawareEnsemblePlacementPolicy();
repp.initialize(conf, Optional.<DNSToSwitchMapping>empty(), timer, DISABLE_ALL, NullStatsLogger.INSTANCE);
repp.withDefaultRack(NetworkTopology.DEFAULT_REGION_AND_RACK);
}
Aggregations