static internal YcsbWorker Generate(
            int txCount, int queryCount, YCSBDataGenerator gen, TransactionExecution txExec)
        {
            YcsbWorker workload = new YcsbWorker();

            workload.txs    = new List <YcsbTx>(txCount);
            workload.txExec = txExec;
            for (int i = 0; i < txCount; ++i)
            {
                workload.txs.Add(YcsbTx.Generate(queryCount, gen));
            }
            return(workload);
        }
        static internal YcsbTx Generate(int queryCount, YCSBDataGenerator gen)
        {
            YcsbTx tx = new YcsbTx
            {
                queries = new YcsbQuery[queryCount]
            };

            for (int i = 0; i < queryCount; ++i)
            {
                tx.queries[i] = YcsbQuery.Generate(gen);
            }
            return(tx);
        }
        static internal YcsbQuery Generate(YCSBDataGenerator gen)
        {
            string nextop = gen.NextOperation();

            switch (nextop)
            {
            case "READ": return(GetRead(gen.NextIntKey()));

            case "UPDATE":
                return(GetUpdate(
                           gen.NextIntKey(), YcsbHelper.UpdatePayload()));
            }
            throw new Exception($"Unknown generated operation: {nextop}");
        }
Exemplo n.º 4
0
        private IDataGenerator BuildDataGenerator()
        {
            IDataGenerator generator = null;

            if (config.Dist == Distribution.Uniform)
            {
                generator = new YCSBDataGenerator(this.recordCount, config.ReadPercentage);
            }
            else
            {
                generator = new YCSBDataGenerator(this.recordCount, config.ReadPercentage, Distribution.Zipf, config.Scale);
            }
            return(generator);
        }
        static BenchResult BenchmarkWithConfigOnce(YcsbConfig config)
        {
            // config.Print();
            // Console.WriteLine();
            var versionDb = YcsbHelper.MakeVersionDb(config.Concurrency);

            // Console.Write("loading data... ");
            LoadYcsbData(versionDb, config.RecordCount);
            // Console.WriteLine("done");
            var generator = new YCSBDataGenerator(
                config.RecordCount, config.ReadRatio,
                config.Dist, config.ZipfSkew);
            Func <TransactionExecution, YcsbWorker> workerFactory =
                txExec => YcsbWorker.Generate(
                    config.WorkerWorkload, config.QueriesPerTx, generator, txExec);
            // Console.Write("generate workload... ");
            var benchmark = new YcsbBenchmarkEnv(versionDb, workerFactory);
            // Console.WriteLine("done");
            var result = benchmark.Go();

            SingletonVersionDb.DestroyInstance();
            return(result);
        }