浏览代码

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 年之前
父节点
当前提交
ca1dd4539d
共有 1 个文件被更改,包括 8 次插入3 次删除
  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);
                     }