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); } }
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); }