Browse Source

Updated `queries` request in `servicestack`

Updated the `queries` request handler to honor the FrameworkBenchmark's
specification that requires multi-db requests "counts" value to between
1 and 500.

Also changed the TODO about running tests in parallel.  Parallel tests
are acceptable, but need additional testing to verify performance gains.
Kevin Pullin 12 years ago
parent
commit
249b1f5361
1 changed files with 8 additions and 3 deletions
  1. 8 3
      servicestack/src/DbService.cs

+ 8 - 3
servicestack/src/DbService.cs

@@ -3,6 +3,8 @@ using System.Collections.Generic;
 using System.Configuration;
 using System.Data;
 using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
 using System.Web;
 using ServiceStack.OrmLite;
 using ServiceStack.OrmLite.MySql;
@@ -43,10 +45,13 @@ namespace ServiceStackBenchmark
                     return GetRandomWorld(db, random);
                 else
                 {
-                    var worlds = new World[request.queries];
+                    var worldCount = request.queries > 500 ? 500 : request.queries;
+                    worldCount = worldCount < 1 ? 1 : worldCount;
 
-                    // TODO: Execute these concurrently (or is that cheating?)
-                    for (int i = 0; i < request.queries; ++i)
+                    // NOTE: Experiment with running the DB requests in parallel, on both Mono and Windows CLRs.
+                    var worlds = new World[worldCount];
+
+                    for (int i = 0; i < worldCount; ++i)
                     {
                         worlds[i] = GetRandomWorld(db, random);
                     }