コード例 #1
0
        public ICompiledApplication Build(IApplicationCompiler compiler)
        {
            var applicationConfig = new CounterBenchmarkConfiguration()
            {
                NumberGeneratorProcesses = 4,
                NumberGenerators         = 4,
                NumberCounterProcesses   = 4,
                NumberCounters           = 4,
                Duration       = TimeSpan.FromSeconds(10),
                Cooldown       = TimeSpan.FromSeconds(5),
                Rate           = 4,
                Implementation = CounterImplementation.UpdateBased,
            };

            //var applicationConfig = new CounterBenchmarkConfiguration()
            //{
            //    NumberGeneratorProcesses = 4,
            //    NumberGenerators = 1000,
            //    NumberCounterProcesses = 4,
            //    NumberCounters = 1000,
            //    NumberRequests = 5000,
            //    Stagger = TimeSpan.FromSeconds(1),
            //    Implementation = CounterImplementation.UpdateBased,
            //};

            //var applicationConfig = new CounterBenchmarkConfiguration()
            //{
            //    NumberGeneratorProcesses = 10,
            //    NumberGenerators = 20000,
            //    NumberCounterProcesses = 10,
            //    NumberCounters = 10,
            //    NumberRequests = 400000,
            //    Stagger = TimeSpan.FromSeconds(1),
            //    Implementation = CounterImplementation.UpdateBased,
            //};

            var runtimeLoggingConfig = new ReactiveMachine.LoggingConfiguration()
            {
                ReceiveLogLevel = LogLevel.Debug,
                SendLogLevel    = LogLevel.Debug,
            };

            var telemetryConfig = new ReactiveMachine.TelemetryBlobWriter.Configuration()
            {
                CollectHostEvents        = true,
                CollectApplicationEvents = true,
                CollectThroughput        = true,
                //CollectApplicationEvents = (System.Diagnostics.Debugger.IsAttached || applicationConfig.IsFixedRateExperiment),
                //CollectThroughput = (System.Diagnostics.Debugger.IsAttached || applicationConfig.IsLoadLoopsExperiment),
            };

            compiler
            .SetConfiguration(applicationConfig)
            .SetConfiguration(telemetryConfig)
            .SetConfiguration(runtimeLoggingConfig)
            .AddService <CounterBenchmarkService>();

            return(compiler.Compile(applicationConfig.NumberCounterProcesses + applicationConfig.NumberGeneratorProcesses));
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: microsoft/ReactiveMachine
        static void Main(string[] args)
        {
            if (args.Length < 1 || !uint.TryParse(args[0], out var numNodes))
            {
                numNodes = 4;
            }

            var configuration = new EmulatorHost.Configuration()
            {
                MultiThreaded       = true,
                ApplicationLogLevel = LogLevel.Trace,
                RuntimeLogLevel     = LogLevel.Trace,
                FileLogLevel        = LogLevel.Trace,
                LocalLogDirectory   = "C:\\logs\\",
            };
            var loggingConfig = new ReactiveMachine.LoggingConfiguration()
            {
                //SendLogLevel = LogLevel.Trace,
                //LockLogLevel = LogLevel.Trace
            };

            Console.WriteLine("Building Application...");
            var compiler = new ApplicationCompiler();

            compiler.AddService <BankTestsService>();
            compiler.AddBuildStep(sb => sb
                                  .SetConfiguration(configuration)
                                  .SetConfiguration(loggingConfig));
            var compiled = compiler.Compile(numNodes);

            Console.WriteLine("Building Host...");

            var deploymentTimestamp = DateTime.UtcNow;
            var emulator            = new EmulatorHost.Emulator($"bank/emulator/{deploymentTimestamp:o}", deploymentTimestamp);

            Console.WriteLine("Starting Host...");
            emulator.Run(compiled);

            Console.WriteLine("Done (hit enter to terminate)...");
            Console.ReadLine();

            emulator.Shutdown();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var configuration = new EmulatorHost.Configuration()
            {
                MultiThreaded                 = false,
                RoundTripMessages             = true,
                RoundTripProcessStateEvery    = int.MaxValue,
                DeliverStaleExternalsOneOutOf = 1,
                ApplicationLogLevel           = LogLevel.Trace,
                RuntimeLogLevel               = Debugger.IsAttached ? LogLevel.Trace : LogLevel.Warning,
                ConsoleLogLevel               = LogLevel.Trace,
                FileLogLevel = LogLevel.Trace,
            };

            var loggingConfig = new ReactiveMachine.LoggingConfiguration()
            {
                SendLogLevel     = LogLevel.Trace,
                LockLogLevel     = LogLevel.Trace,
                ProgressLogLevel = LogLevel.None,
            };

            Console.WriteLine("Building Application...");

            var application = new ApplicationCompiler()
                              .AddService <TestsService>()
                              .SetConfiguration <EmulatorHost.Configuration>(configuration)
                              .SetConfiguration <ReactiveMachine.LoggingConfiguration>(loggingConfig)
                              .Compile(5);

            Console.WriteLine("Building Host...");
            var deploymentTimestamp = DateTime.UtcNow;
            var emulator            = new EmulatorHost.Emulator($"localtests/{deploymentTimestamp:o}", deploymentTimestamp);

            Console.WriteLine($"Starting Test {deploymentTimestamp}...");
            emulator.Run(application);

            Console.WriteLine("Done (hit enter to terminate)...");
            Console.ReadLine();

            emulator.Shutdown();
        }
コード例 #4
0
        public ICompiledApplication Build(IApplicationCompiler compiler)
        {
            var runtimeLoggingConfig = new ReactiveMachine.LoggingConfiguration()
            {
                ReceiveLogLevel = LogLevel.Debug,
                SendLogLevel    = LogLevel.Debug,
            };

            var telemetryConfig = new ReactiveMachine.TelemetryBlobWriter.Configuration()
            {
                CollectHostEvents        = true,
                CollectApplicationEvents = true,
                CollectThroughput        = true,
                //CollectApplicationEvents = (System.Diagnostics.Debugger.IsAttached || applicationConfig.IsFixedRateExperiment),
                //CollectThroughput = (System.Diagnostics.Debugger.IsAttached || applicationConfig.IsLoadLoopsExperiment),
            };

            compiler
            .SetConfiguration(telemetryConfig)
            .SetConfiguration(runtimeLoggingConfig)
            .AddService <CounterService>();

            return(compiler.Compile(10));
        }