Пример #1
0
        public override void RunExample(Arguments a)
        {
            this.args = (BenchmarkArguments)a;
            shared    = new BenchmarkShared(args);

            if (args.sync)
            {
                ClientPolicy policy = new ClientPolicy();
                policy.user      = args.user;
                policy.password  = args.password;
                policy.tlsPolicy = args.tlsPolicy;
                policy.authMode  = args.authMode;
                client           = new AerospikeClient(policy, args.hosts);

                try
                {
                    args.SetServerSpecific(client);
                    threads = new BenchmarkThreadSync[args.threadMax];
                    for (int i = 0; i < args.threadMax; i++)
                    {
                        threads[i] = new BenchmarkThreadSync(console, args, shared, this, client);
                    }
                    RunThreads();
                }
                finally
                {
                    client.Close();
                }
            }
            else
            {
                console.Info("Maximum concurrent commands: " + args.commandMax);

                AsyncClientPolicy policy = new AsyncClientPolicy();
                policy.user             = args.user;
                policy.password         = args.password;
                policy.tlsPolicy        = args.tlsPolicy;
                policy.authMode         = args.authMode;
                policy.asyncMaxCommands = args.commandMax;

                AsyncClient client = new AsyncClient(policy, args.hosts);
                this.client = client;

                try
                {
                    args.SetServerSpecific(client);
                    threads = new BenchmarkThreadAsync[args.threadMax];
                    for (int i = 0; i < args.threadMax; i++)
                    {
                        threads[i] = new BenchmarkThreadAsync(console, args, shared, this, client);
                    }
                    RunThreads();
                }
                finally
                {
                    client.Close();
                }
            }
        }
 public BenchmarkShared(BenchmarkArguments args)
 {
     if (args.latency)
     {
         writeLatency = new LatencyManager(args.latencyColumns, args.latencyShift);
         readLatency = new LatencyManager(args.latencyColumns, args.latencyShift);
     }
 }
Пример #3
0
 public BenchmarkThread(Console console, BenchmarkArguments args, BenchmarkShared shared, Example example)
 {
     this.console = console;
     this.args    = args;
     this.shared  = shared;
     this.example = example;
     random       = new RandomShift();
 }
 public BenchmarkShared(BenchmarkArguments args)
 {
     if (args.latency)
     {
         writeLatency = new LatencyManager(args.latencyColumns, args.latencyShift);
         readLatency  = new LatencyManager(args.latencyColumns, args.latencyShift);
     }
 }
 public BenchmarkThread(Console console, BenchmarkArguments args, BenchmarkShared shared, Example example)
 {
     this.console = console;
     this.args = args;
     this.shared = shared;
     this.example = example;
     random = new RandomShift();
 }
        public override void RunExample(Arguments a)
        {
            this.args = (BenchmarkArguments)a;
            shared = new BenchmarkShared(args);

            if (args.sync)
            {
                ClientPolicy policy = new ClientPolicy();
                policy.user = args.user;
                policy.password = args.password;
                policy.failIfNotConnected = true;
                client = new AerospikeClient(policy, args.host, args.port);

                try
                {
                    args.SetServerSpecific(client);
                    threads = new BenchmarkThreadSync[args.threadMax];
                    for (int i = 0; i < args.threadMax; i++)
                    {
                        threads[i] = new BenchmarkThreadSync(console, args, shared, this, client);
                    }
                    RunThreads();
                }
                finally
                {
                    client.Close();
                }
            }
            else
            {
                console.Info("Maximum concurrent commands: " + args.commandMax);

                AsyncClientPolicy policy = new AsyncClientPolicy();
                policy.user = args.user;
                policy.password = args.password;
                policy.failIfNotConnected = true;
                policy.asyncMaxCommands = args.commandMax;

                AsyncClient client = new AsyncClient(policy, args.host, args.port);
                this.client = client;

                try
                {
                    args.SetServerSpecific(client);
                    threads = new BenchmarkThreadAsync[args.threadMax];
                    for (int i = 0; i < args.threadMax; i++)
                    {
                        threads[i] = new BenchmarkThreadAsync(console, args, shared, this, client);
                    }
                    RunThreads();
                }
                finally
                {
                    client.Close();
                }
            }
        }
Пример #7
0
 public BenchmarkThreadAsync
 (
     Console console,
     BenchmarkArguments args,
     BenchmarkShared shared,
     Example example,
     AsyncClient client
 ) : base(console, args, shared, example)
 {
     this.client = client;
 }
 public BenchmarkThreadAsync(
     Console console,
     BenchmarkArguments args,
     BenchmarkShared shared,
     Example example,
     AsyncClient client
 )
     : base(console, args, shared, example)
 {
     this.client = client;
 }
 public BenchmarkShared(BenchmarkArguments args)
 {
     if (args.latency)
     {
         if (args.altLatencyFormat)
         {
             writeLatency = new LatencyManagerAlt(args.latencyColumns, args.latencyShift);
             readLatency  = new LatencyManagerAlt(args.latencyColumns, args.latencyShift);
         }
         else
         {
             writeLatency = new LatencyManager(args.latencyColumns, args.latencyShift);
             readLatency  = new LatencyManager(args.latencyColumns, args.latencyShift);
         }
     }
 }
        private Arguments ParseArguments()
        {
            Arguments args;

            if (currentExample.IsBenchmark())
            {
                BenchmarkArguments bargs = new BenchmarkArguments();
                bargs.sync = syncButton.Checked;

                if (bargs.sync)
                {
                    bargs.threadMax = int.Parse(syncThreadBox.Text);
                }
                else
                {
                    bargs.threadMax = int.Parse(asyncThreadBox.Text);
                }
                bargs.commandMax = int.Parse(maxCommandBox.Text);

                bargs.records = int.Parse(recordsBox.Text);

                if (batchReadBox.Checked)
                {
                    bargs.batchSize = int.Parse(batchSizeBox.Text);
                }
                bargs.binType = (BinType)binTypeBox.SelectedItem;
                bargs.binSize = int.Parse(binSizeBox.Text);

                bargs.readPct = int.Parse(readBox.Text);
                int writePct = int.Parse(writeBox.Text);

                if (!(bargs.readPct >= 0 && bargs.readPct <= 100 &&
                      writePct >= 0 && writePct <= 100 &&
                      bargs.readPct + writePct == 100))
                {
                    throw new Exception("Read + Write percentage must equal 100");
                }

                int recordsInitPct = int.Parse(initPctBox.Text);
                bargs.recordsInit = bargs.records / 100 * recordsInitPct;

                if (fixedValueButton.Checked)
                {
                    bargs.SetFixedValue();
                }

                int        timeout             = int.Parse(timeoutBox.Text);
                int        maxRetries          = int.Parse(maxRetriesBox.Text);
                int        sleepBetweenRetries = int.Parse(sleepBox.Text);
                Replica    replica             = (Replica)replicaBox.SelectedItem;
                ReadModeAP readModeAP          = (ReadModeAP)readModeAPBox.SelectedItem;
                ReadModeSC readModeSC          = (ReadModeSC)readModeSCBox.SelectedItem;

                bargs.policy.totalTimeout        = timeout;
                bargs.policy.maxRetries          = maxRetries;
                bargs.policy.sleepBetweenRetries = sleepBetweenRetries;
                bargs.policy.replica             = replica;
                bargs.policy.readModeAP          = readModeAP;
                bargs.policy.readModeSC          = readModeSC;

                bargs.writePolicy.totalTimeout        = timeout;
                bargs.writePolicy.maxRetries          = maxRetries;
                bargs.writePolicy.sleepBetweenRetries = sleepBetweenRetries;
                bargs.writePolicy.replica             = replica;

                bargs.batchPolicy.totalTimeout        = timeout;
                bargs.batchPolicy.maxRetries          = maxRetries;
                bargs.batchPolicy.sleepBetweenRetries = sleepBetweenRetries;
                bargs.batchPolicy.replica             = replica;
                bargs.batchPolicy.readModeAP          = readModeAP;
                bargs.batchPolicy.readModeSC          = readModeSC;

                bargs.debug = debugBox.Checked;

                if (limitTpsBox.Checked)
                {
                    bargs.throughput = int.Parse(throughputBox.Text);
                }

                bargs.latency          = latencyBox.Checked;
                bargs.altLatencyFormat = latencyAltFormatBox.Checked;

                if (latencyBox.Checked)
                {
                    bargs.latencyColumns = int.Parse(latencyColumnsBox.Text);
                    bargs.latencyShift   = int.Parse(latencyShiftBox.Text);

                    if (!(bargs.latencyColumns >= 2 && bargs.latencyColumns <= 10))
                    {
                        throw new Exception("Latency columns must be between 2 and 10 inclusive.");
                    }

                    if (!(bargs.latencyShift >= 1 && bargs.latencyShift <= 5))
                    {
                        throw new Exception("Latency exponent shift must be between 1 and 5 inclusive.");
                    }
                }

                args = bargs;
            }
            else
            {
                args            = new Arguments();
                args.commandMax = 40;
            }

            args.port        = int.Parse(portBox.Text);
            args.hosts       = Host.ParseHosts(hostBox.Text.Trim(), tlsName, args.port);
            args.user        = userBox.Text.Trim();
            args.password    = passwordBox.Text;
            args.clusterName = clusterName;
            args.ns          = nsBox.Text.Trim();
            args.set         = setBox.Text.Trim();
            args.tlsPolicy   = tlsPolicy;
            args.authMode    = authMode;
            return(args);
        }
Пример #11
0
        private Arguments ParseArguments()
        {
            Arguments args;

            if (currentExample.IsBenchmark())
            {
                BenchmarkArguments bargs = new BenchmarkArguments();
                bargs.sync = syncButton.Checked;

                if (bargs.sync)
                {
                    bargs.threadMax = int.Parse(syncThreadBox.Text);
                }
                else
                {
                    bargs.threadMax = int.Parse(asyncThreadBox.Text);
                }
                bargs.commandMax = int.Parse(maxCommandBox.Text);

                bargs.records = int.Parse(recordsBox.Text);
                bargs.binType = (BinType)binTypeBox.SelectedItem;
                bargs.binSize = int.Parse(binSizeBox.Text);

                bargs.readPct = int.Parse(readBox.Text);
                int writePct = int.Parse(writeBox.Text);

                if (!(bargs.readPct >= 0 && bargs.readPct <= 100 &&
                      writePct >= 0 && writePct <= 100 &&
                      bargs.readPct + writePct == 100))
                {
                    throw new Exception("Read + Write percentage must equal 100");
                }

                int recordsInitPct = int.Parse(initPctBox.Text);
                bargs.recordsInit = bargs.records / 100 * recordsInitPct;

                if (fixedValueButton.Checked)
                {
                    bargs.SetFixedValue();
                }

                int timeout             = int.Parse(timeoutBox.Text);
                int maxRetries          = int.Parse(maxRetriesBox.Text);
                int sleepBetweenRetries = int.Parse(sleepBox.Text);

                bargs.policy.timeout             = timeout;
                bargs.policy.maxRetries          = maxRetries;
                bargs.policy.sleepBetweenRetries = sleepBetweenRetries;

                bargs.writePolicy.timeout             = timeout;
                bargs.writePolicy.maxRetries          = maxRetries;
                bargs.writePolicy.sleepBetweenRetries = sleepBetweenRetries;

                bargs.debug   = debugBox.Checked;
                bargs.latency = latencyBox.Checked;

                if (latencyBox.Checked)
                {
                    bargs.latencyColumns = int.Parse(latencyColumnsBox.Text);
                    bargs.latencyShift   = int.Parse(latencyShiftBox.Text);

                    if (!(bargs.latencyColumns >= 2 && bargs.latencyColumns <= 10))
                    {
                        throw new Exception("Latency columns must be between 2 and 10 inclusive.");
                    }

                    if (!(bargs.latencyShift >= 1 && bargs.latencyShift <= 5))
                    {
                        throw new Exception("Latency exponent shift must be between 1 and 5 inclusive.");
                    }
                }

                args = bargs;
            }
            else
            {
                args            = new Arguments();
                args.commandMax = 40;
            }

            args.host     = hostBox.Text.Trim();
            args.port     = int.Parse(portBox.Text);
            args.user     = userBox.Text.Trim();
            args.password = passwordBox.Text;
            args.ns       = nsBox.Text.Trim();
            args.set      = setBox.Text.Trim();
            return(args);
        }
Пример #12
0
        private Arguments ParseArguments()
        {
            Arguments args;

            if (currentExample.IsBenchmark())
            {
                BenchmarkArguments bargs = new BenchmarkArguments();
                bargs.sync = syncButton.Checked;

                if (bargs.sync)
                {
                    bargs.threadMax = int.Parse(syncThreadBox.Text);
                }
                else
                {
                    bargs.threadMax = int.Parse(asyncThreadBox.Text);
                }
                bargs.commandMax = int.Parse(maxCommandBox.Text);

                bargs.records = int.Parse(recordsBox.Text);
                bargs.binType = (BinType)binTypeBox.SelectedItem;
                bargs.binSize = int.Parse(binSizeBox.Text);

                bargs.readPct = int.Parse(readBox.Text);
                int writePct = int.Parse(writeBox.Text);

                if (!(bargs.readPct >= 0 && bargs.readPct <= 100 &&
                    writePct >= 0 && writePct <= 100 &&
                    bargs.readPct + writePct == 100))
                {
                    throw new Exception("Read + Write percentage must equal 100");
                }

                int recordsInitPct = int.Parse(initPctBox.Text);
                bargs.recordsInit = bargs.records / 100 * recordsInitPct;

                if (fixedValueButton.Checked)
                {
                    bargs.SetFixedValue();
                }

                int timeout = int.Parse(timeoutBox.Text);
                int maxRetries = int.Parse(maxRetriesBox.Text);
                int sleepBetweenRetries = int.Parse(sleepBox.Text);

                bargs.policy.timeout = timeout;
                bargs.policy.maxRetries = maxRetries;
                bargs.policy.sleepBetweenRetries = sleepBetweenRetries;

                bargs.writePolicy.timeout = timeout;
                bargs.writePolicy.maxRetries = maxRetries;
                bargs.writePolicy.sleepBetweenRetries = sleepBetweenRetries;

                bargs.debug = debugBox.Checked;
                bargs.latency = latencyBox.Checked;

                if (latencyBox.Checked)
                {
                    bargs.latencyColumns = int.Parse(latencyColumnsBox.Text);
                    bargs.latencyShift = int.Parse(latencyShiftBox.Text);

                    if (!(bargs.latencyColumns >= 2 && bargs.latencyColumns <= 10))
                    {
                        throw new Exception("Latency columns must be between 2 and 10 inclusive.");
                    }

                    if (!(bargs.latencyShift >= 1 && bargs.latencyShift <= 5))
                    {
                        throw new Exception("Latency exponent shift must be between 1 and 5 inclusive.");
                    }
                }

                args = bargs;
            }
            else
            {
                args = new Arguments();
                args.commandMax = 40;
            }

            args.host = hostBox.Text.Trim();
            args.port = int.Parse(portBox.Text);
            args.user = userBox.Text.Trim();
            args.password = passwordBox.Text;
            args.ns = nsBox.Text.Trim();
            args.set = setBox.Text.Trim();
            return args;
        }