Exemplo n.º 1
0
        private static void StressPersistentActor(IActorRef pref, long? failAt, string description)
        {
            if (failAt.HasValue) pref.Tell(new FailAt(failAt.Value));

            var m = new Measure(LoadCycles);
            m.StartMeasure();

            for (int i = 1; i <= LoadCycles; i++) pref.Tell("msg" + i);

            pref.Ask(StopMeasure.Instance, TimeSpan.FromSeconds(100)).Wait();
            var ratio = m.StopMeasure();
            Console.WriteLine("Throughtput: {0} {1} per second", ratio, description);
        }
Exemplo n.º 2
0
        private static void StressStashingPersistentActor(ActorSystem system)
        {
            var pref = system.ActorOf(Props.Create(() => new StashingEventsourcedPersistentActor("stashing-1")));
            var m = new Measure(LoadCycles);

            var commands = Enumerable.Range(1, LoadCycles/3).SelectMany(_ => new[] {"a", "b", "c"}).ToArray();
            m.StartMeasure();

            foreach (var command in commands) pref.Tell(command);

            pref.Ask(StopMeasure.Instance, TimeSpan.FromSeconds(100)).Wait();
            var ratio = m.StopMeasure();
            Console.WriteLine("Throughtput: {0} persisted events per second", ratio);
        }
Exemplo n.º 3
0
        private static void StressStashingPersistentActor(ActorSystem system)
        {
            var pref = system.ActorOf(Props.Create(() => new StashingEventsourcedPersistentActor("stashing-1")));
            var m    = new Measure(LoadCycles);

            var commands = Enumerable.Range(1, LoadCycles / 3).SelectMany(_ => new[] { "a", "b", "c" }).ToArray();

            m.StartMeasure();

            foreach (var command in commands)
            {
                pref.Tell(command);
            }

            pref.Ask(StopMeasure.Instance, TimeSpan.FromSeconds(100)).Wait();
            var ratio = m.StopMeasure();

            Console.WriteLine("Throughtput: {0} persisted events per second", ratio);
        }
Exemplo n.º 4
0
        private static void StressPersistentActor(IActorRef pref, long?failAt, string description)
        {
            if (failAt.HasValue)
            {
                pref.Tell(new FailAt(failAt.Value));
            }

            var m = new Measure(LoadCycles);

            m.StartMeasure();

            for (int i = 1; i <= LoadCycles; i++)
            {
                pref.Tell("msg" + i);
            }

            pref.Ask(StopMeasure.Instance, TimeSpan.FromSeconds(100)).Wait();
            var ratio = m.StopMeasure();

            Console.WriteLine("Throughtput: {0} {1} per second", ratio, description);
        }