Package org.voltdb

Examples of org.voltdb.ServerThread


        pb.addDefaultSchema();
        pb.addDefaultPartitioning();
        pb.addProcedures(InsertOrderLineBatched.class, ResetWarehouse.class);
        pb.compile(catalog);

        ServerThread server = new ServerThread(catalog,  BackendTarget.NATIVE_EE_JNI);
        server.start();
        server.waitForInitialization();
        Client client = ClientFactory.createClient();
        client.createConnection(null, "localhost", HStoreConstants.DEFAULT_PORT, "program", "none");

        Date generationDateTime = new Date();
        long tm = System.currentTimeMillis();

        System.out.println("making order line table...");
        tm = System.currentTimeMillis();
        // int BATCH_SIZE = parameters.districtsPerWarehouse * (parameters.customersPerDistrict / 30);
        int BATCH_SIZE = 1000;
        long[] b_ol_o_id = new long[BATCH_SIZE];
        long[] b_ol_d_id = new long[BATCH_SIZE];
        long[] b_ol_number = new long[BATCH_SIZE];
        long[] b_ol_i_id = new long[BATCH_SIZE];
        long[] b_ol_supply_w_id = new long[BATCH_SIZE];
        Date[] b_ol_delivery_d = new Date[BATCH_SIZE];
        long[] b_ol_quantity = new long[BATCH_SIZE];
        double[] b_ol_amount = new double[BATCH_SIZE];
        String[] b_ol_dist_info = new String[BATCH_SIZE];
        int total = 0;
        int batch_cnt = 0;
        int w_id = 1;
        int customersPerDistrictAfterInsertion = (int) (parameters.customersPerDistrict * 3.0);
        for (int d_id = 1; d_id <= parameters.districtsPerWarehouse; ++d_id) {
            for (int o_id = 1; o_id <= customersPerDistrictAfterInsertion; ++o_id) { //10% more
                // Generate each OrderLine for the order
                long o_ol_cnt = generator.number(TPCCConstants.MIN_OL_CNT, TPCCConstants.MAX_OL_CNT);
                boolean newOrder =
                    parameters.customersPerDistrict - parameters.newOrdersPerDistrict < o_id;
                for (int ol_number = 1; ol_number <= o_ol_cnt; ++ol_number) {
                    //generateOrderLine(w_id, d_id, o_id, ol_number, newOrder);
                    //(long ol_w_id, long ol_d_id, long ol_o_id, long ol_number, boolean newOrder)
                    b_ol_o_id[batch_cnt] = o_id;
                    b_ol_d_id[batch_cnt] = d_id;
                    b_ol_number[batch_cnt] = ol_number;
                    b_ol_i_id[batch_cnt] = generator.number(1, parameters.num_items);
                    b_ol_supply_w_id[batch_cnt] = w_id;
                    b_ol_delivery_d[batch_cnt] = generationDateTime;
                    b_ol_quantity[batch_cnt] = TPCCConstants.INITIAL_QUANTITY;

                    if (!newOrder) {
                        b_ol_amount[batch_cnt] = 0.00;
                    } else {
                        b_ol_amount[batch_cnt] = generator.fixedPoint(TPCCConstants.MONEY_DECIMALS, TPCCConstants.MIN_AMOUNT,
                                TPCCConstants.MAX_PRICE * TPCCConstants.MAX_OL_QUANTITY);
                        b_ol_delivery_d[batch_cnt] = null;
                    }
                    b_ol_dist_info[batch_cnt] = generator.astring(TPCCConstants.DIST, TPCCConstants.DIST);
                    ++batch_cnt;
                    if (batch_cnt == BATCH_SIZE) {
                        total += BATCH_SIZE;
                        System.out.println ("loading: " + total + "/" + (parameters.districtsPerWarehouse * customersPerDistrictAfterInsertion * (TPCCConstants.MAX_OL_CNT - TPCCConstants.MIN_OL_CNT)));
                        client.callProcedure(InsertOrderLineBatched.class.getSimpleName(),
                            b_ol_o_id, b_ol_d_id, w_id, b_ol_number, b_ol_i_id,
                            b_ol_supply_w_id, b_ol_delivery_d, b_ol_quantity, b_ol_amount, b_ol_dist_info);
                        batch_cnt = 0;
                    }
                }
            }
        }

        System.out.println("created " + (System.currentTimeMillis() - tm) + "ms");
        tm = System.currentTimeMillis();

        //delete the 10% orderline
        client.callProcedure(ResetWarehouse.class.getSimpleName(),
                1L,
                (long) parameters.districtsPerWarehouse,
                (long) parameters.customersPerDistrict,
                (long) parameters.newOrdersPerDistrict);
        System.out.println("deleted " + (System.currentTimeMillis() - tm) + "ms");
        tm = System.currentTimeMillis();
        server.shutdown();
    }
View Full Code Here


//        config.m_profilingLevel = ProcedureProfiler.Level.DISABLED;

        this.catalogContext = CatalogUtil.loadCatalogContextFromJar(m_jarFileName);
        HStoreConf hstore_conf = HStoreConf.singleton(HStoreConf.isInitialized() == false);
        hstore_conf.loadFromArgs(this.confParams);
        m_server = new ServerThread(this.catalogContext, hstore_conf, 0);
        m_server.start();
        m_server.waitForInitialization();
    }
View Full Code Here

        for (Site catalog_site : catalogContext.sites) {
            final int site_id = catalog_site.getId();
           
            // If this is the first site, then start the HStoreSite in this JVM
            if (site_id == 0) {
                m_localServer = new ServerThread(this.catalogContext, hstore_conf, site_id);
                m_localServer.start();
                if (logtime) {
                    System.out.println("********** Started in-process HStoreSite [siteId=" + site_id + "]");
                    System.out.flush();
                }
View Full Code Here

        pb.addProcedures(ALL_PROCEDURES);
        pb.addSupplementalClasses(SUPPLEMENTALS);
        pb.compile(catalogJar, siteCount, 0);

        // start VoltDB server using hzsqlsb backend
        server = new ServerThread(catalogJar, target);
        server.start();
        server.waitForInitialization();

        client = ClientFactory.createClient();
        // connect
View Full Code Here

        assertTrue(success);
        MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);
        Configuration config = new Configuration();
        config.m_pathToCatalog = pathToCatalog;
        config.m_pathToDeployment = pathToDeployment;
        localServer = new ServerThread(config);
        client = null;

        localServer.start();
        localServer.waitForInitialization();
View Full Code Here

        assert(success);

        VoltDB.Configuration config = new VoltDB.Configuration();
        config.m_pathToCatalog = Configuration.getPathToCatalogForTest("jsonperf.jar");
        config.m_pathToDeployment = builder.getPathToDeployment();
        ServerThread server = new ServerThread(config);
        server.start();
        server.waitForInitialization();

        Client client = ClientFactory.createClient();
        client.createConnection("localhost");

        ClientResponse response1;
View Full Code Here

            }
        }
    }

    public void JSONBench(int clientCount, int iterations) throws Exception {
        ServerThread server = startup();
        Thread.sleep(1000);

        JSONClient[] clients = new JSONClient[clientCount];
        for (int i = 0; i < clientCount; i++)
            clients[i] = new JSONClient(i, iterations);

        long execTime = 0;

        long start = System.nanoTime();
        for (JSONClient client : clients) {
            client.start();
        }
        for (JSONClient client : clients) {
            client.join();
            execTime += client.totalExecTime;
        }

        long finish = System.nanoTime();

        double seconds = (finish - start) / (1000d * 1000d * 1000d);
        double rate = (iterations * clientCount) / seconds;
        double latency = execTime / (double) (iterations * clientCount);
        latency /= 1000d * 1000d;

        System.out.printf("Simple bench did %.2f iterations / sec at %.2f ms latency per txn.\n", rate, latency);

        server.shutdown();
        server.join();
    }
View Full Code Here

            System.exit(-1);
        }
        String pathToDeployment = project.getPathToDeployment();

        // start up voltdb
        ServerThread server = new ServerThread(Configuration.getPathToCatalogForTest("poc.jar"), pathToDeployment, BackendTarget.NATIVE_EE_JNI);
        server.start();
        server.waitForInitialization();

        final org.voltdb.client.Client voltclient = ClientFactory.createClient();
        voltclient.createConnection("localhost");

        // create initial items
        voltclient.callProcedure("CreateItem", 0, 10);
        voltclient.callProcedure("CreateItem", 1, 11);
        voltclient.callProcedure("CreateItem", 2, 12);

        // check that the query does the right thing
        VoltTable result = voltclient.callProcedure("GetItems",11,1,1).getResults()[0];
        System.out.println(result.toJSONString());
        if (result.getRowCount() != 1) {
            System.err.printf("Call failed with %d rows\n", result.getRowCount());
        }

        // clean up / shutdown
        voltclient.close();
        server.shutdown();
        server.join();
    }
View Full Code Here

        config.m_pathToCatalog = Configuration.getPathToCatalogForTest("simple.jar");
        System.out.println("catalog path: " + config.m_pathToCatalog);
        config.m_pathToDeployment = Configuration.getPathToCatalogForTest("simple.xml");
        System.out.println("deployment path: " + config.m_pathToDeployment);
        config.m_port = VoltDB.DEFAULT_PORT;
        ServerThread server = new ServerThread(config);
        server.start();

        server.join();
    }
View Full Code Here

            depBuilder.writeXML(Configuration.getPathToCatalogForTest("timeouts.xml"));

            VoltDB.Configuration config = new VoltDB.Configuration();
            config.m_pathToCatalog = Configuration.getPathToCatalogForTest("timeouts.jar");
            config.m_pathToDeployment = Configuration.getPathToCatalogForTest("timeouts.xml");
            localServer = new ServerThread(config);
            localServer.start();
            localServer.waitForInitialization();
        }
        catch (Exception e) {
            e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.voltdb.ServerThread

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.