Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Background:

In reference to 

Jira Legacy
serverJIRA (openedx.atlassian.net)
serverId13fd1930-5608-3aac-a5dd-21b934d3a4b4
keyMA-2678
; we have changed forums implementation with following details (for reference; see PR#192):

...

'unread comment count' was being calculate as:

unread_comment_count

...

= Comment.collection.find(:comment_thread_id

...

=>

...

t._id,

...

:author_id

...

=>

...

{"$ne"

...

=>

...

user.id},

...

:updated_at

...

=>

...

{"$gte"

...

=>

...

read_dates[thread_key]}).count

and

...

had

...

a

...

compound

...

index

...

against

...

it
index({_type: 1,

...

comment_thread_id: 1,

...

author_id: 1,

...

updated_at: 1})
 

With new implementation:

unread_comment_count

...

= Comment.collection.find(:comment_thread_id

...

=>

...

t._id, :author_id

...

=>

...

{"$ne"

...

=>

...

user.id}, :created_at

...

=>

...

{"$gte"

...

=>

...

read_dates[thread_key]}).count

So,

...

we

...

removed

...

index
index({_type: 1,

...

comment_thread_id: 1,

...

author_id: 1,

...

updated_at: 1})

and

...

added

...

a

...

new

...

one

index({comment_thread_id: 1,

...

author_id: 1,

...

created_at: 1})

...

Results:

The load tests were run on 4x c4.2xlarge instances for lms and 3x m4.large instances for forums.

The results of load tests below show difference differences between the old and new implementation.

 

 

 

There appears to be anomaly in the results below (highlighted 99%) where the new implementation is faster than the old. Where as, for other results the percentile of new implementation increases significantly with the increase in load. For example, the first pair of results where no. of clients = 48, the difference is in tens or hundrend and for the last pair of results where no. of clients = 610, the difference is in thousands.

Logically; there should only be increase in response time for GET endpoints, but we see in results that all other endpoints show differences too. This is because all PATCH, POST and DELETE endpoints first call GET endpoint to retrieve an 'id' of thread and/or comment and then make further processing on it.

New Relic:

Here is the new relic permaLink_without_profile and permaLink_with_profile where the average rpm for former is 1.55k and for later is 1.48k and 84.5% of requests are made for AccountViewSet.list (i.e. user accounts API for multiple usernames) for later.

 

...

Old Index

...

New Index

...

No. of clients = 48
req/s = 9.4
Methodsmedian response time95%99%

DELETE_comment

250

3101200

DELETE_thread

160

190200

GET_comment_list

150190310

GET_thread

140180220

GET_thread_list

160370520

PATCH_comment

2303601200

PATCH_thread

190240370

POST_comment_comment

290360430

POST_comment_response

250310450

POST_thread

160190200

auto_auth

200250250
No. of clients = 48
req/s = 9.6
Methodsmedian response time95%99%

DELETE_comment

260310340

DELETE_thread

160200220

GET_comment_list

160200290

GET_thread

150190260

GET_thread_list

170370520

PATCH_comment

250410410

PATCH_thread

1902501200

POST_comment_comment

300390420

POST_comment_response

260320410

POST_thread

160210310

auto_auth

190190190
No. of clients = 96
req/s = 18.5
Methodsmedian response time95%99%
DELETE_comment

270

340390
DELETE_thread170230330
GET_comment_list170210330
GET_thread160200250
GET_thread_list190440610
PATCH_comment240330360
PATCH_thread200260350
POST_comment_comment310380470
POST_comment_response260330440
POST_thread170210340
auto_auth180220220
No. of clients = 96
req/s = 18.7
Methodsmedian response time95%99%
DELETE_comment280370440
DELETE_thread180220270
GET_comment_list170230350
GET_thread160220300
GET_thread_list210500640
PATCH_comment2503601400
PATCH_thread200280380
POST_comment_comment320400510
POST_comment_response270350430
POST_thread170220260
auto_auth190260260
No. of clients = 162
req/s = 31
Methodsmedian response time95%99%

DELETE_comment

320400490

DELETE_thread

190240280

GET_comment_list

190250370

GET_thread

190250340

GET_thread_list

220520660

PATCH_comment

270360390

PATCH_thread

230310370

POST_comment_comment

350450540

POST_comment_response

300400490

POST_thread

190240340

auto_auth

200200200
No. of clients = 162
req/s = 31.5
Methodsmedian response time95%99%

DELETE_comment

350500660

DELETE_thread

210300390

GET_comment_list

210350460

GET_thread

210320430

GET_thread_list

250620800

PATCH_comment

290440570

PATCH_thread

260430580

POST_comment_comment

380560710

POST_comment_response

330480610

POST_thread

210310430

auto_auth

210230230
No. of clients = 240
req/s = 44.6
Methodsmedian response time95%99%

DELETE_comment

400600700

DELETE_thread

240320530

GET_comment_list

240350480

GET_thread

240360470

GET_thread_list

270630800

PATCH_comment

330510600

PATCH_thread

290420530

POST_comment_comment

420640820

POST_comment_response

360560730

POST_thread

240310440

auto_auth

210210210
No. of clients = 240
req/s = 44.7
Methodsmedian response time95%99%

DELETE_comment

54010001800

DELETE_thread

3406802000

GET_comment_list

3407501500

GET_thread

3407101500

GET_thread_list

41010001700

PATCH_comment

4208001300

PATCH_thread

4007501300

POST_comment_comment

58011002500

POST_comment_response

5009401600

POST_thread

3407101000

auto_auth

490610610
No. of clients = 336
req/s = 53
Methodsmedian response time95%99%

DELETE_comment

250055006500

DELETE_thread

98023002900

GET_comment_list

80021002700

GET_thread

92027003300

GET_thread_list

85024003300

PATCH_comment

150039005000

PATCH_thread

120034004100

POST_comment_comment

230054007000

POST_comment_response

170044005900

POST_thread

74020002700

auto_auth

33013001300
No. of clients = 336
req/s = 48.9

...

DELETE_comment

...

DELETE_thread

...

GET_comment_list

...

GET_thread

...

GET_thread_list

...

PATCH_comment

...

PATCH_thread

...

POST_comment_comment

...

POST_comment_response

...

POST_thread

...

auto_auth

...

The two set of results looks quite similar except when it reaches "No. of clients = 336"; where there is huge difference between old and new percentiles as well as sudden rise in percentile for both old and new index with respect to "No. of clients = 224". For all the next tests (i.e. No. of clients = 460, No. of clients = 510, No. of clients = 578), the difference between old and new percentile is minimised and the new index results have lower percentile for most of the endpoints.

I have captured new relic charts too; permaLink_old_index with average rpm = 1.86k and permaLink_new_index with average rpm = 1.81k


51032477001500027000540012000150006300140003100086001900036000640014000320007000140002500069001600035000740015000360007000140002600060001100032000290040004400    _list                                                                                                                  response                                                                                                                                                               POST                                 POST         

Old Index

New Index

No. of clients = 46048
req/s = 449.54
Methodsmedian response time95%99%

DELETE_comment

5600

250

9800310120001200

DELETE_thread

3700

160

62001907900200

GET_comment_list

370015061001908100310

GET_thread

5200140980018013000220

GET_thread_list

370016068003708600520

PATCH_comment

4800230790036095001200

PATCH_thread

460019073002409900370

POST_comment_comment

5500290930036011000430

POST_comment_response

5000250830031010000450

POST_thread

350016060001909200200

auto_auth

200020026002502600250
No. of clients = 46048
req/s = 328.49
41000420004700043000430004300042000420005400
Methodsmedian response timemedian response time95%95%99%99%

DELETE_comment

76003800043000

DELETE_thread

670026000

250270300470480520

DELETE_thread

170160210300230310

GET_comment_list

720038000

150160200260320350

GET_thread

1000042000

150150190250280310

GET_thread_list

760040000

170190360370520530

PATCH_comment

73002800043000

PATCH_thread

730027000

220240320400410460

PATCH_thread

180190360300330330

POST_comment_comment

780041000290310340510490680

POST_comment_response

780038000

250260300450390520

POST_thread

690028000160160200250370340

auto_auth

43004800

220210230230230230


No. of clients = 
96
req/s = 
18.
5
Methodsmedian response time95%99%
DELETE_comment

270

340
390
DELETE_thread
170
230
330
GET_comment_list
170
210
330
GET_thread
160
200
250
GET_thread_list
190
440
610
PATCH_comment
240
330
360
PATCH_thread
200
260
350
POST_comment_comment
310
380
470
POST_comment_response
260
330
440
POST_thread
170
210
340
auto_auth
180
220
220


No. of clients = 96
req/s = 18.6
Methodsmedian response timemedian response time95%95%99%99%
DELETE_comment
  
270280340360360980
DELETE_thread
  
170170220230230290
GET_comment_list
  
160160210220340400
GET_thread
  
160160200210270340
GET_thread
  
_list190190460460600640
PATCH_comment
  
220230310310340460
PATCH_thread
  
1902002602803501000
POST_comment_comment
  
300310370410480680
POST_comment_response
  
260260330350420620
POST_thread
  
170170210210340330
auto_auth
  
180210230220230220


No. of clients = 162
req/s = 31
Methodsmedian response time95%99%

DELETE_comment

 320 400 490

DELETE_thread

 190 240 280

GET_comment_list

 190 250 370

GET_thread

 190 250 340

GET_thread_list

 220 520 660

PATCH_comment

 270 360 390

PATCH_thread

 230 310 370

POST_comment_comment

 350 450 540

OSTPOST_comment_response

 300 400 490

POST_thread

 190 240 340

auto_auth

 200 200 200


No. of clients = 162
req/s = 31.6
_listOST
Methodsmedian response timemedian response time95%95%99%99%

DELETE_comment

   

310320410420590530

DELETE_thread

   

190190240230250250

GET_comment

   

_list

190190250250380380

GET_thread

   180180250250360340

GET_thread_list

   

220210530520670660

PATCH_comment

   2602503803601400430

PATCH_thread

   

220230280310400370

POST_comment_comment

   

340340450470540620

POST_comment_response

   

290290400400510550

POST_thread

   

190190240230370360

auto_auth

   

210200220200220200


No. of clients = 240
req/s = 44.6
Methodsmedian response time95%99%

DELETE_comment

 400 600 700

DELETE_thread

 240 320 530

GET_comment_list

 240 350 480

GET_thread

 240 360 470

GET_thread_list

 270 630 800

PATCH_comment

 330 510 600

PATCH_thread

 290 420 530

POST_comment_comment

 420 640 820

POST_comment_response

 360 560 730

POST_thread

 240 310 440

auto_auth

 210 210 210


No. of clients = 240
req/s = 45.40
Methodsmedian response timemedian response time95%95%99%99%

DELETE_comment

   

39041065069013001100

DELETE_thread

   

240230370280430340

GET_comment_list

   

230240350350500480

GET_thread

   

230240370370600520

GET_thread_list

   

270270640630850790

PATCH_comment

   

3003104904801200610

PATCH_thread

   280290460470640630

POST_comment_comment

   

4104306706601000970

POST_comment_response

   

360360560600860850

POST_thread

   

230230300310500430

auto_auth

   

190210220220220220



No. of clients = 270
req/s =
 51.1
Methodsmedian response time95%99%

DELETE_comment

560
7900
10000

DELETE_thread

280
620
5200

GET_comment_list

300
3100
4000

GET_thread

310
3400
5000

GET_thread_list

330
3000
4200

PATCH_comment

400
1700
6500

PATCH_thread

380
5100
6300

POST_comment_comment

560
7900
10000

POST_comment_response

470
6100
8200

POST_thread

290
2900
3900
auto_auth
320
320
320

No. of clients = 300
req/s = 48
Methodsmedian response time95%99%

DELETE_comment

1600
4600
5900

DELETE_thread

460
1600
2500

GET_comment_list

480
1300
1900

GET_thread

560
2100
2900

GET_thread_list

530
1700
2500

PATCH_comment

800
2800
3500

PATCH_thread

710
2700
3600

POST_comment_comment

1400
4300
5500

POST_comment_response

1000
3600
4800

POST_thread

430
1100
1700
auto_auth
240
250
250
No. of clients = 336
req/s = 53
Methodsmedian response time95%99%

DELETE_comment

2500
5500
6500

DELETE_thread

980
2300
2900

GET_comment_list

800
2100
2700

GET_thread

920
2700
3300

GET_thread_list

850
2400
3300

PATCH_comment

1500
3900
5000

PATCH_thread

1200
3400
4100

POST_comment_comment

2300
5400
7000

POST_comment_response

1700
4400
5900

POST_thread

740
2000
2700

auto_auth

330
1300
1300


No. of clients = 336
req/s = 54.3
Methodsmedian response timemedian response time95%95%99%99%

DELETE_comment

  

15005300920096001200011000

DELETE_thread

  
47023004100460067005100

GET_comment_list

   

GET_thread

  

51018005000370068004500

GET_thread

59021006500480099005700

GET_thread_list

  

58018004900390068004800

PATCH_comment

  

81035007600640011009700

PATCH_thread

  

79029005400630078007300

POST_comment_comment

  

13004800930093001200011000

POST_comment_

  

response

1000370077007800100009600

POST_thread

  

47017004600350064004000

auto_auth

  

320710320830320830


No. of clients = 460
req/s = 44.5
Methodsmedian response time95%99%

DELETE_comment

5600
9800
12000

DELETE_thread

3700
6200
7900

GET_comment_list

3700
6100
8100

GET_thread

5200
9800
13000

GET_thread_list

3700
6800
8600

PATCH_comment

4800
7900
9500

PATCH_thread

4600
7300
9900

POST_comment_comment

5500
9300
11000

POST_comment_response

5000
8300
10000

POST_thread

3500
6000
9200

auto_auth

2000
2600
2600


No. of clients = 460
req/s = 49.1
Methodsmedian response time95%99%

DELETE_comment

6100
10000
11000

DELETE_thread

3500
5700
6400

GET_comment_list

3000
5000
5700

GET_thread

4200
7100
8700

GET_thread_list

3100
5300
6200

PATCH_comment

4400
7800
8600

PATCH_thread

4100
6900
7600

POST_comment_comment

5700
9900
11000

POST_comment_response

4800
8500
10000

POST_thread

3000
4800
5500

auto_auth

1700
2700
2700


No. of clients = 510
req/s = 32.4
Methodsmedian response time95%99%

DELETE_comment

7700
15000
27000

DELETE_thread

5400
12000
15000

GET_comment_list

6300
14000
31000

GET_thread

8600
19000
36000

GET_thread_list

6400
14000
32000

PATCH_comment

7000
14000
25000

PATCH_thread

6900
16000
35000

POST_comment_comment

7400
15000
36000

POST_comment_response

7000
14000
26000

POST_thread

6000
11000
32000

auto_auth

2900
4000
4400


No. of clients = 510
req/s = 33.9
Methodsmedian response time95%99%

DELETE_comment

7600
14000
19000

DELETE_thread

6700
11000
14000

GET_comment_list

6700
11000
16000

GET_thread

9400
16000
22000

GET_thread_list

7000
11000
17000

PATCH_comment

6900
12000
16000

PATCH_thread

6900
12000
21000

POST_comment_comment

7600
14000
19000

POST_comment_response

7200
13000
18000

POST_thread

6700
11000
15000

auto_auth

2400
3200
3300


No. of clients = 578
req/s = 26.70
Methodsmedian response time95%99%

DELETE_comment

9500
26000
32000

DELETE_thread

8700
25000
32000

GET_comment_list

8600
22000
31000

GET_thread

13000
27000
40000

GET_thread_list

8600
22000
32000

PATCH_comment

8800
22000
32000

PATCH_thread

8800
20000
29000

POST_comment_comment

9200
24000
31000

OST_comment_response

9300
24000
32000

POST_thread

8300
20000
32000

auto_auth

3600
5200
5500


No. of clients = 578
req/s = 40.2
Methodsmedian response time95%99%

DELETE_comment

9100
24000
32000

DELETE_thread

8500
22000
26000

GET_comment_list

8100
22000
32000

GET_thread

12000
26000
40000

GET_thread_list

8300
22000
32000

PATCH_comment

8300
23000
31000

PATCH_thread

8000
23000
28000

POST_comment_comment

9000
24000
32000

OST_comment_response

8500
23000
32000

POST_thread

8300
22000
32000

auto_auth

4100
5100
5400