jacksonh.tumblr.com

17 notes &

Apparently this AsParallel thing works

Last night I added support to Manos to parallelize HTTP transactions.

All I did was change this code:

foreach (HttpTransaction transaction in transactions) {
    transaction.Run ();
}

To this:

transactions.AsParallel ().ForAll (t => t.Run ());

I got a chance to run apache-bench on both versions today and here are the results:

foreach loop

Concurrency Level:      200
Time taken for tests:   4.208 seconds
Complete requests:      10000
Requests per second:    2376.40 [#/sec] (mean)
Time per request:       84.161 [ms] (mean)
Time per request:       0.421 [ms] (mean, across all concurrent requests)
Transfer rate:          187.98 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   15 200.8      0    3003
Processing:    28   68  21.8     61     819
Waiting:       28   68  21.8     61     818
Total:         30   83 202.9     61    3084

Percentage of the requests served within a certain time (ms)
  50%     61
  66%     67
  75%     75
  80%     79
  90%     87
  95%     96
  98%    205
  99%    215
 100%   3084 (longest request)

With AsParallel

Concurrency Level:      200
Time taken for tests:   2.791 seconds
Complete requests:      10000
Requests per second:    3582.49 [#/sec] (mean)
Time per request:       55.827 [ms] (mean)
Time per request:       0.279 [ms] (mean, across all concurrent requests)
Transfer rate:          283.38 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   4.1      0      34
Processing:    21   37   7.2     36     240
Waiting:       10   37   7.2     36     240
Total:         21   38   8.4     36     240

Percentage of the requests served within a certain time (ms)
  50%     36
  66%     38
  75%     39
  80%     40
  90%     44
  95%     50
  98%     63
  99%     73
 100%    240 (longest request)
  1. jacksonh posted this