Package voldemort.store.socket

Examples of voldemort.store.socket.SocketStoreFactory


    @Override
    protected Store<ByteArray, byte[], byte[]> getSocketStore(String storeName,
                                                              String host,
                                                              int port,
                                                              boolean isRouted) {
        SocketStoreFactory storeFactory = new ClientRequestExecutorPool(2,
                                                                        60 * 1000,
                                                                        60 * 1000,
                                                                        32 * 1024);
        RequestRoutingType requestRoutingType = RequestRoutingType.getRequestRoutingType(isRouted,
                                                                                         false);
        return storeFactory.create(storeName,
                                   host,
                                   port,
                                   RequestFormatType.PROTOCOL_BUFFERS,
                                   requestRoutingType);
    }
View Full Code Here


    private StoreClient<String, String> dstGloballyResolvingStoreClient;

    @Before
    public void setUpClusters() {
        // setup four nodes with one store and one partition
        final SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2,
                                                                                    10000,
                                                                                    100000,
                                                                                    32 * 1024);

        try {
View Full Code Here

    @Test
    public void testOnePartitionEndToEndBasedOnVersion() throws Exception {
        long now = System.currentTimeMillis();

        // setup four nodes with one store and one partition
        final SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2,
                                                                                    10000,
                                                                                    100000,
                                                                                    32 * 1024);
        VoldemortServer[] servers = new VoldemortServer[4];
        int partitionMap[][] = { { 0 }, { 1 }, { 2 }, { 3 } };
View Full Code Here

        cluster = getNineNodeCluster();
        storeDef = getStoreDef();

        // create voldemort servers
        for(Integer nodeId = 0; nodeId < NUM_NODES_TOTAL; nodeId++) {
            SocketStoreFactory socketStoreFactory;
            socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
            List<StoreDefinition> stores = new ArrayList<StoreDefinition>();
            stores.add(storeDef);
            VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true,
                                                                                nodeId,
View Full Code Here

    private List<VoldemortServer> servers;
    private StoreClient<String, String> storeClient;

    @Before
    public void setUp() throws Exception {
        SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2,
                                                                              10000,
                                                                              100000,
                                                                              32 * 1024);

        int numServers = 2;
View Full Code Here

     *
     * @return bootstrap url
     */
    public static String setUpCluster() {
        // setup four nodes with one store and one partition
        final SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2,
                                                                                    10000,
                                                                                    100000,
                                                                                    32 * 1024);
        VoldemortServer[] servers = new VoldemortServer[4];
        int partitionMap[][] = { { 0 }, { 1 }, { 2 }, { 3 } };
View Full Code Here

        /** * Do Socket tests ** */
        String storeName = "test";
        StoreRepository repository = new StoreRepository();
        repository.addLocalStore(new InMemoryStorageEngine<ByteArray, byte[], byte[]>(storeName));
        SocketStoreFactory storeFactory = new ClientRequestExecutorPool(10, 1000, 1000, 32 * 1024);
        final Store<ByteArray, byte[], byte[]> socketStore = storeFactory.create(storeName,
                                                                                 "localhost",
                                                                                 6666,
                                                                                 RequestFormatType.VOLDEMORT_V1,
                                                                                 RequestRoutingType.NORMAL);
        RequestHandlerFactory factory = ServerTestUtils.getSocketRequestHandlerFactory(repository);
        AbstractSocketService socketService = ServerTestUtils.getSocketService(useNio,
                                                                               factory,
                                                                               6666,
                                                                               50,
                                                                               50,
                                                                               1000);
        socketService.start();

        PerformanceTest socketWriteTest = new PerformanceTest() {

            @Override
            public void doOperation(int i) {
                byte[] bytes = String.valueOf(i).getBytes();
                ByteArray key = new ByteArray(bytes);
                socketStore.put(key, new Versioned<byte[]>(bytes), null);
            }
        };
        System.out.println("###########################################");
        System.out.println("Performing socket write test.");
        socketWriteTest.run(numRequests, numThreads);
        socketWriteTest.printStats();
        System.out.println();

        PerformanceTest socketReadTest = new PerformanceTest() {

            @Override
            public void doOperation(int i) {
                try {
                    socketStore.get(TestUtils.toByteArray(String.valueOf(i)), null);
                } catch(Exception e) {
                    System.out.println("Failure on i = " + i);
                    e.printStackTrace();
                }
            }
        };
        System.out.println("Performing socket read test.");
        socketReadTest.run(numRequests, 1);
        socketReadTest.printStats();
        System.out.println();
        System.out.println();

        socketStore.close();
        storeFactory.close();
        socketService.stop();

        /** * Do HTTP tests ** */
        repository.addLocalStore(new InMemoryStorageEngine<ByteArray, byte[], byte[]>(storeName));
        HttpService httpService = new HttpService(null,
View Full Code Here

        clientConfig.setBootstrapUrls(cluster.getNodes().iterator().next().getSocketUrl().toString());
        clientConfig.setClientZoneId(clientZoneId);
        setupZoneAffinitySettings();
        SocketStoreClientFactory socketStoreClientFactory = new SocketStoreClientFactory(clientConfig);
        for(Integer nodeId: cluster.getNodeIds()) {
            SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2,
                                                                                  10000,
                                                                                  100000,
                                                                                  1024);
            VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true,
                                                                                nodeId,
View Full Code Here

    @Before
    public void setUp() throws Exception {
        String storesXmlfile = "test/common/voldemort/config/single-store.xml";
        ClientConfig clientConfig = new ClientConfig().setMaxConnectionsPerNode(1).setMaxThreads(1);
        SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(clientConfig.getSelectors(),
                                                                              clientConfig.getMaxConnectionsPerNode(),
                                                                              clientConfig.getConnectionTimeout(TimeUnit.MILLISECONDS),
                                                                              clientConfig.getSocketTimeout(TimeUnit.MILLISECONDS),
                                                                              clientConfig.getSocketBufferSize(),
                                                                              clientConfig.getSocketKeepAlive());
View Full Code Here

                                                Properties properties,
                                                Cluster customCluster) throws IOException {
        boolean started = false;
        Cluster cluster = null;

        SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2,
                                                                              10000,
                                                                              100000,
                                                                              32 * 1024);

        try {
            while(!started) {
                try {
                    cluster = internalStartVoldemortCluster(voldemortServers.length,
                                                            voldemortServers,
                                                            partitionMap,
                                                            socketStoreFactory,
                                                            true,
                                                            clusterFile,
                                                            storeFile,
                                                            properties,
                                                            customCluster);
                    started = true;
                } catch(BindException be) {
                    logger.debug("Caught BindException when starting cluster. Will retry.");
                }
            }
        } finally {
            socketStoreFactory.close();
        }

        return cluster;
    }
View Full Code Here

TOP

Related Classes of voldemort.store.socket.SocketStoreFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.