Exemplo n.º 1
0
        public void TestSimpleSequentialHttpPostRequests(int iterationCount)
        {
            Console.WriteLine("Operation start: TestSimpleSequentialHttpPostRequests\n");

            var db = new ADatabase(Database.Alias);

            //ServicePointManager.DefaultConnectionLimit = 40;
            //ServicePointManager.Expect100Continue = false;
            //ServicePointManager.UseNagleAlgorithm = false;

            ExecuteTimedTest(iterationCount, () => {
                var entity         = new PerformanceEntity();
                entity.Id          = "1234567890123456789012345678901234";
                entity.Key         = "1234567";
                entity.Revision    = "1234567";
                entity.Name        = "Mohamad Abu Bakar";
                entity.IcNumber    = "1234567-12-3444";
                entity.Department  = "IT Department";
                entity.Height      = 1234;
                entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
                entity.Salary      = 3333;

                var jsonEntity = JSON.ToJSON(entity);

                var response = SimpleHttpPostCreateDocument(
                    "http://localhost:8529/_db/" + Database.TestDatabaseGeneral + "/_api/document?collection=" + Database.TestDocumentCollectionName,
                    jsonEntity
                    );

                var deserializedResponse = JSON.ToObject <Dictionary <string, object> >(response);
            });

            Console.WriteLine("\nOperation end: TestSimpleSequentialHttpPostRequests");
        }
Exemplo n.º 2
0
        public void TestSimpleSequentialHttpPostRequests()
        {
            Console.WriteLine("Operation start: TestSimpleSequentialHttpPostRequests");

            var db = new ADatabase(Database.Alias);

            var entity = new PerformanceEntity();

            entity.Id          = "1234567890123456789012345678901234";
            entity.Key         = "1234567";
            entity.Revision    = "1234567";
            entity.Name        = "Mohamad Abu Bakar";
            entity.IcNumber    = "1234567-12-3444";
            entity.Department  = "IT Department";
            entity.Height      = 1234;
            entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
            entity.Salary      = 3333;

            var jsonEntity = JSON.ToJSON(entity);

            ServicePointManager.DefaultConnectionLimit = 40;
            ServicePointManager.Expect100Continue      = false;
            ServicePointManager.UseNagleAlgorithm      = false;

            ExecuteTimedTest(10, () => {
                for (int i = 0; i < 10000; i++)
                {
                    SimpleHttpPostCreateDocument(
                        "http://localhost:8529/_db/" + Database.TestDatabaseGeneral + "/_api/document?collection=" + Database.TestDocumentCollectionName,
                        jsonEntity
                        );
                }
            });

//            Stopwatch stopwatch = Stopwatch.StartNew();
//
//            for (int i = 0; i < 10000; i++)
//            {
//                SimpleHttpPostCreateDocument(
//                    "http://localhost:8529/_db/" + Database.TestDatabaseGeneral + "/_api/document?collection=" + Database.TestDocumentCollectionName,
//                    jsonEntity
//                );
//            }
//
//            Console.WriteLine("Elapsed time [s]: {0}", stopwatch.Elapsed.TotalMilliseconds / 1000);

            Console.WriteLine("Operation end: TestSimpleSequentialHttpPostRequests");
        }
Exemplo n.º 3
0
        public void TestSimpleParallelHttpPostRequests()
        {
            var entity = new PerformanceEntity();

            entity.Id          = "1234567890123456789012345678901234";
            entity.Key         = "1234567";
            entity.Revision    = "1234567";
            entity.Name        = "Mohamad Abu Bakar";
            entity.IcNumber    = "1234567-12-3444";
            entity.Department  = "IT Department";
            entity.Height      = 1234;
            entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
            entity.Salary      = 3333;

            var jsonEntity = JSON.ToJSON(entity);

            var threadCount = 10;
            var tasks       = new Task[threadCount];

            Stopwatch stopwatch = Stopwatch.StartNew();

            for (int i = 0; i < threadCount; i++)
            {
                tasks[i] = Task.Factory.StartNew(() =>
                {
                    int messages_sent_by_one_task = 0;

                    while (messages_sent_by_one_task < 100)
                    {
                        SimpleHttpPostCreateDocument(
                            "http://localhost:8529/_db/" + Database.TestDatabaseGeneral + "/_api/document?collection=" + Database.TestDocumentCollectionName,
                            jsonEntity
                            );

                        messages_sent_by_one_task++;
                    }
                });
            }

            while (tasks.Any(t => !t.IsCompleted))
            {
            }

            Console.WriteLine("Elapsed time [s]: {0}", stopwatch.Elapsed.TotalMilliseconds / 1000);
        }
Exemplo n.º 4
0
        public void TestRestSharpHttpPostRequests()
        {
            Console.WriteLine("Operation start: TestRestSharpHttpPostRequests");

            var entity = new PerformanceEntity();

            entity.Id          = "1234567890123456789012345678901234";
            entity.Key         = "1234567";
            entity.Revision    = "1234567";
            entity.Name        = "Mohamad Abu Bakar";
            entity.IcNumber    = "1234567-12-3444";
            entity.Department  = "IT Department";
            entity.Height      = 1234;
            entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
            entity.Salary      = 3333;

            var jsonEntity = JSON.ToJSON(entity);

            ServicePointManager.DefaultConnectionLimit = 40;
            ServicePointManager.Expect100Continue      = false;
            ServicePointManager.UseNagleAlgorithm      = false;

            var client  = new RestClient("http://localhost:8529");
            var request = new RestRequest("_db/" + Database.TestDatabaseGeneral + "/_api/document", Method.POST);

            request.AddParameter("collection", Database.TestDocumentCollectionName);
            request.AddBody(jsonEntity);

            Stopwatch stopwatch = Stopwatch.StartNew();

            for (int i = 0; i < 10000; i++)
            {
                var response = client.Execute(request);
            }

            Console.WriteLine("Elapsed time [s]: {0}", stopwatch.Elapsed.TotalMilliseconds / 1000);

            Console.WriteLine("Operation end: TestRestSharpHttpPostRequests");
        }
Exemplo n.º 5
0
        public void TestArangoClientSequentialInsertion(int iterationCount)
        {
            Console.WriteLine("Operation start: TestArangoClientSequentialInsertion\n");

            var db = new ADatabase(Database.Alias);

            ExecuteTimedTest(iterationCount, () => {
                var entity         = new PerformanceEntity();
                entity.Id          = "1234567890123456789012345678901234";
                entity.Key         = "1234567";
                entity.Revision    = "1234567";
                entity.Name        = "Mohamad Abu Bakar";
                entity.IcNumber    = "1234567-12-3444";
                entity.Department  = "IT Department";
                entity.Height      = 1234;
                entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
                entity.Salary      = 3333;

                var createResult = db.Document.Create(Database.TestDocumentCollectionName, entity);
            });

            Console.WriteLine("\nOperation end: TestArangoClientSequentialInsertion");
        }
Exemplo n.º 6
0
        public void TestSimpleSequentialHttpPostRequests()
        {
            Console.WriteLine("Operation start: TestSimpleSequentialHttpPostRequests");

            var db = new ADatabase(Database.Alias);

            var entity = new PerformanceEntity();
            entity.Id = "1234567890123456789012345678901234";
            entity.Key = "1234567";
            entity.Revision = "1234567";
            entity.Name = "Mohamad Abu Bakar";
            entity.IcNumber = "1234567-12-3444";
            entity.Department = "IT Department";
            entity.Height = 1234;
            entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
            entity.Salary = 3333;

            var jsonEntity = JSON.ToJSON(entity);

            ServicePointManager.DefaultConnectionLimit = 40;
            ServicePointManager.Expect100Continue = false;
            ServicePointManager.UseNagleAlgorithm = false;

            ExecuteTimedTest(10, () => {
                for (int i = 0; i < 10000; i++)
                {
                    SimpleHttpPostCreateDocument(
                        "http://localhost:8529/_db/" + Database.TestDatabaseGeneral + "/_api/document?collection=" + Database.TestDocumentCollectionName,
                        jsonEntity
                    );
                }
            });

            //            Stopwatch stopwatch = Stopwatch.StartNew();
            //
            //            for (int i = 0; i < 10000; i++)
            //            {
            //                SimpleHttpPostCreateDocument(
            //                    "http://localhost:8529/_db/" + Database.TestDatabaseGeneral + "/_api/document?collection=" + Database.TestDocumentCollectionName,
            //                    jsonEntity
            //                );
            //            }
            //
            //            Console.WriteLine("Elapsed time [s]: {0}", stopwatch.Elapsed.TotalMilliseconds / 1000);

            Console.WriteLine("Operation end: TestSimpleSequentialHttpPostRequests");
        }
Exemplo n.º 7
0
        public void TestSimpleParallelHttpPostRequests()
        {
            var entity = new PerformanceEntity();
            entity.Id = "1234567890123456789012345678901234";
            entity.Key = "1234567";
            entity.Revision = "1234567";
            entity.Name = "Mohamad Abu Bakar";
            entity.IcNumber = "1234567-12-3444";
            entity.Department = "IT Department";
            entity.Height = 1234;
            entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
            entity.Salary = 3333;

            var jsonEntity = JSON.ToJSON(entity);

            var threadCount = 10;
            var tasks = new Task[threadCount];

            Stopwatch stopwatch = Stopwatch.StartNew();

            for (int i = 0; i < threadCount; i++)
            {
                tasks[i] = Task.Factory.StartNew(() =>
                {
                    int messages_sent_by_one_task = 0;

                    while(messages_sent_by_one_task < 100)
                    {
                        SimpleHttpPostCreateDocument(
                            "http://localhost:8529/_db/" + Database.TestDatabaseGeneral + "/_api/document?collection=" + Database.TestDocumentCollectionName,
                            jsonEntity
                        );

                        messages_sent_by_one_task++;
                    }
                });
            }

            while (tasks.Any(t => !t.IsCompleted)) { }

            Console.WriteLine("Elapsed time [s]: {0}", stopwatch.Elapsed.TotalMilliseconds / 1000);
        }
Exemplo n.º 8
0
        public void TestRestSharpHttpPostRequests()
        {
            Console.WriteLine("Operation start: TestRestSharpHttpPostRequests");

            var entity = new PerformanceEntity();
            entity.Id = "1234567890123456789012345678901234";
            entity.Key = "1234567";
            entity.Revision = "1234567";
            entity.Name = "Mohamad Abu Bakar";
            entity.IcNumber = "1234567-12-3444";
            entity.Department = "IT Department";
            entity.Height = 1234;
            entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
            entity.Salary = 3333;

            var jsonEntity = JSON.ToJSON(entity);

            ServicePointManager.DefaultConnectionLimit = 40;
            ServicePointManager.Expect100Continue = false;
            ServicePointManager.UseNagleAlgorithm = false;

            var client = new RestClient("http://localhost:8529");
            var request = new RestRequest("_db/" + Database.TestDatabaseGeneral + "/_api/document", Method.POST);
            request.AddParameter("collection", Database.TestDocumentCollectionName);
            request.AddBody(jsonEntity);

            Stopwatch stopwatch = Stopwatch.StartNew();

            for (int i = 0; i < 10000; i++)
            {
                var response = client.Execute(request);
            }

            Console.WriteLine("Elapsed time [s]: {0}", stopwatch.Elapsed.TotalMilliseconds / 1000);

            Console.WriteLine("Operation end: TestRestSharpHttpPostRequests");
        }
Exemplo n.º 9
0
        public void TestSimpleSequentialHttpPostRequests(int iterationCount)
        {
            Console.WriteLine("Operation start: TestSimpleSequentialHttpPostRequests\n");

            var db = new ADatabase(Database.Alias);

            //ServicePointManager.DefaultConnectionLimit = 40;
            //ServicePointManager.Expect100Continue = false;
            //ServicePointManager.UseNagleAlgorithm = false;

            ExecuteTimedTest(iterationCount, () => {
                var entity = new PerformanceEntity();
                entity.Id = "1234567890123456789012345678901234";
                entity.Key = "1234567";
                entity.Revision = "1234567";
                entity.Name = "Mohamad Abu Bakar";
                entity.IcNumber = "1234567-12-3444";
                entity.Department = "IT Department";
                entity.Height = 1234;
                entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
                entity.Salary = 3333;

                var jsonEntity = JSON.ToJSON(entity);

                var response = SimpleHttpPostCreateDocument(
                    "http://localhost:8529/_db/" + Database.TestDatabaseGeneral + "/_api/document?collection=" + Database.TestDocumentCollectionName,
                    jsonEntity
                );

                var deserializedResponse = JSON.ToObject<Dictionary<string, object>>(response);
            });

            Console.WriteLine("\nOperation end: TestSimpleSequentialHttpPostRequests");
        }
Exemplo n.º 10
0
        public void TestArangoClientSequentialInsertion(int iterationCount)
        {
            Console.WriteLine("Operation start: TestArangoClientSequentialInsertion\n");

            var db = new ADatabase(Database.Alias);

            ExecuteTimedTest(iterationCount, () => {
                var entity = new PerformanceEntity();
                entity.Id = "1234567890123456789012345678901234";
                entity.Key = "1234567";
                entity.Revision = "1234567";
                entity.Name = "Mohamad Abu Bakar";
                entity.IcNumber = "1234567-12-3444";
                entity.Department = "IT Department";
                entity.Height = 1234;
                entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
                entity.Salary = 3333;

                var createResult = db.Document.Create(Database.TestDocumentCollectionName, entity);
            });

            Console.WriteLine("\nOperation end: TestArangoClientSequentialInsertion");
        }