Search in sources :

Example 1 with DefaultClusterMetadataService

use of io.atomix.cluster.impl.DefaultClusterMetadataService in project atomix by atomix.

the class RaftPerformanceTest method createServer.

/**
 * Creates a Raft server.
 */
private RaftServer createServer(Node node, List<Node> members) throws UnknownHostException {
    RaftServerProtocol protocol;
    ManagedMessagingService messagingService;
    if (USE_NETTY) {
        messagingService = (ManagedMessagingService) NettyMessagingService.builder().withEndpoint(node.endpoint()).build().start().join();
        messagingServices.add(messagingService);
        protocol = new RaftServerMessagingProtocol(messagingService, protocolSerializer, endpointMap::get);
    } else {
        protocol = protocolFactory.newServerProtocol(node.id());
    }
    RaftServer.Builder builder = RaftServer.builder(node.id()).withProtocol(protocol).withThreadModel(ThreadModel.THREAD_PER_SERVICE).withClusterService(new DefaultClusterService(node, new DefaultClusterMetadataService(ClusterMetadata.builder().withBootstrapNodes(members).build(), messagingService), messagingService)).withStorage(RaftStorage.builder().withStorageLevel(StorageLevel.MAPPED).withDirectory(new File(String.format("target/perf-logs/%s", node.id()))).withSerializer(storageSerializer).withMaxEntriesPerSegment(32768).withMaxSegmentSize(1024 * 1024).build()).addPrimitiveType(TestPrimitiveType.INSTANCE);
    RaftServer server = builder.build();
    servers.add(server);
    return server;
}
Also used : RaftServerProtocol(io.atomix.protocols.raft.protocol.RaftServerProtocol) DefaultClusterMetadataService(io.atomix.cluster.impl.DefaultClusterMetadataService) RaftServerMessagingProtocol(io.atomix.protocols.raft.protocol.RaftServerMessagingProtocol) ManagedMessagingService(io.atomix.messaging.ManagedMessagingService) DefaultClusterService(io.atomix.cluster.impl.DefaultClusterService) File(java.io.File)

Aggregations

DefaultClusterMetadataService (io.atomix.cluster.impl.DefaultClusterMetadataService)1 DefaultClusterService (io.atomix.cluster.impl.DefaultClusterService)1 ManagedMessagingService (io.atomix.messaging.ManagedMessagingService)1 RaftServerMessagingProtocol (io.atomix.protocols.raft.protocol.RaftServerMessagingProtocol)1 RaftServerProtocol (io.atomix.protocols.raft.protocol.RaftServerProtocol)1 File (java.io.File)1