use of com.hazelcast.internal.networking.nio.NioNetworking in project hazelcast by hazelcast.
the class DefaultNodeContext method createNetworking.
private Networking createNetworking(Node node) {
LoggingServiceImpl loggingService = node.loggingService;
ILogger logger = loggingService.getLogger(TcpServerConnectionChannelErrorHandler.class);
ChannelErrorHandler errorHandler = new TcpServerConnectionChannelErrorHandler(logger);
HazelcastProperties props = node.getProperties();
return new NioNetworking(new NioNetworking.Context().loggingService(loggingService).metricsRegistry(node.nodeEngine.getMetricsRegistry()).threadNamePrefix(node.hazelcastInstance.getName()).errorHandler(errorHandler).inputThreadCount(props.getInteger(IO_INPUT_THREAD_COUNT)).inputThreadAffinity(newSystemThreadAffinity("hazelcast.io.input.thread.affinity")).outputThreadCount(props.getInteger(IO_OUTPUT_THREAD_COUNT)).outputThreadAffinity(newSystemThreadAffinity("hazelcast.io.output.thread.affinity")).balancerIntervalSeconds(props.getInteger(IO_BALANCER_INTERVAL_SECONDS)).writeThroughEnabled(props.getBoolean(IO_WRITE_THROUGH_ENABLED)).concurrencyDetection(node.nodeEngine.getConcurrencyDetection()));
}
use of com.hazelcast.internal.networking.nio.NioNetworking in project hazelcast by hazelcast.
the class IOBalancerStressTest method debug.
private StringBuilder debug(HazelcastInstance hz) {
TcpServer networkingService = (TcpServer) getNode(hz).getServer();
NioNetworking networking = (NioNetworking) networkingService.getNetworking();
ServerConnectionManager cm = getNode(hz).getServer().getConnectionManager(EndpointQualifier.MEMBER);
StringBuilder sb = new StringBuilder();
sb.append("in owners\n");
for (NioThread in : networking.getInputThreads()) {
sb.append(in).append(": ").append(in.getEventCount()).append("\n");
for (ServerConnection connection : cm.getConnections()) {
TcpServerConnection tcpConnection = (TcpServerConnection) connection;
NioInboundPipeline inboundPipeline = ((NioChannel) tcpConnection.getChannel()).inboundPipeline();
if (inboundPipeline.owner() == in) {
sb.append("\t").append(inboundPipeline).append(" load: ").append(inboundPipeline.load()).append("\n");
}
}
}
sb.append("out owners\n");
for (NioThread in : networking.getOutputThreads()) {
sb.append(in).append(": ").append(in.getEventCount()).append("\n");
for (ServerConnection connection : cm.getConnections()) {
TcpServerConnection tcpConnection = (TcpServerConnection) connection;
NioOutboundPipeline outboundPipeline = ((NioChannel) tcpConnection.getChannel()).outboundPipeline();
if (outboundPipeline.owner() == in) {
sb.append("\t").append(outboundPipeline).append(" load:").append(outboundPipeline.load()).append("\n");
}
}
}
return sb;
}
use of com.hazelcast.internal.networking.nio.NioNetworking in project hazelcast by hazelcast.
the class IOBalancerMemoryLeakTest method getIoBalancer.
private static IOBalancer getIoBalancer(HazelcastInstance instance) {
TcpServer ns = (TcpServer) getNode(instance).getServer();
NioNetworking threadingModel = (NioNetworking) ns.getNetworking();
return threadingModel.getIOBalancer();
}
use of com.hazelcast.internal.networking.nio.NioNetworking in project hazelcast by hazelcast.
the class TcpClientConnectionManager method initNetworking.
protected NioNetworking initNetworking() {
HazelcastProperties properties = client.getProperties();
int configuredInputThreads = properties.getInteger(IO_INPUT_THREAD_COUNT);
int configuredOutputThreads = properties.getInteger(IO_OUTPUT_THREAD_COUNT);
int inputThreads;
if (configuredInputThreads == -1) {
if (isSmartRoutingEnabled && RuntimeAvailableProcessors.get() > SMALL_MACHINE_PROCESSOR_COUNT) {
inputThreads = DEFAULT_SMART_CLIENT_THREAD_COUNT;
} else {
inputThreads = 1;
}
} else {
inputThreads = configuredInputThreads;
}
int outputThreads;
if (configuredOutputThreads == -1) {
if (isSmartRoutingEnabled && RuntimeAvailableProcessors.get() > SMALL_MACHINE_PROCESSOR_COUNT) {
outputThreads = DEFAULT_SMART_CLIENT_THREAD_COUNT;
} else {
outputThreads = 1;
}
} else {
outputThreads = configuredOutputThreads;
}
return new NioNetworking(new NioNetworking.Context().loggingService(client.getLoggingService()).metricsRegistry(client.getMetricsRegistry()).threadNamePrefix(client.getName()).errorHandler(new ClientConnectionChannelErrorHandler()).inputThreadCount(inputThreads).inputThreadAffinity(newSystemThreadAffinity("hazelcast.client.io.input.thread.affinity")).outputThreadCount(outputThreads).outputThreadAffinity(newSystemThreadAffinity("hazelcast.client.io.output.thread.affinity")).balancerIntervalSeconds(properties.getInteger(IO_BALANCER_INTERVAL_SECONDS)).writeThroughEnabled(properties.getBoolean(IO_WRITE_THROUGH_ENABLED)).concurrencyDetection(client.getConcurrencyDetection()));
}
Aggregations