Versions Compared

Key

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

In Progress

Jira Legacy
serverFOLIO Issue TrackerSystem Jira
serverId6ccf3fe401505d01-3301b853-368a3c2e-983e90f1-20c466b11a49ee9b165564fc
keyPERF-100

Success criteria: 

  •  Scripts to generate the data be checked in
  •  A report showing all the queries and times.
  •  Analysis of why a query with the * token is slow or fast, if possible.


Table of Contents

Overview:

In PERF-83 it was observed that a CQL query with the * token at the end resulted in a faster response time, despite a much higher database usage. 

There are many entities of different statuses in FOLIO. It'd be interesting to see if this pattern holds true for other statuses and CQL queries.

There is 15 K records in DB with Closed status, and 5 K records in DB for Open status.

In this user story, run the following tests:

GET /circulation/loans?limit=2147483647&query=(itemId==${current_item} and status.name=="Closed*")
GET /circulation/requests?(itemId==${item_id} and (status=="Open - Awaiting pickup*" or status=="Open - Awaiting delivery*"))
GET /circulation/requests?(requesterId==${userID} and pickupServicePointId=${servicePoints_Id} and status=="Open - Awaiting pickup*")


Version:

OKAPI - Version 3.1.1

...

Test

Virtual Users

QueryDuration (sec)Rump Up (sec)

1

8

/circulation/loans?limit=2147483647&query=(itemId==${current_item} and status.name=="Closed")

180080
220

/circulation/loans?limit=2147483647&query=(itemId==${current_item} and status.name=="Closed")

200
38

/circulation/loans?limit=2147483647&query=(itemId==${current_item} and status.name=="Closed*")

80
420

/circulation/loans?limit=2147483647&query=(itemId==${current_item} and status.name=="Closed*")

200
58/circulation/requests?(itemId==[current_item] and (status=="Open - Not yet filled" or status=="Open - Awaiting delivery"))80
620/circulation/requests?(itemId==[current_item] and (status=="Open - Not yet filled" or status=="Open - Awaiting delivery"))200
78/circulation/requests?(itemId==[item_id] and (status=="Open - Not yet filled*" or status=="Open - Awaiting delivery*"))80
820/circulation/requests?(itemId==[item_id] and (status=="Open - Not yet filled*" or status=="Open - Awaiting delivery*"))200
98/circulation/requests?(requesterId==[requesterID] and pickupServicePointId=[pickPoint] and status=="Open - Not yet filled")80
1020/circulation/requests?(requesterId==[requesterID] and pickupServicePointId=[pickPoint] and status=="Open - Not yet filled")200
118/circulation/requests?(requesterId==[requesterID] and pickupServicePointId=[pickPoint] and status=="Open - Not yet filled*")80
1220/circulation/requests?(requesterId==[requesterID] and pickupServicePointId=[pickPoint] and status=="Open - Not yet filled*")200

...

For instance for "Closed" status query (GET /circulation/loans?limit=2147483647&query=(itemId==[current_item] and status.name=="Closed")) (test 1, 8 users)75 response time percentile without "*" token is 1.085 seconds and response time 75 percentile for same query with "*" token is 1,074 seconds so in this particular case delta is 11 ms. Same behavior can be seeing in next test for 20 users with same query: without "*" token 75 percentile of response time is 3.815 seconds and with "*" token it's 3.799, delta is 15 ms.

...

Test

Virtual Users

Request
TotalOK75th pct95th pct99th pctMax

1

8

GET /circulation/loans?limit=2147483647&query=(itemId==[current_item] and status.name=="Closed")

link13788137881.0851.2353.0285.706
220

GET /circulation/loans?limit=2147483647&query=(itemId==[current_item] and status.name=="Closed")

link12225121433.8154.7366.18130.171
38

GET /circulation/loans?limit=2147483647&query=(itemId==[current_item] and status.name=="Closed*")

link13691135821.0741.2263.20532.6
420

GET /circulation/loans?limit=2147483647&query=(itemId==[current_item] and status.name=="Closed*")

link12548125483.7994.7155.469.462
58GET /circulation/requests?(itemId==[current_item] and (status==Open - Not yet filled or status==Open - Awaiting delivery))link69925699250.2040.240.3094.328
620GET /circulation/requests?(itemId==[current_item] and (status==Open - Not yet filled or status==Open - Awaiting delivery))link86602866020.4230.5130.66115.306
78GET /circulation/requests?(itemId==[item_id] and (status=="Open - Awaiting pickup*" or status=="Open - Awaiting delivery*"))link67688676880.2140.260.38523.776
820GET /circulation/requests?(itemId==[item_id] and (status=="Open - Awaiting pickup*" or status=="Open - Awaiting delivery*"))link78697786970.480.6070.9698.646
98GET /circulation/requests?(requesterId==[requesterID] and pickupServicePointId=[pickPoint] and status=="Open - Not yet filled")link66713667130.2150.2650.38431.676
1020GET /circulation/requests?(requesterId==[requesterID] and pickupServicePointId=[pickPoint] and status=="Open - Not yet filled")link79364793640.4770.6030.993.834
118GET /circulation/requests?(requesterId==[requesterID] and pickupServicePointId=[pickPoint] and status=="Open - Not yet filled*")link66830668300.2170.2690.4012.991
1220GET /circulation/requests?(requesterId==[requesterID] and pickupServicePointId=[pickPoint] and status=="Open - Not yet filled*")link78824788240.4820.6110.9234.893

...

GET /circulation/loans?limit=2147483647&query=(itemId==[current_item] and status.name=="Closed") 8 Users test run Resources usage:

...

GET /circulation/loans?limit=2147483647&query=(itemId==[current_item] and status.name=="Closed") 20 Users test run Resources usage:

...

As you see, in comparison to "Closed" status test set there is much less DB CPU usage. That may be explained by differences in data set. There is 15 K records in DB with Closed status, and 5 K records in DB for Open status. 


RDS Performance Insights:

...

  1. As was proven - there is no big difference between queries used "*" token and without it.  Difference between 75% response times fluctuates from +11 ms to   -5 ms;
  2. There is dependency between data volume in DB. For instance Closed status records quantity was 15 K and Open status records was 5K. and the difference between 75 % response times are 750%. so volume testing is recommended to define performance degradation depends on data volume. 
  3. The following WARNING statements of missing indexes were generated  by mod-circulation during a test run:

WARNING: Doing LIKE search without index for accounts.jsonb->>'loanId', CQL >>> SQL: loanId == 5fb2c891-64eb-4b6c-b3a2-715ad91f593b >>> lower(f_unaccent(accounts.jsonb->>'loanId')) LIKE lower(f_unaccent('5fb2c891-64eb-4b6c-b3a2-715ad91f593b'))

...