Comments vs. Nodes - Round 2

After several wasted hours trying to work out exactly why nodes were so much slower than comments across several benchmarks, I've found out why...

anonymous users don't have the 'access comments' permission by default. Yes that's right, all the benchmarks were wrong. Like a race between one guy on sleeping pills and the other on steroids.

Nodes turn out to be almost identical to comments when comment module actually goes to the effort of showing them to anonymous users. Note these tests don't have Drupal's page cache enabled or anything like that. Having said that, given the disastrous results last time, I'd really appreciate some independent benchmarks - 10 nodes vs. 10 comments, 30 vs. 30, 300 vs. 300 - and Drupal 6 vs. Drupal 7 on those pages would be handy too. NB. Some cachegrind screenshots (aggregated from 30 requests each) are attached at the end of this post.

ab -c1 -n1000

/node with 90 nodes:
Server Software:        Apache/2.2.8
Server Hostname:        d7.7
Server Port:            80

Document Path:          /
Document Length:        94593 bytes

Concurrency Level:      1
Time taken for tests:   369.436361 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      95179000 bytes
HTML transferred:       94593000 bytes
Requests per second:    2.71 [#/sec] (mean)
Time per request:       369.436 [ms] (mean)
Time per request:       369.436 [ms] (mean, across all concurrent requests)
Transfer rate:          251.59 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   344  368  18.1    364     514
Waiting:      337  360  17.8    355     506
Total:        344  368  18.1    364     514

/node/181 with 90 comments:
Server Software:        Apache/2.2.8
Server Hostname:        d7.7
Server Port:            80

Document Path:          /node/181
Document Length:        227002 bytes

Concurrency Level:      1
Time taken for tests:   359.673295 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      227588000 bytes
HTML transferred:       227002000 bytes
Requests per second:    2.78 [#/sec] (mean)
Time per request:       359.673 [ms] (mean)
Time per request:       359.673 [ms] (mean, across all concurrent requests)
Transfer rate:          617.93 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   339  359  15.8    355     444
Waiting:      333  353  15.7    349     438
Total:        339  359  15.8    355     444

Percentage of the requests served within a certain time (ms)
  50%    355
  66%    360
  75%    364
  80%    368
  90%    380
  95%    394
  98%    406
  99%    418
 100%    444 (longest request)

Time spent trying to correct the situation wasn't completely wasted, since I did some profiling of logged in page views and still found some interesting bottlenecks there, but still, a bit silly.

Good news though - there's no real arguments to have comments use their current hamstrung data storage any more.

AttachmentSize
nodes.png161.65 KB
comments.png161.99 KB

Powered by Drupal, an open source content management system