public void TestInit() { // RedisVersionDb.Instance.PipelineMode = true; //this.versionDb = RedisVersionDb.Instance; //this.clientManager = ((RedisVersionDb)this.versionDb).RedisManager; //int partition = versionDb.PhysicalPartitionByKey(DEFAULT_KEY); //using (RedisClient redisClient = (RedisClient)this.clientManager.GetClient(TEST_REDIS_DB, partition)) //{ // // 1. flush the test db // redisClient.ChangeDb(TEST_REDIS_DB); // redisClient.FlushDb(); // // 2. create version table, if table is null, it means the table with the same tableId has existed // VersionTable table = this.versionDb.CreateVersionTable(TABLE_ID, TEST_REDIS_DB); // // 3. load data // Transaction tx = new Transaction(null, this.versionDb); // tx.ReadAndInitialize(TABLE_ID, DEFAULT_KEY); // tx.Insert(TABLE_ID, DEFAULT_KEY, DEFAULT_VALUE); // tx.Commit(); //} this.versionDb = CassandraVersionDb.Instance(4); VersionTable table = this.versionDb.CreateVersionTable(TABLE_ID, TEST_REDIS_DB); Transaction tx = new Transaction(null, this.versionDb); tx.ReadAndInitialize(TABLE_ID, DEFAULT_KEY); tx.Insert(TABLE_ID, DEFAULT_KEY, DEFAULT_VALUE); tx.Commit(); }
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(); }
public static void YCSBSyncTestWithCassandra(string[] args) { string[] contactPoints = { "127.0.0.1" }; int replicationFactor = 1; int workerCount = 1; int taskCountPerWorker = 1000; string dataFile = "ycsb_data_r.in"; string operationFile = "ycsb_ops_r.in"; int i = 1; while (i < args.Length) { switch (args[i++]) { case "--contacts": contactPoints = args[i++].Split(','); break; case "--repfactor": replicationFactor = int.Parse(args[i++]); break; case "--workers": workerCount = int.Parse(args[i++]); break; case "--tasks": taskCountPerWorker = int.Parse(args[i++]); break; case "--data": dataFile = args[i++]; break; case "--ops": operationFile = args[i++]; break; default: break; } } //Console.WriteLine("contact points: " + contactPoints.Length); //Console.WriteLine("replica: " + replicationFactor); //Console.WriteLine("worker: " + workerCount); //Console.WriteLine("taskPerWorker: " + taskCountPerWorker); //Console.WriteLine("data: " + dataFile); //Console.WriteLine("ops: " + operationFile); //return; // Cassandra version db int maxVdbCnt = 8192; List <VersionDb> vdbList = new List <VersionDb>(); for (int j = 0; j < maxVdbCnt; j++) { vdbList.Add(CassandraVersionDb.Instance(1, j)); } YCSBBenchmarkTest test = new YCSBBenchmarkTest(0, 0, vdbList[0]); test.LoadDataWithMultiThreads(dataFile, vdbList, 1); // run //test.rerun(1, 5000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(2, 5000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(4, 5000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(8, 5000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(16, 5000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(32, 5000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(64, 5000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(128, 2000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(64, 2000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(256, 1000, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(512, 500, operationFile, vdbList); //Console.WriteLine("*****************************************************"); //test.rerun(1024, 250, operationFile, vdbList); //Console.WriteLine("*****************************************************"); test.rerun(2048, 125, operationFile, vdbList); Console.WriteLine("*****************************************************"); test.rerun(4096, 50, operationFile, vdbList); Console.WriteLine("*****************************************************"); test.rerun(8192, 25, operationFile, vdbList); Console.WriteLine("*****************************************************"); //Console.WriteLine("done"); //Console.ReadLine(); }