static void Main(string[] args) { if (args.Length < 1 || !uint.TryParse(args[0], out var numNodes)) { numNodes = 4; } Console.WriteLine("Building Application..."); var compiler = new ApplicationCompiler(); compiler.AddService <BankTestsService>(); 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(); }
static void Main(string[] args) { Console.WriteLine("Building Application..."); var compiler = new ApplicationCompiler(); uint numberProcesses = 5; uint workersPerProcess = 2; compiler .AddService <MinerService>() .AddBuildStep(serviceBuilder => serviceBuilder.OnFirstStart( new SearchJob() { Target = 100007394059441.GetHashCode(), Start = 100000000000000, Count = 10000000000, NumberWorkers = numberProcesses * workersPerProcess })) ; var application = compiler.Compile(numberProcesses); Console.WriteLine("Building Host..."); var deploymentTimestamp = DateTime.UtcNow; var emulator = new EmulatorHost.Emulator($"miner/emulator/{deploymentTimestamp:o}", deploymentTimestamp); Console.WriteLine("Starting Host..."); emulator.Run(application); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }
static void Main(string[] args) { var applicationConfiguration = new RideSharing.Benchmark.Configuration() { NumberGeneratorProcesses = 1, NumberRiders = 10, NumberDrivers = 10, NumberServiceProcesses = 1, Duration = TimeSpan.FromSeconds(10), Cooldown = TimeSpan.FromSeconds(5), Rate = 0.333333333333, }; var hostConfiguration = new EmulatorHost.Configuration() { RoundTripMessages = true, RoundTripProcessStateEvery = int.MaxValue, DeliverStaleExternalsOneOutOf = 10000 }; Console.WriteLine("Building Application..."); var application = new ApplicationCompiler() .SetConfiguration(applicationConfiguration) .AddService <RideSharingBenchmark>() .Compile(applicationConfiguration.NumberServiceProcesses + applicationConfiguration.NumberGeneratorProcesses); var experimentAndHost = "ridesharing/emulator/"; var localOrCloudDeployment = Environment.GetEnvironmentVariable("REACTIVE_MACHINE_DIR") == null ? "cloud" : "local"; var deploymentTimestamp = DateTime.UtcNow; var deploymentId = string.Format("{1}{2}/{0:o}", deploymentTimestamp, experimentAndHost, localOrCloudDeployment); var emulator = new EmulatorHost.Emulator(deploymentId, deploymentTimestamp); Console.WriteLine("Starting Host..."); emulator.Run(application); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }
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(); }
static void Main(string[] args) { Console.WriteLine("Building Application..."); var compiler = new ApplicationCompiler(); compiler.AddService <PingPongService>(); var application = compiler.Compile(2); Console.WriteLine("Starting Host..."); var deploymentTimestamp = DateTime.UtcNow; var emulator = new EmulatorHost.Emulator($"pingpong/emulator/{deploymentTimestamp:o}", deploymentTimestamp); emulator.Run(application); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }
static void Main(string[] args) { var compiler = new ApplicationCompiler(); Console.WriteLine("Setting configuration objects..."); compiler.SetConfiguration(new HelloWorldTestConfiguration() { NumberRepetitions = 100 }); compiler.SetConfiguration(new ReactiveMachine.TelemetryBlobWriter.Configuration() { CollectHostEvents = true, CollectApplicationEvents = true, CollectThroughput = false, }); Console.WriteLine("Building Application..."); compiler.AddService <HelloWorldTestService>(); Console.WriteLine("Compiling Application..."); var compiledApplication = compiler.Compile(numberProcesses: 1); Console.WriteLine("Building Host..."); var deploymentTimestamp = DateTime.UtcNow; var deploymentId = $"helloworld/emulator/{deploymentTimestamp:o}"; var emulator = new EmulatorHost.Emulator(deploymentId, deploymentTimestamp); Console.WriteLine("Starting Host..."); emulator.Run(compiledApplication); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }
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(); }
static void Main(string[] args) { Console.WriteLine("Building Application..."); var appConfig = new CounterBenchmarkConfiguration() { NumberGeneratorProcesses = 4, NumberGenerators = 4, NumberCounterProcesses = 4, NumberCounters = 4, Duration = TimeSpan.FromSeconds(10), Cooldown = TimeSpan.FromSeconds(5), Rate = 4, Implementation = CounterImplementation.UpdateBased, }; //var appConfig = new CounterBenchmarkConfiguration() //{ // NumberGeneratorProcesses = 2, // NumberGenerators = 1000, // NumberCounterProcesses = 2, // NumberCounters = 1000, // NumberRequests = 5000, // Stagger = TimeSpan.FromSeconds(1), // Implementation = CounterImplementation.UpdateBased, //}; //var appConfig = new CounterBenchmarkConfiguration() //{ // NumberGeneratorProcesses = 1, // NumberGenerators = 10000, // NumberCounterProcesses = 1, // NumberCounters = 1, // NumberRequests = 200000, // Stagger = TimeSpan.FromSeconds(1), // Implementation = CounterImplementation.UpdateBased, //}; var hostConfig = new EmulatorHost.Configuration() { MultiThreaded = true, RoundTripMessages = true, RoundTripProcessStateEvery = int.MaxValue, DeliverStaleExternalsOneOutOf = 1, ConsoleLogLevel = LogLevel.Information, FileLogLevel = Debugger.IsAttached ? LogLevel.Trace : LogLevel.None, LocalLogDirectory = "C:\\logs\\", ApplicationLogLevel = LogLevel.Trace, // log through runtime HostLogLevel = LogLevel.Trace, RuntimeLogLevel = LogLevel.Trace }; var telemetryConfig = new ReactiveMachine.TelemetryBlobWriter.Configuration() { CollectHostEvents = false, CollectApplicationEvents = (System.Diagnostics.Debugger.IsAttached || appConfig.IsFixedRateExperiment), CollectThroughput = (System.Diagnostics.Debugger.IsAttached || appConfig.IsLoadLoopsExperiment), }; var application = new ApplicationCompiler() .SetConfiguration(appConfig) .SetConfiguration(telemetryConfig) .SetConfiguration(hostConfig) .AddService <CounterBenchmarkService>() .Compile(appConfig.NumberCounterProcesses + appConfig.NumberGeneratorProcesses); var experimentAndHost = "counter/emulator/"; var localOrCloudDeployment = Environment.GetEnvironmentVariable("REACTIVE_MACHINE_DIR") == null ? "cloud" : "local"; var deploymentTimestamp = DateTime.UtcNow; var deploymentId = string.Format("{1}{2}/{0:o}", deploymentTimestamp, experimentAndHost, localOrCloudDeployment); var emulator = new EmulatorHost.Emulator(deploymentId, deploymentTimestamp); Console.WriteLine("Starting Host..."); emulator.Run(application); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }