Search in sources :

Example 1 with NioNetworking

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()));
}
Also used : TcpServerContext(com.hazelcast.internal.server.tcp.TcpServerContext) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) TcpServerConnectionChannelErrorHandler(com.hazelcast.internal.server.tcp.TcpServerConnectionChannelErrorHandler) LoggingServiceImpl(com.hazelcast.logging.impl.LoggingServiceImpl) ILogger(com.hazelcast.logging.ILogger) NioNetworking(com.hazelcast.internal.networking.nio.NioNetworking) TcpServerConnectionChannelErrorHandler(com.hazelcast.internal.server.tcp.TcpServerConnectionChannelErrorHandler) ChannelErrorHandler(com.hazelcast.internal.networking.ChannelErrorHandler)

Example 2 with NioNetworking

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;
}
Also used : NioThread(com.hazelcast.internal.networking.nio.NioThread) ServerConnectionManager(com.hazelcast.internal.server.ServerConnectionManager) NioChannel(com.hazelcast.internal.networking.nio.NioChannel) ServerConnection(com.hazelcast.internal.server.ServerConnection) TcpServerConnection(com.hazelcast.internal.server.tcp.TcpServerConnection) NioNetworking(com.hazelcast.internal.networking.nio.NioNetworking) NioOutboundPipeline(com.hazelcast.internal.networking.nio.NioOutboundPipeline) TcpServer(com.hazelcast.internal.server.tcp.TcpServer) TcpServerConnection(com.hazelcast.internal.server.tcp.TcpServerConnection) NioInboundPipeline(com.hazelcast.internal.networking.nio.NioInboundPipeline)

Example 3 with NioNetworking

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();
}
Also used : NioNetworking(com.hazelcast.internal.networking.nio.NioNetworking) TcpServer(com.hazelcast.internal.server.tcp.TcpServer)

Example 4 with NioNetworking

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()));
}
Also used : CandidateClusterContext(com.hazelcast.client.impl.clientside.CandidateClusterContext) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) NioNetworking(com.hazelcast.internal.networking.nio.NioNetworking)

Aggregations

NioNetworking (com.hazelcast.internal.networking.nio.NioNetworking)4 TcpServer (com.hazelcast.internal.server.tcp.TcpServer)2 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)2 CandidateClusterContext (com.hazelcast.client.impl.clientside.CandidateClusterContext)1 ChannelErrorHandler (com.hazelcast.internal.networking.ChannelErrorHandler)1 NioChannel (com.hazelcast.internal.networking.nio.NioChannel)1 NioInboundPipeline (com.hazelcast.internal.networking.nio.NioInboundPipeline)1 NioOutboundPipeline (com.hazelcast.internal.networking.nio.NioOutboundPipeline)1 NioThread (com.hazelcast.internal.networking.nio.NioThread)1 ServerConnection (com.hazelcast.internal.server.ServerConnection)1 ServerConnectionManager (com.hazelcast.internal.server.ServerConnectionManager)1 TcpServerConnection (com.hazelcast.internal.server.tcp.TcpServerConnection)1 TcpServerConnectionChannelErrorHandler (com.hazelcast.internal.server.tcp.TcpServerConnectionChannelErrorHandler)1 TcpServerContext (com.hazelcast.internal.server.tcp.TcpServerContext)1 ILogger (com.hazelcast.logging.ILogger)1 LoggingServiceImpl (com.hazelcast.logging.impl.LoggingServiceImpl)1