Ejemplo n.º 1
0
        public void RTableStableTwoReplicaCRUDTest()
        {
            try
            {
                string tableName = this.GenerateRandomTableName("RTable2Perf");
                this.SetupRTableEnv(tableName, true, "", new List <int> {
                    0, 1
                });
                Console.WriteLine("tableName = {0}", tableName);

                // two-replica and stable?
                View view = this.configurationService.GetTableView(tableName);
                Assert.IsTrue(view != null && view.Chain != null && view.Chain.Count == 2 && view.IsStable);
                // convert mode is Off ? yes, because we can't have more than 1 replica while in convert mode!

                ReplicatedTable rtable = this.repTable;

                Console.WriteLine("[C]reate stats ...");
                entries = ShuffleList(entries);
                DataSampling createStats = CreateEntriesStats(rtable, entries);

                Console.WriteLine("[R]etrieve stats ...");
                entries = ShuffleList(entries);
                DataSampling retrieveStats = RetrieveEntriesPerf(rtable, entries);

                Console.WriteLine("[U]pdate stats ...");
                entries = ShuffleList(entries);
                DataSampling updateStats = UpdateEntriesPerf(rtable, entries);

                Console.WriteLine("[D]elete stats ...");
                entries = ShuffleList(entries);
                DataSampling deleteStats = DeleteEntriesPerf(rtable, entries);


                //// TODO: Add perf. tests for LINQ query ...


                IEnumerable <CustomerEntity> customers = GetCustomerEntities(rtable);
                Assert.AreEqual(customers.Count(), 0);

                var report = new StringBuilder();
                report.AppendLine("RTable Stable Two-Replicas CRUD perf (ms)");
                report.AppendFormat("{0}\n", createStats.ToString());
                report.AppendFormat("{0}\n", retrieveStats.ToString());
                report.AppendFormat("{0}\n", updateStats.ToString());
                report.AppendFormat("{0}\n", deleteStats.ToString());
                report.AppendLine("End report.");

                Console.WriteLine(report);
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0}", ex);
                Assert.Fail();
            }
            finally
            {
                base.DeleteAllRtableResources();
            }
        }
Ejemplo n.º 2
0
        public void XStoreCRUDTest()
        {
            try
            {
                string tableName = this.GenerateRandomTableName("XStorePerf");
                this.SetupRTableEnv(tableName, true, "", new List <int> {
                    0
                });
                Console.WriteLine("tableName = {0}", tableName);

                CloudTableClient tableClient = this.cloudTableClients[0];
                CloudTable       table       = tableClient.GetTableReference(tableName);

                Console.WriteLine("[C]reate stats ...");
                entries = ShuffleList(entries);
                DataSampling createStats = CreateEntriesStats(table, entries);

                Console.WriteLine("[R]etrieve stats ...");
                entries = ShuffleList(entries);
                DataSampling retrieveStats = RetrieveEntriesPerf(table, entries);

                Console.WriteLine("[U]pdate stats ...");
                entries = ShuffleList(entries);
                DataSampling updateStats = UpdateEntriesPerf(table, entries);

                Console.WriteLine("[D]elete stats ...");
                entries = ShuffleList(entries);
                DataSampling deleteStats = DeleteEntriesPerf(table, entries);


                // TODO: Add perf. tests for LINQ query ...


                IEnumerable <CustomerEntity> customers = GetCustomerEntities(table);
                Assert.AreEqual(customers.Count(), 0);

                var report = new StringBuilder();
                report.AppendLine("XStore CRUD perf (ms)");
                report.AppendFormat("{0}\n", createStats.ToString());
                report.AppendFormat("{0}\n", retrieveStats.ToString());
                report.AppendFormat("{0}\n", updateStats.ToString());
                report.AppendFormat("{0}\n", deleteStats.ToString());
                report.AppendLine("End report.");

                Console.WriteLine(report);
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0}", ex);
                Assert.Fail();
            }
            finally
            {
                base.DeleteAllRtableResources();
            }
        }