예제 #1
0
        public void insert_30_peers_with_8000_subscriptions_each()
        {
            Diagnostics.CassandraTraceSwitch.Level = TraceLevel.Off;
            const int numberOfPeersToInsert = 30;
            var       repo = new CqlPeerRepository(DataContext);
            var       subscriptionForTypes = Get10MessageTypesWith800BindingKeysEach();

            for (var i = 0; i < numberOfPeersToInsert; i++)
            {
                var stopwatch = Stopwatch.StartNew();
                repo.AddOrUpdatePeer(new PeerDescriptor(new PeerId("Abc.Peer." + i), "tcp://toto:123", true, true, true, DateTime.UtcNow));
                repo.AddDynamicSubscriptionsForTypes(new PeerId("Abc.Peer." + i), DateTime.UtcNow, subscriptionForTypes);
                Console.WriteLine("Batch: " + i + " Elapsed: " + stopwatch.Elapsed);
            }

            var sw    = Stopwatch.StartNew();
            var peers = repo.GetPeers().ToList();

            Console.WriteLine("GetPeers() took " + sw.Elapsed);
            peers.Count.ShouldEqual(30);
            foreach (var peer in peers)
            {
                peer.Subscriptions.Length.ShouldEqual(8000);
            }
        }
예제 #2
0
        public void insert_1_peer_with_100_000_subscriptions()
        {
            Diagnostics.CassandraTraceSwitch.Level = TraceLevel.Info;
            var repo = new CqlPeerRepository(DataContext);
            var subscriptionForTypes = Get1MessageTypesWith100000BindingKeys();


            var stopwatch = Stopwatch.StartNew();

            repo.AddOrUpdatePeer(new PeerDescriptor(new PeerId("Abc.Peer.0"), "tcp://toto:123", true, true, true, DateTime.UtcNow));
            repo.AddDynamicSubscriptionsForTypes(new PeerId("Abc.Peer.0"), DateTime.UtcNow, subscriptionForTypes);
            Console.WriteLine("Elapsed: " + stopwatch.Elapsed);

            Measure.Execution(100, () => repo.GetPeers(loadDynamicSubscriptions: false).ToList());
            var peers = repo.GetPeers(loadDynamicSubscriptions: false).ToList();

            peers.ExpectedSingle().Subscriptions.Length.ShouldEqual(0);
        }
예제 #3
0
        public void should_insert_and_get_peer()
        {
            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));

            peerDescriptor.HasDebuggerAttached = true;
            var otherDescriptor = _peer2.ToPeerDescriptorWithRoundedTime(false, typeof(FakeCommand), typeof(FakeRoutableCommand));

            _repository.AddOrUpdatePeer(peerDescriptor);
            _repository.AddOrUpdatePeer(otherDescriptor);

            var peerFetched      = _repository.Get(peerDescriptor.Peer.Id);
            var otherPeerFetched = _repository.Get(otherDescriptor.Peer.Id);

            peerFetched.ShouldHaveSamePropertiesAs(peerDescriptor);
            otherPeerFetched.ShouldHaveSamePropertiesAs(otherDescriptor);
        }