Automattic / sensei

Sensei LMS - Online Courses, Quizzes, & Learning
https://senseilms.com
GNU General Public License v2.0
539 stars 198 forks source link

Run migration tests and performance analysis on a big site #7107

Open m1r0 opened 1 year ago

m1r0 commented 1 year ago

Goal

We need to measure the performance impact when reading data from the new tables.

Scope

merkushin commented 10 months ago

Pure comments (comment-based repository, not aggregate):

This is ApacheBench, Version 2.3 <$Revision: 1903618 $>                          
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/         
Licensed to The Apache Software Foundation, http://www.apache.org/               

Server Software:        nginx/1.25.0                                                                                                                              
Server Hostname:        sensei.test                                               
Server Port:            443                                                                                                                                       
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-CHACHA20-POLY1305,2048,256                                                                                              
Server Temp Key:        ECDH X25519 253 bits                                     
TLS Server Name:        sensei.test                                               

Document Path:          /?lesson=x-y-z            
Document Length:        72993 bytes                                                                                                                               

Concurrency Level:      10                                                       
Time taken for tests:   44.516 seconds                                           
Complete requests:      1000                                                     
Failed requests:        0                                                        
Total transferred:      73532000 bytes                                           
HTML transferred:       72993000 bytes                                           
Requests per second:    22.46 [#/sec] (mean)                                     
Time per request:       445.159 [ms] (mean)
Time per request:       44.516 [ms] (mean, across all concurrent requests)
Transfer rate:          1613.10 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        3   10   2.3     10      23
Processing:   227  430  39.9    426     886
Waiting:      225  429  39.9    424     884
Total:        242  440  40.3    436     909

Percentage of the requests served within a certain time (ms)
  50%    436
  66%    439
  75%    441
  80%    443
  90%    447
  95%    458
  98%    579
  99%    668
 100%    909 (longest request)

Comment-based aggregate:

This is ApacheBench, Version 2.3 <$Revision: 1903618 $>                                                                                                   
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/               

Server Software:        nginx/1.25.0                                             
Server Hostname:        sensei.test                                               
Server Port:            443                                                      
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-CHACHA20-POLY1305,2048,256
Server Temp Key:        ECDH X25519 253 bits
TLS Server Name:        sensei.test      

Document Path:          /?lesson=x-y-z
Document Length:        72993 bytes   

Concurrency Level:      10                                                       
Time taken for tests:   44.840 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      73532000 bytes
HTML transferred:       72993000 bytes
Requests per second:    22.30 [#/sec] (mean)
Time per request:       448.395 [ms] (mean)
Time per request:       44.840 [ms] (mean, across all concurrent requests)
Transfer rate:          1601.46 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        3    9   2.3      9      18
Processing:   216  435  91.6    424    1494
Waiting:      215  434  91.7    422    1493
Total:        231  445  91.6    433    1504

Percentage of the requests served within a certain time (ms)
  50%    433
  66%    436
  75%    438
  80%    440
  90%    444
  95%    448
  98%    647
  99%    879
 100%   1504 (longest request)

Table-based repository (aggregate):

This is ApacheBench, Version 2.3 <$Revision: 1903618 $>                                                                                                  
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/               

Server Software:        nginx/1.25.0                                             
Server Hostname:        sensei.test                                               
Server Port:            443                                                      
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-CHACHA20-POLY1305,2048,256
Server Temp Key:        ECDH X25519 253 bits
TLS Server Name:        sensei.test      

Document Path:          /?lesson=x-y-z
Document Length:        72993 bytes   

Concurrency Level:      10                                                                                                                                        
Time taken for tests:   44.132 seconds                                           
Complete requests:      1000                                                                                                                                      
Failed requests:        0                                                                                                                                         
Total transferred:      73532000 bytes                                           
HTML transferred:       72993000 bytes                                           
Requests per second:    22.66 [#/sec] (mean)
Time per request:       441.320 [ms] (mean)
Time per request:       44.132 [ms] (mean, across all concurrent requests)
Transfer rate:          1627.13 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        3    9   2.4     10      22
Processing:   216  427 117.5    411    1533
Waiting:      214  425 117.5    409    1531
Total:        230  436 117.8    420    1545

Percentage of the requests served within a certain time (ms)
  50%    420
  66%    423
  75%    426
  80%    427
  90%    432
  95%    461
  98%    639
  99%   1532
 100%   1545 (longest request)

What we can see here:

Also have to mention that I posted not the best result for table-based version as I considered it as an extreme and not reliable. However, I got it several times, so I want to share it here:

Concurrency Level:      10
Time taken for tests:   41.934 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      73532000 bytes
HTML transferred:       72993000 bytes
Requests per second:    23.85 [#/sec] (mean)
Time per request:       419.341 [ms] (mean)
Time per request:       41.934 [ms] (mean, across all concurrent requests)
Transfer rate:          1712.42 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        3    9   2.4      9      22
Processing:   217  406  33.0    402     819
Waiting:      215  405  33.0    401     818
Total:        233  415  33.7    411     840

Percentage of the requests served within a certain time (ms)
  50%    411
  66%    416
  75%    419
  80%    421
  90%    425
  95%    428
  98%    452
  99%    622
 100%    840 (longest request)

If we consider longer runs, the difference is less noticeable. (Ran it only once as they take too much time.) "Pure comments":

Server Software:        nginx/1.25.0                                                                                                                              
Server Hostname:        sensei.test                                                                                                                                
Server Port:            443                                                      
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-CHACHA20-POLY1305,2048,256             
Server Temp Key:        ECDH X25519 253 bits                                     
TLS Server Name:        sensei.test                                               

Document Path:          /?lesson=x-y-z
Document Length:        72993 bytes

Concurrency Level:      10   
Time taken for tests:   511.681 seconds
Complete requests:      10000          
Failed requests:        0              
Total transferred:      735320000 bytes                                          
HTML transferred:       729930000 bytes                                          
Requests per second:    19.54 [#/sec] (mean)                                     
Time per request:       511.681 [ms] (mean)                                      
Time per request:       51.168 [ms] (mean, across all concurrent requests)
Transfer rate:          1403.38 [Kbytes/sec] received

Connection Times (ms)                                                            
              min  mean[+/-sd] median   max                                                                                                                       
Connect:        3   12 131.1     11   13114                                                                                                                       
Processing:   213  499  80.5    491    1599            
Waiting:      212  498  80.5    490    1597                                      
Total:        228  511 153.8    501   13610                                      

Percentage of the requests served within a certain time (ms)
  50%    501                            
  66%    512              
  75%    520                           
  80%    525                 
  90%    542             
  95%    565                           
  98%    624                           
  99%    698                                                                     
 100%  13610 (longest request)

Table-based aggregate:

Server Software:        nginx/1.25.0                                             
Server Hostname:        sensei.test                                               
Server Port:            443                                                                                                                                       
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-CHACHA20-POLY1305,2048,256                                                                                              
Server Temp Key:        ECDH X25519 253 bits           
TLS Server Name:        sensei.test                                               

Document Path:          /?lesson=x-y-z           
Document Length:        72993 bytes 

Concurrency Level:      10
Time taken for tests:   456.304 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      735320000 bytes
HTML transferred:       729930000 bytes
Requests per second:    21.92 [#/sec] (mean)                                     
Time per request:       456.304 [ms] (mean)                                      
Time per request:       45.630 [ms] (mean, across all concurrent requests)       
Transfer rate:          1573.70 [Kbytes/sec] received                            

Connection Times (ms)                   
              min  mean[+/-sd] median   max                                      
Connect:        3   13   3.6     13      41                                      
Processing:   221  443  78.7    420    1532                                                                                                                       
Waiting:      219  441  78.7    419    1530                                                                                                                       
Total:        238  456  78.5    435    1543            

Percentage of the requests served within a certain time (ms)                     
  50%    435                                                                     
  66%    454                        
  75%    473                            
  80%    482              
  90%    506                           
  95%    544                 
  98%    598             
  99%    660                           
 100%   1543 (longest request)

Comment-based aggregate:

Server Software:        nginx/1.25.0
Server Hostname:        sensei.test
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-CHACHA20-POLY1305,2048,256
Server Temp Key:        ECDH X25519 253 bits
TLS Server Name:        sensei.test

Document Path:          /?lesson=x-y-z
Document Length:        72993 bytes

Concurrency Level:      10
Time taken for tests:   492.509 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      735320000 bytes
HTML transferred:       729930000 bytes
Requests per second:    20.30 [#/sec] (mean)
Time per request:       492.509 [ms] (mean)
Time per request:       49.251 [ms] (mean, across all concurrent requests)
Transfer rate:          1458.02 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        3   11   3.9     11      29
Processing:   212  481  80.4    479    1567
Waiting:      211  479  80.4    478    1564
Total:        226  492  80.4    490    1578

Percentage of the requests served within a certain time (ms)
  50%    490
  66%    497
  75%    502
  80%    505
  90%    514
  95%    527
  98%    563
  99%    660
 100%   1578 (longest request)
m1r0 commented 10 months ago

I'm moving this card back to do queue. We could do the same measurement after caching is implemented.