rob05c opened a new issue #4473: Endpoints /deliveryservices_regexes, /jobs are 
unperformant, need changed to tenant.GetUserTenantIDListTx
URL: https://github.com/apache/trafficcontrol/issues/4473
 
 
   ## I'm submitting a ...
   - [x] bug report
   
   ## Traffic Control components affected ...
   - [x] Traffic Ops
   
   ## Current behavior:
   `/jobs` and `/deliveryservices_regexes` are incredibly slow, taking 15-60 
seconds on large datasets. 
   
   This is because they're both calling the expensive 
`tenant.IsResourceAuthorizedToUserTx` in a loop, instead of calling 
`tenant.GetUserTenantIDListTx` once on the user and adding the result to the 
query of the object.
   
   
https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/invalidationjobs/invalidationjobs.go#L252
   
https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/deliveryservicesregexes/deliveryservicesregexes.go#L82
   
   The solution is to change them to call `tenant.GetUserTenantIDListTx` once 
and add the result to the query via `dbhelpers.AddTenancyCheck`. See:
   
https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go#L919
   
   This is not just a performance issue, but the slow queries also cause 
database load issues.
   The new client-side Config Generator `atstccfg` needs these endpoints, 
meaning every cache is now frequently requesting them, making this a much 
bigger issue than in the past. Hence, I'm labelling this `bug` and `major`.
   
   ## Expected / new behavior:
   `/jobs` and `/deliveryservices_regexes` should not be unnecessarily slow.
   
   ## Minimal reproduction of the problem with instructions:
   Request `/jobs` and `/deliveryservices_regexes` with a large database.
   
   ## Anything else:
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to