Project

General

Profile

Actions

Feature #17074

closed

Use count=none when fetching pages

Added by Peter Amstutz about 4 years ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Workbench2
Story points:
-
Release:
Release relationship:
Auto

Description

Calculating "items_available" in list requests is expensive.

For example, on a user cluster, they have a project with over 2 million collections and it takes around 10 seconds to return 50 items.

On another user cluster, they have 600,000 projects and the "shared with me" groups list takes over 5 seconds to return 50 items.

I will have to make some manual API calls to double check but I believe if we use "count=none" then it will skip having to count all rows and results will be returned much faster (a few hundred ms).

Using "offset" for paging is also expensive, because it throws away results. Without knowing the total count, offset paging cannot provide a "navigate to last page" option, as it does not know how many pages there are. Offset paging also produces unexpected results if list order changes during navigation.

We want to make the following changes:

  1. Use count=none when getting populating project contents.
  2. Continue to use offset for paging
  3. We issue a separate query to get the total number of items, with limit=0 and count=exact -- this way, populating the page isn't held up by waiting for the full count. We can also limit the full count to only on an initial load or refresh of the project panel.

NOTE

We have to continue using offset paging because the "contents" endpoint doesn't completely support keyset paging; it works by concatenating tables (manually in ruby code instead of a UNION query) and the order that tables are queried and returned isn't lexically ordered.

Old note about contents

    klasses = [Group,
     Job, PipelineInstance, PipelineTemplate, ContainerRequest, Workflow,
     Collection,
     Human, Specimen, Trait]

If we remove the deprecated stuff:

    klasses = [Group,
     ContainerRequest, Workflow,
     Collection]

We get get object ids

  • j7d0g
  • xvhdp
  • 7fd4e
  • 4zz18

Which means Workflow and Collection are out of order. So getting contents ordered by uuid won't be totally ordered.

There's a workaround where the client passes back last_object_class, so we might be able to get away with that.


Subtasks 1 (0 open1 closed)

Task #21917: Review 17074-optimize-itemsavailableResolvedPeter Amstutz09/16/2024Actions

Related issues 1 (0 open1 closed)

Related to Arvados - Bug #21814: How to efficiently page group contents queries of more than one object type (e.g. "shared with me")ResolvedPeter AmstutzActions
Actions #1

Updated by Peter Amstutz about 4 years ago

  • Description updated (diff)
Actions #2

Updated by Peter Amstutz almost 2 years ago

  • Release changed from 31 to 60
Actions #3

Updated by Peter Amstutz over 1 year ago

  • Target version set to Future
Actions #4

Updated by Peter Amstutz over 1 year ago

  • Description updated (diff)
Actions #5

Updated by Peter Amstutz over 1 year ago

  • Release deleted (60)
Actions #6

Updated by Peter Amstutz over 1 year ago

  • Description updated (diff)
Actions #7

Updated by Peter Amstutz over 1 year ago

  • Description updated (diff)
Actions #8

Updated by Peter Amstutz over 1 year ago

  • Description updated (diff)
Actions #9

Updated by Peter Amstutz 11 months ago

  • Target version changed from Future to Development 2024-02-28 sprint
  • Description updated (diff)
Actions #10

Updated by Peter Amstutz 10 months ago

  • Target version changed from Development 2024-02-28 sprint to Development 2024-03-13 sprint
Actions #11

Updated by Peter Amstutz 10 months ago

  • Target version changed from Development 2024-03-13 sprint to Development 2024-03-27 sprint
Actions #12

Updated by Peter Amstutz 10 months ago

  • Target version changed from Development 2024-03-27 sprint to Development 2024-04-10 sprint
Actions #13

Updated by Peter Amstutz 10 months ago

  • Tracker changed from Bug to Feature
Actions #14

Updated by Peter Amstutz 9 months ago

  • Target version changed from Development 2024-04-10 sprint to Development 2024-04-24 sprint
Actions #15

Updated by Peter Amstutz 9 months ago

  • Target version changed from Development 2024-04-24 sprint to Development 2024-05-08 sprint
Actions #16

Updated by Peter Amstutz 9 months ago

  • Target version changed from Development 2024-05-08 sprint to Development 2024-06-05 sprint
Actions #17

Updated by Peter Amstutz 7 months ago

  • Target version changed from Development 2024-06-05 sprint to 439
Actions #18

Updated by Peter Amstutz 7 months ago

  • Related to Bug #21814: How to efficiently page group contents queries of more than one object type (e.g. "shared with me") added
Actions #19

Updated by Peter Amstutz 7 months ago

  • Release set to 70
Actions #20

Updated by Peter Amstutz 7 months ago

  • Target version changed from 439 to Development 2024-06-19 sprint
Actions #21

Updated by Peter Amstutz 7 months ago

  • Target version changed from Development 2024-06-19 sprint to Development 2024-07-03 sprint
Actions #22

Updated by Peter Amstutz 6 months ago

  • Assigned To set to Stephen Smith
Actions #23

Updated by Stephen Smith 6 months ago

  • Status changed from New to In Progress
Actions #24

Updated by Peter Amstutz 6 months ago

  • Target version changed from Development 2024-07-03 sprint to Development 2024-07-24 sprint
Actions #25

Updated by Peter Amstutz 5 months ago

  • Target version changed from Development 2024-07-24 sprint to Development 2024-08-07 sprint
Actions #26

Updated by Peter Amstutz 4 months ago

  • Subject changed from Use count=none & keyset paging to Use count=none when fetching pages
Actions #27

Updated by Peter Amstutz 4 months ago

  • Description updated (diff)
Actions #28

Updated by Peter Amstutz 4 months ago

  • Target version changed from Development 2024-08-07 sprint to Development 2024-08-28 sprint
Actions #29

Updated by Peter Amstutz 4 months ago

  • Target version changed from Development 2024-08-28 sprint to Development 2024-09-11 sprint
Actions #30

Updated by Stephen Smith 3 months ago

Changes at arvados|c3ba804dfbf425909f465cb26a9395fd488b7b99 branch 17074-optimize-itemsavailable
Tests developer-run-tests-services-workbench2: #1110

  • All agreed upon points are implemented / addressed.
    • Changed itemsAvailable in DE to optional, added action/reducer to set itemsAvailable
    • Cleanup and refactor various DE middewares to prepare for changes
    • Changed criteriachanged to default to true
      • criteriachanged was previously only used by the search page and left undefined in other DEs, except when the middleware calls certain reducers (page change, rows per page change). This change ensures criteriachanged is always set to true unless explicitly set to false like in the aforementioned exception cases. I think it makes sense for the default to be true since it will only be false in these special cases like changing pages
      • This allows using criteriachanged to control / prevent re-requesting count when paging vs changing filters
    • Prevent DE from applying updates if DE is pending (and therefore is stale) - reduces appearance of flickering
    • Added loading flag and indicator to pagination component
    • Added requestCount method to DataExplorerMiddlewareService and implement in all DE middlewares
      • A few can't be implemented currently so they just have a stub for now and they continue to request count with the main request
        • search results has special logic involving itemsAvailable
        • user profile groups uses a filtered list query
        • The workflow panel at /workflows is unused and doesn't load anything afaict so I skipped that one
    • Added separate state machine to prevent race conditions when requesting count, follows the REQUEST_ITEMS state machine pattern to handle keeping track of stale count requests and re-issue count requests
      • I decided to break from the pattern slightly and not reissue requests if the request fails to prevent an infinite loop of requests which is possible for the REQUEST_COUNT state machine
    • Updated tests
  • Anything not implemented (discovered or discussed during work) has a follow-up story.
    • n/a
  • Code is tested and passing, both automated and manual, what manual testing was done is described
    • Updated tests to check for the count request
    • Manually tested to make sure race conditions aren't possible
  • Documentation has been updated.
    • n/a
  • Behaves appropriately at the intended scale (describe intended scale).
    • Strictly improvements to scale - shared with me on tordo used to take 4.6 seconds, it now takes 0.3s with the count filling in after 3 or so seconds.
  • Considered backwards and forwards compatibility issues between client and server.
    • No issues
  • Follows our coding standards and GUI style guidelines.
    • yes
Actions #31

Updated by Peter Amstutz 3 months ago

  • Target version changed from Development 2024-09-11 sprint to Development 2024-09-25 sprint
Actions #32

Updated by Peter Amstutz 3 months ago

Stephen Smith wrote in #note-30:

Changes at arvados|c3ba804dfbf425909f465cb26a9395fd488b7b99 branch 17074-optimize-itemsavailable
Tests developer-run-tests-services-workbench2: #1110

  • All agreed upon points are implemented / addressed.
    • Changed itemsAvailable in DE to optional, added action/reducer to set itemsAvailable
    • Cleanup and refactor various DE middewares to prepare for changes
    • Changed criteriachanged to default to true
      • criteriachanged was previously only used by the search page and left undefined in other DEs, except when the middleware calls certain reducers (page change, rows per page change). This change ensures criteriachanged is always set to true unless explicitly set to false like in the aforementioned exception cases. I think it makes sense for the default to be true since it will only be false in these special cases like changing pages
      • This allows using criteriachanged to control / prevent re-requesting count when paging vs changing filters
    • Prevent DE from applying updates if DE is pending (and therefore is stale) - reduces appearance of flickering
    • Added loading flag and indicator to pagination component
    • Added requestCount method to DataExplorerMiddlewareService and implement in all DE middlewares
      • A few can't be implemented currently so they just have a stub for now and they continue to request count with the main request
        • search results has special logic involving itemsAvailable
        • user profile groups uses a filtered list query
        • The workflow panel at /workflows is unused and doesn't load anything afaict so I skipped that one
    • Added separate state machine to prevent race conditions when requesting count, follows the REQUEST_ITEMS state machine pattern to handle keeping track of stale count requests and re-issue count requests
      • I decided to break from the pattern slightly and not reissue requests if the request fails to prevent an infinite loop of requests which is possible for the REQUEST_COUNT state machine
    • Updated tests
  • Anything not implemented (discovered or discussed during work) has a follow-up story.
    • n/a
  • Code is tested and passing, both automated and manual, what manual testing was done is described
    • Updated tests to check for the count request
    • Manually tested to make sure race conditions aren't possible
  • Documentation has been updated.
    • n/a
  • Behaves appropriately at the intended scale (describe intended scale).
    • Strictly improvements to scale - shared with me on tordo used to take 4.6 seconds, it now takes 0.3s with the count filling in after 3 or so seconds.
  • Considered backwards and forwards compatibility issues between client and server.
    • No issues
  • Follows our coding standards and GUI style guidelines.
    • yes

This LGTM!

This is a great improvement! There's still a bit of delay in loading a page, but it doesn't seem to be waiting for the server, so I suspect next thing to focus on will be streamlining browser rendering (and maybe inefficient data handling in the redux store).

Actions #33

Updated by Stephen Smith 3 months ago

  • Status changed from In Progress to Resolved
Actions

Also available in: Atom PDF