use of com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel in project hazelcast by hazelcast.
the class DefaultNodeContext method createTcpIpConnectionThreadingModel.
private IOThreadingModel createTcpIpConnectionThreadingModel(Node node, NodeIOService ioService) {
boolean spinning = Boolean.getBoolean("hazelcast.io.spinning");
LoggingServiceImpl loggingService = node.loggingService;
SocketWriterInitializerImpl socketWriterInitializer = new SocketWriterInitializerImpl(loggingService.getLogger(SocketWriterInitializerImpl.class));
SocketReaderInitializerImpl socketReaderInitializer = new SocketReaderInitializerImpl(loggingService.getLogger(SocketReaderInitializerImpl.class));
if (spinning) {
return new SpinningIOThreadingModel(loggingService, node.getHazelcastThreadGroup(), ioService.getIoOutOfMemoryHandler(), socketWriterInitializer, socketReaderInitializer);
} else {
return new NonBlockingIOThreadingModel(loggingService, node.nodeEngine.getMetricsRegistry(), node.getHazelcastThreadGroup(), ioService.getIoOutOfMemoryHandler(), ioService.getInputSelectorThreadCount(), ioService.getOutputSelectorThreadCount(), ioService.getBalancerIntervalSeconds(), socketWriterInitializer, socketReaderInitializer);
}
}
use of com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel in project hazelcast by hazelcast.
the class ClientConnectionManagerImpl method initIOThreads.
protected void initIOThreads(HazelcastClientInstanceImpl client) {
HazelcastProperties properties = client.getProperties();
boolean directBuffer = properties.getBoolean(SOCKET_CLIENT_BUFFER_DIRECT);
SSLConfig sslConfig = client.getClientConfig().getNetworkConfig().getSSLConfig();
boolean sslEnabled = sslConfig != null && sslConfig.isEnabled();
int configuredInputThreads = properties.getInteger(ClientProperty.IO_INPUT_THREAD_COUNT);
int configuredOutputThreads = properties.getInteger(ClientProperty.IO_OUTPUT_THREAD_COUNT);
int inputThreads;
if (configuredInputThreads == -1) {
inputThreads = sslEnabled ? DEFAULT_SSL_THREAD_COUNT : 1;
} else {
inputThreads = configuredInputThreads;
}
int outputThreads;
if (configuredOutputThreads == -1) {
outputThreads = sslEnabled ? DEFAULT_SSL_THREAD_COUNT : 1;
} else {
outputThreads = configuredOutputThreads;
}
ioThreadingModel = new NonBlockingIOThreadingModel(client.getLoggingService(), client.getMetricsRegistry(), new HazelcastThreadGroup(client.getName(), logger, client.getClientConfig().getClassLoader()), outOfMemoryHandler, inputThreads, outputThreads, properties.getInteger(ClientProperty.IO_BALANCER_INTERVAL_SECONDS), new ClientSocketWriterInitializer(getBufferSize(), directBuffer), new ClientSocketReaderInitializer(getBufferSize(), directBuffer));
}
use of com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel in project hazelcast by hazelcast.
the class IOBalancerStressTest method debug.
public String debug(TcpIpConnectionManager connectionManager) {
NonBlockingIOThreadingModel threadingModel = (NonBlockingIOThreadingModel) connectionManager.getIoThreadingModel();
StringBuffer sb = new StringBuffer();
sb.append("in selectors\n");
for (NonBlockingIOThread in : threadingModel.getInputThreads()) {
sb.append(in + ": " + in.getEventCount() + "\n");
for (TcpIpConnection connection : connectionManager.getActiveConnections()) {
NonBlockingSocketReader socketReader = (NonBlockingSocketReader) connection.getSocketReader();
if (socketReader.getOwner() == in) {
sb.append("\t" + socketReader + " eventCount:" + socketReader.getEventCount() + "\n");
}
}
}
sb.append("out selectors\n");
for (NonBlockingIOThread in : threadingModel.getOutputThreads()) {
sb.append(in + ": " + in.getEventCount() + "\n");
for (TcpIpConnection connection : connectionManager.getActiveConnections()) {
NonBlockingSocketWriter socketWriter = (NonBlockingSocketWriter) connection.getSocketWriter();
if (socketWriter.getOwner() == in) {
sb.append("\t" + socketWriter + " eventCount:" + socketWriter.getEventCount() + "\n");
}
}
}
return sb.toString();
}
Aggregations