Project

General

Profile

Actions

Bug #11803

closed

repositories#get_all_permissions API should not be so slow

Added by Tom Clegg almost 7 years ago. Updated almost 7 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Story points:
1.0

Subtasks 2 (0 open2 closed)

Task #11848: fix slow inner loop in RepositoriesController#get_all_permissionsResolvedTom Clegg06/13/2017Actions
Task #11835: Review 11803-repo-permsResolvedPeter Amstutz06/14/2017Actions
Actions #1

Updated by Tom Morris almost 7 years ago

  • Target version set to 2017-06-21 sprint
  • Story points set to 1.0
Actions #2

Updated by Tom Clegg almost 7 years ago

  • Assigned To set to Tom Clegg
Actions #3

Updated by Tom Clegg almost 7 years ago

  • Status changed from New to In Progress
Actions #5

Updated by Tom Clegg almost 7 years ago

It looks like user.group_permissions() is the thing that is either cached or slow. Instead of calling/retrieving this for each user individually for each link giving permission to a repo, we can get one big hash up front with permissions for all users, so the inner loop needs to do 2 hash lookups.

There's certainly more room for improvement in get_all_permissions, but this easy change should bring the slowest queries down from ~60s to ~1s.

11803-repo-perms @ ec7510c680ee2065d6372fef6a340ef754dbe724

Actions #6

Updated by Peter Amstutz almost 7 years ago

Tom Clegg wrote:

It looks like user.group_permissions() is the thing that is either cached or slow. Instead of calling/retrieving this for each user individually for each link giving permission to a repo, we can get one big hash up front with permissions for all users, so the inner loop needs to do 2 hash lookups.

There's certainly more room for improvement in get_all_permissions, but this easy change should bring the slowest queries down from ~60s to ~1s.

11803-repo-perms @ ec7510c680ee2065d6372fef6a340ef754dbe724

LGTM.

But I got these test failures:

  1) Failure:
ContainerTest#test_find_reusable_with_logging_disabled [/usr/src/arvados/services/api/lib/log_reuse_info.rb:13]:
unexpected invocation: #<ActiveSupport::Logger:0x564654464998>.info('find_reusable: starting with 12 container records in database')
unsatisfied expectations:
- expected never, invoked once: #<ActiveSupport::Logger:0x564654464998>.info(any_parameters)

  2) Failure:
JobTest#test_find_reusable_without_logging [/usr/src/arvados/services/api/lib/log_reuse_info.rb:13]:
unexpected invocation: #<ActiveSupport::Logger:0x564654464998>.info('find_reusable: starting with 35 jobs readable by current user zzzzz-tpzed-xurymjxw79nv3jz')
unsatisfied expectations:
- expected never, invoked once: #<ActiveSupport::Logger:0x564654464998>.info(any_parameters)

Running in jenkins now: https://ci.curoverse.com/job/developer-run-tests-services-api/328/

Actions #7

Updated by Peter Amstutz almost 7 years ago

Turns out I have a test configuration override of "log_reuse_decisions: true" so false alarm. Please merge.

Actions #8

Updated by Tom Clegg almost 7 years ago

  • Status changed from In Progress to Resolved
Actions

Also available in: Atom PDF