Ejemplo n.º 1
0
        static void YCSBAsyncTest()
        {
            const int partitionCount     = 1;
            const int recordCount        = 200000;
            const int executorCount      = partitionCount;
            const int txCountPerExecutor = 200000;
            //const bool daemonMode = true;
            const bool   daemonMode    = false;
            const string dataFile      = "ycsb_data_r.in";
            const string operationFile = "ycsb_ops_r.in";

            // VersionDb.UDF_QUEUE = false;

            // an executor is responsiable for all flush
            string[] tables =
            {
                YCSBAsyncBenchmarkTest.TABLE_ID,
                VersionDb.TX_TABLE
            };

            // The default mode of versionDb is daemonMode
            SingletonPartitionedVersionDb versionDb = SingletonPartitionedVersionDb.Instance(partitionCount, daemonMode);
            // SingletonVersionDb versionDb = SingletonVersionDb.Instance(executorCount);
            YCSBAsyncBenchmarkTest test = new YCSBAsyncBenchmarkTest(recordCount,
                                                                     executorCount, txCountPerExecutor, versionDb, tables);

            test.Setup(dataFile, operationFile);
            test.Run();
            test.Stats();

            Console.WriteLine("Enqueued Requests: {0}", SingletonPartitionedVersionDb.EnqueuedRequests);
            //versionDb.Active = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// YCSB async benchmark test on Cassandra with partitions
        /// </summary>
        /// <param name="args"></param>
        static void YCSBAsyncTestWithPartitionedCassandraVersionDb(string[] args)
        {
            BenchmarkTestConfig config = new BenchmarkTestConfig(args);

            int replicationFactor = 3;

            ConsistencyLevel consistencyLevel = ConsistencyLevel.Quorum;

            string[] tables =
            {
                YCSBAsyncBenchmarkTest.TABLE_ID,
                VersionDb.TX_TABLE
            };

            PartitionedCassandraVersionDb versionDb = PartitionedCassandraVersionDb.Instance(config.WorkerCount,
                                                                                             config.Host, replicationFactor, consistencyLevel);
            YCSBAsyncBenchmarkTest test = new YCSBAsyncBenchmarkTest(config.RecordCount, config.WorkerCount,
                                                                     config.WorkloadCount, versionDb, tables, config);

            if (config.LoadRecords)
            {
                test.load(versionDb, config.WorkerCount, config.RecordCount);
            }
            else
            {
                test.prepare();
                test.StartMonitors();
                test.Run2("async");
            }
        }
Ejemplo n.º 3
0
 public DataLoadWorker(VersionDb db, int start, int end, YCSBAsyncBenchmarkTest test)
 {
     this.db    = db;
     this.start = start;
     this.end   = end;
     this.test  = test;
 }
Ejemplo n.º 4
0
        public static void YCSBAsyncTestWithPartitionedCassandra()
        {
            const int partitionCount     = 4;
            const int recordCount        = 100;
            const int executorCount      = 4;
            const int txCountPerExecutor = 250;

            const string dataFile      = "ycsb_data_r.in";
            const string operationFile = "ycsb_ops_r.in";

            string[] tables = new string[]
            {
                VersionDb.TX_TABLE,
                YCSBAsyncBenchmarkTest.TABLE_ID
            };

            // The default mode of versionDb is daemonMode
            PartitionedCassandraVersionDb versionDb = PartitionedCassandraVersionDb.Instance(partitionCount, "127.0.0.1", 1, ConsistencyLevel.One);
            YCSBAsyncBenchmarkTest        test      = new YCSBAsyncBenchmarkTest(recordCount,
                                                                                 executorCount, txCountPerExecutor, versionDb, tables);

            test.Setup(dataFile, operationFile);
            test.Run();
            test.Stats();
        }
Ejemplo n.º 5
0
        // args[0]: dataFile
        // args[1]: opsFile
        // args[2]: partitionCount
        // args[3]: txCountPerExecutor
        static void YCSBAsyncTestWithMemoryVersionDb(string[] args)
        {
            int partitionCount     = 4;
            int executorCount      = partitionCount;
            int txCountPerExecutor = 200000;

            // 20w
            string    dataFile    = "ycsb_data_r.in";
            const int recordCount = 1;
            //100w
            //string dataFile = "ycsb_data_m_r.in";
            //const int recordCount = 1000000;
            // 500w
            //string dataFile = "ycsb_data_lg_r.in";
            //const int recordCount = 5000000;
            // 1000w
            //string dataFile = "ycsb_data_hg_r.in";
            //const int recordCount = 10000000;

            string operationFile = "ycsb_ops_r.in";

            if (args.Length > 1)
            {
                dataFile           = args[0];
                operationFile      = args[1];
                partitionCount     = Int32.Parse(args[2]);
                executorCount      = partitionCount;
                txCountPerExecutor = args.Length > 3 ? Int32.Parse(args[3]) : txCountPerExecutor;
            }

            // these three settings are useless in SingletonVersionDb environment.
            const bool daemonMode = false;

            string[] tables =
            {
                YCSBAsyncBenchmarkTest.TABLE_ID,
                VersionDb.TX_TABLE
            };

            int currentExecutorCount = 1;

            RedisVersionDb versionDb = RedisVersionDb.Instance();
            // SingletonVersionDb versionDb = SingletonVersionDb.Instance(1);
            // SingletonPartitionedVersionDb versionDb = SingletonPartitionedVersionDb.Instance(1, true);
            YCSBAsyncBenchmarkTest test = new YCSBAsyncBenchmarkTest(recordCount,
                                                                     currentExecutorCount, txCountPerExecutor, versionDb, tables);

            test.Setup(dataFile, operationFile);
            for (; currentExecutorCount <= partitionCount; currentExecutorCount++)
            {
                if (currentExecutorCount > 1)
                {
                    versionDb.AddPartition(currentExecutorCount);
                }
                test.ResetAndFillWorkerQueue(operationFile, currentExecutorCount);
                test.Run();
                test.Stats();
            }
        }
Ejemplo n.º 6
0
        public static void YCSBAsyncTestWithCassandra()
        {
            const int partitionCount     = 20;
            const int recordCount        = 500000;
            const int executorCount      = 20;
            const int txCountPerExecutor = 25000;

            const string dataFile      = "ycsb_data_r.in";
            const string operationFile = "ycsb_ops_r.in";

            // an executor is responsiable for all flush
            //List<List<Tuple<string, int>>> instances = new List<List<Tuple<string, int>>>
            //{
            //    new List<Tuple<string, int>>()
            //    {
            //        Tuple.Create(VersionDb.TX_TABLE, 0),
            //        Tuple.Create(YCSBAsyncBenchmarkTest.TABLE_ID, 0)
            //    },
            //    new List<Tuple<string, int>>()
            //    {
            //        Tuple.Create(VersionDb.TX_TABLE, 0),
            //        Tuple.Create(YCSBAsyncBenchmarkTest.TABLE_ID, 0)
            //    },
            //    new List<Tuple<string, int>>()
            //    {
            //        Tuple.Create(VersionDb.TX_TABLE, 0),
            //        Tuple.Create(YCSBAsyncBenchmarkTest.TABLE_ID, 0)
            //    },
            //    new List<Tuple<string, int>>()
            //    {
            //        Tuple.Create(VersionDb.TX_TABLE, 0),
            //        Tuple.Create(YCSBAsyncBenchmarkTest.TABLE_ID, 0)
            //    },
            //};
            string[] tables = new string[]
            {
                VersionDb.TX_TABLE,
                YCSBAsyncBenchmarkTest.TABLE_ID
            };

            //TxResourceManager resourceManager = new TxResourceManager();

            // The default mode of versionDb is daemonMode
            CassandraVersionDb     versionDb = CassandraVersionDb.Instance(partitionCount, 0);
            YCSBAsyncBenchmarkTest test      = new YCSBAsyncBenchmarkTest(recordCount,
                                                                          executorCount, txCountPerExecutor, versionDb, tables);

            test.Setup(dataFile, operationFile);
            test.Run();
            test.Stats();

            Console.WriteLine("done");
            Console.ReadLine();
        }
Ejemplo n.º 7
0
        static void YCSBAsyncTestWithRedisVersionDb(string[] args)
        {
            BenchmarkTestConfig config = args.Length > 1 ? new BenchmarkTestConfig(args) : new BenchmarkTestConfig();

            int partitionCount     = config.WorkerCount;
            int executorCount      = partitionCount;
            int txCountPerExecutor = config.WorkloadCount;
            int recordCount        = config.RecordCount;

            string[] tables =
            {
                YCSBAsyncBenchmarkTest.TABLE_ID,
                VersionDb.TX_TABLE
            };

            string[] readWriteHosts = new string[]
            {
                // config.RedisHost,
                // "8r285aybUZ7+rQ3QgpoorfFodT6+NMDQsxkdfOHAL9w=@txservice.redis.cache.windows.net:6379",
                // "xnke5SdHz5xcsBF+OlZPL7PdzI7Vz3De7ntGI2fIye0=@elastas.redis.cache.windows.net:6379",
                "127.0.0.1:6379",
                //"127.0.0.1:6380",
                //"127.0.0.1:6381",
                //"127.0.0.1:6382",
                //"127.0.0.1:6383",
                //"127.0.0.1:6384",
                //"127.0.0.1:6385",
                //"127.0.0.1:6386",
                //"127.0.0.1:6387",
                //"127.0.0.1:6388",
                //"127.0.0.1:6389",
                //"127.0.0.1:6390",
                //"127.0.0.1:6391",


                //"10.1.9.8:6380",
                //"10.1.9.9:6380",
                //"10.1.9.10:6380",
                //"10.1.9.7:6380",
                //"10.1.9.8:6381",
                //"10.1.9.9:6381",
                //"10.1.9.10:6381",
                //"10.1.9.7:6381",
            };

            RedisVersionDb.PARTITIONS_PER_INSTANCE = config.WorkerPerRedisInstance;
            RedisVersionDb versionDb = RedisVersionDb.Instance(partitionCount, readWriteHosts, RedisVersionDbMode.Partition);

            if (config.MultiProcessMode)
            {
                versionDb.PhysicalTxPartitionByKey = key =>
                {
                    int range = TxRange.GetRange(key);
                    return(range - range / YCSBAsyncBenchmarkTest.RANGE_OFFSET_PER_PROCESS *
                           YCSBAsyncBenchmarkTest.RANGE_OFFSET_PER_PROCESS);
                };
            }

            YCSBAsyncBenchmarkTest test = new YCSBAsyncBenchmarkTest(recordCount,
                                                                     executorCount, txCountPerExecutor, versionDb, tables, config);

            test.Setup(null, null);
            test.Run();
            test.Stats();
        }
Ejemplo n.º 8
0
        public static void YCSBAsyncTestWithPartitionedCassandraHybrid(string[] args)
        {
            string action             = "run";
            int    workerCount        = 500;
            int    taskCountPerWorker = 1000;
            int    partitionCount     = 500; // equal to workerCount

            int runall           = 1;
            int stableRoundStart = 5;
            int stableRoundEnd   = 15;

            /// one data file
            string dataFile = "ycsb_data_u.in";

            /// four kinds of operation(workload) files
            string operationFile = "ycsb_ops_u.in";

            /// <summary>
            /// CassandraVersionDb Single Node parameters
            /// </summary>
            string           contactPoints     = "127.0.0.1";
            int              replicationFactor = 1;
            ConsistencyLevel consistencyLevel  = ConsistencyLevel.One;

            /// <summary>
            /// CassandraVersionDb Cluster parameters - 10 nodes
            /// </summary>
            //string contactPoints = "10.6.0.4,10.6.0.5,10.6.0.6,10.6.0.12,10.6.0.13,10.6.0.14,10.6.0.15,10.6.0.16,10.6.0.17,10.6.0.18";
            //int replicationFactor = 3;
            //ConsistencyLevel consistencyLevel = ConsistencyLevel.Quorum;

            // see YCSBAsyncBenchmarkTest.run2 to know all types
            //string exeType = "ycsb_sync_ro_strk";
            //string exeType = "ycsb_sync_ro_intk"
            //string exeType = "ycsb_sync_wo_intk";
            //string exeType = "ycsb_sync_rw_intk";
            string exeType = "async";
            //string exeType = "cassandra_ro_intk";
            //string exeType = "cassandra_wo_intk";

            int i = 0;

            while (i < args.Length)
            {
                switch (args[i++])
                {
                case "--datafile":
                    dataFile = args[i++];
                    break;

                case "--opsfile":       // unused
                    operationFile = args[i++];
                    break;

                case "--workers":
                    workerCount = int.Parse(args[i++]);
                    break;

                case "--taskspw":
                    taskCountPerWorker = int.Parse(args[i++]);
                    break;

                case "--partitions":        // equal to workers
                    partitionCount = int.Parse(args[i++]);
                    break;

                case "--nodes":
                    contactPoints = args[i++];
                    break;

                case "--replica":           // default 3
                    replicationFactor = int.Parse(args[i++]);
                    break;

                case "--consislevel":       // local: one, cluster: quorum
                    if (args[i++] == "one")
                    {
                        consistencyLevel = ConsistencyLevel.One;
                    }
                    else
                    {
                        consistencyLevel = ConsistencyLevel.Quorum;
                    }
                    break;

                case "--exetype":           //
                    exeType = args[i++];
                    break;

                case "--startround":        // unused
                    stableRoundStart = int.Parse(args[i++]);
                    break;

                case "--endround":          // unused
                    stableRoundEnd = int.Parse(args[i++]);
                    break;

                case "--runall":            // unused
                    runall = int.Parse(args[i++]);
                    break;

                case "--action":            // load/run
                    action = args[i++];
                    break;

                default:
                    break;
                }
            }

            Console.WriteLine("contact points " + contactPoints);
            if (runall == 0 && stableRoundEnd <= stableRoundStart)
            {
                Console.WriteLine("Bad stable round setting");
                return;
            }

            if (action == "load")
            {
                PartitionedCassandraVersionDb versionDb = PartitionedCassandraVersionDb.Instance(partitionCount, contactPoints, replicationFactor, consistencyLevel);
                LoadDataWithSyncForCassandra(dataFile, workerCount, versionDb);
            }
            else if (action == "run")
            {
                string[] tables = new string[]
                {
                    VersionDb.TX_TABLE,
                    YCSBAsyncBenchmarkTest.TABLE_ID
                };

                // The default mode of versionDb is daemonMode
                PartitionedCassandraVersionDb versionDb = PartitionedCassandraVersionDb.Instance(partitionCount, contactPoints, replicationFactor, consistencyLevel);
                YCSBAsyncBenchmarkTest        test      = new YCSBAsyncBenchmarkTest(0,
                                                                                     workerCount, taskCountPerWorker, versionDb, tables);
                if (runall == 0)
                {
                    test.SetStableRound(stableRoundStart, stableRoundEnd);
                }

                // sync test
                //test.SetupOpsNull();

                // async test
                test.SetupOps(operationFile);
                test.StartMonitors();

                test.Run2(exeType);
                test.Stats2();
            }
            else
            {
                Console.WriteLine("bad action. Only <load> or <run> allowed");
            }
        }