示例#1
0
        protected void AddSingleMasterStep(MasterStep masterStep)
        {
            var parallelSteps = new List <MasterStep>();

            parallelSteps.Add(masterStep);
            Pipeline.Add(parallelSteps);
        }
示例#2
0
        private void HandleAdvanceConfiguration(YamlMappingNode root)
        {
            // handle advance configurations
            ValidateBenchmarkConfiguration(root);
            // Parse types
            var types = root.Children[new YamlScalarNode(TypesKey)] as YamlSequenceNode;

            foreach (var type in types)
            {
                Types.Add(type.ToString());
            }

            // Parse pipeline
            var pipelineNode = (YamlSequenceNode)root.Children[new YamlScalarNode(PipelineKey)] as YamlSequenceNode;

            foreach (var parallelStepNode in pipelineNode)
            {
                var parallelSteps = new List <MasterStep>();
                foreach (var stepNode in (YamlSequenceNode)parallelStepNode)
                {
                    var step = new MasterStep();
                    step.Parse((YamlMappingNode)stepNode);
                    parallelSteps.Add(step);
                }
                Pipeline.Add(parallelSteps);
            }
        }
        protected MasterStep StopCollector(string typeName)
        {
            var masterStep = new MasterStep();

            masterStep.Parameters[SignalRConstants.Method] = typeof(StopCollector).Name;
            masterStep = AttachType(masterStep, typeName);
            return(masterStep);
        }
        protected MasterStep DisposeConnection(string typeName)
        {
            var masterStep = new MasterStep();

            masterStep.Parameters[SignalRConstants.Method] = typeof(DisposeConnection).Name;
            masterStep = AttachType(masterStep, typeName);
            return(masterStep);
        }
        protected MasterStep RegisterOnConnected(string typeName)
        {
            var masterStep = new MasterStep();

            masterStep.Parameters[SignalRConstants.Method] = typeof(RegisterCallbackOnConnected).Name;
            AttachType(masterStep, typeName);
            return(masterStep);
        }
        protected MasterStep InitStatisticsCollectorInternal(string typeName)
        {
            var masterStep = new MasterStep();

            masterStep = AttachType(masterStep, typeName);
            masterStep.Parameters[$"{SignalRConstants.LatencyStep}"] = SignalRConstants.LATENCY_STEP;
            masterStep.Parameters[$"{SignalRConstants.LatencyMax}"]  = SignalRConstants.LATENCY_MAX;
            return(masterStep);
        }
        protected MasterStep RepairConnections(
            string typeName,
            string action = "None")
        {
            var masterStep = new MasterStep();

            masterStep.Parameters[SignalRConstants.Method]             = typeof(RepairConnections).Name;
            masterStep.Parameters[SignalRConstants.ActionAfterConnect] = action;
            masterStep = AttachType(masterStep, typeName);
            return(masterStep);
        }
        protected MasterStep Wait(
            string typeName,
            int wait = 3000)
        {
            var masterStep = new MasterStep();

            masterStep.Parameters[SignalRConstants.Method]   = typeof(Wait).Name;
            masterStep.Parameters[SignalRConstants.Duration] = wait;
            masterStep = AttachType(masterStep, typeName);
            return(masterStep);
        }
        protected MasterStep GroupInternal(
            string typeName,
            uint groupCount,
            uint connections)
        {
            var masterStep = new MasterStep();

            masterStep.Parameters[SignalRConstants.Method]          = typeof(LeaveGroup).Name;
            masterStep.Parameters[SignalRConstants.GroupCount]      = groupCount;
            masterStep.Parameters[SignalRConstants.ConnectionTotal] = connections;
            masterStep = AttachType(masterStep, typeName);
            return(masterStep);
        }
示例#10
0
        public async Task HandleStep(
            MasterStep step,
            IList <IRpcClient> clients,
            bool debug)
        {
            // Show step configuration
            if (debug)
            {
                SignalRUtils.ShowConfiguration(step.Parameters);
            }

            // Send to agents
            await SendToAgents(step, clients);
        }
        protected MasterStep StartConnectin(
            string batchMode,
            uint concurrent,
            string typeName,
            uint wait = 1000)
        {
            var masterStep = new MasterStep();

            masterStep.Parameters[SignalRConstants.Method] = typeof(StartConnection).Name;
            masterStep.Parameters[SignalRConstants.ConcurrentConnection] = concurrent;
            masterStep.Parameters[SignalRConstants.BatchMode]            = batchMode;
            masterStep.Parameters[SignalRConstants.BatchWait]            = wait;
            masterStep = AttachType(masterStep, typeName);
            return(masterStep);
        }
        protected MasterStep ConditionalStop(
            string typeName,
            uint maxConnections,
            double connectionFailPercentage,
            double latencyPercentage)
        {
            var masterStep = new MasterStep();

            masterStep.Parameters[SignalRConstants.Method] = typeof(ConditionalStop).Name;
            masterStep.Parameters[SignalRConstants.CriteriaMaxFailConnectionAmount]     = maxConnections;
            masterStep.Parameters[SignalRConstants.CriteriaMaxFailConnectionPercentage] = connectionFailPercentage;
            masterStep.Parameters[SignalRConstants.CriteriaMaxFailSendingPercentage]    = latencyPercentage;
            masterStep = AttachType(masterStep, typeName);
            return(masterStep);
        }
        protected MasterStep CreateConnectionInternal(
            uint totalConnections,
            string targetUrl,
            string protocol,
            string transport,
            string typeName)
        {
            var masterStep = new MasterStep();

            masterStep = AttachType(masterStep, typeName);
            masterStep.Parameters[SignalRConstants.ConnectionTotal] = totalConnections;
            masterStep.Parameters[SignalRConstants.HubProtocol]     = protocol;
            masterStep.Parameters[SignalRConstants.TransportType]   = transport;
            masterStep.Parameters[SignalRConstants.HubUrls]         = targetUrl;
            return(masterStep);
        }
        protected MasterStep CollectStatisticsInternal(
            string typeName,
            bool debug,
            int interval          = 1000,
            string output         = "counters.txt",
            string percentileList = SignalRConstants.PERCENTILE_LIST)
        {
            var masterStep = new MasterStep();

            masterStep = AttachType(masterStep, typeName);
            masterStep.Parameters[SignalRConstants.Interval]             = 1000;
            masterStep.Parameters[SignalRConstants.PercentileList]       = percentileList;
            masterStep.Parameters[SignalRConstants.StatPrintMode]        = debug;
            masterStep.Parameters[SignalRConstants.StatisticsOutputPath] = output;
            return(masterStep);
        }
示例#15
0
        private Task SendToAgents(MasterStep step, IList <IRpcClient> clients)
        {
            try
            {
                var method     = step.GetMethod();
                var parameters = step.Parameters;

                // Create instance
                IMasterMethod methodInstance = _plugin.CreateMasterMethodInstance(method);

                // Do action
                return(methodInstance.Do(parameters, _plugin.PluginMasterParameters, clients));
            }
            catch (Exception ex)
            {
                var message = $"Fail to handle step: {ex}";
                Log.Error(message);
                throw;
            }
        }
        protected MasterStep SimpleSendingScenario(
            string typeName,
            uint stepDuration,
            uint msgSize,
            uint sendingInterval,
            uint totalConnections,
            uint beginIndex,
            uint endIndex)
        {
            var masterStep = new MasterStep();

            masterStep.Parameters[SignalRConstants.RemainderBegin] = beginIndex;
            masterStep.Parameters[SignalRConstants.RemainderEnd]   = endIndex;
            masterStep.Parameters[SignalRConstants.Modulo]         = totalConnections;
            masterStep.Parameters[SignalRConstants.Duration]       = stepDuration;
            masterStep.Parameters[SignalRConstants.MessageSize]    = msgSize;
            masterStep.Parameters[SignalRConstants.Interval]       = sendingInterval;
            masterStep = AttachType(masterStep, typeName);
            return(masterStep);
        }
 protected MasterStep AttachType(MasterStep masterStep, string typeName)
 {
     masterStep.Parameters[SignalRConstants.Type] = typeName;
     return(masterStep);
 }