Feature #17074
closedUse count=none when fetching pages
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:
- Use count=none when getting populating project contents.
- Continue to use offset for paging
- We issue a separate query to get the total number of items, with
limit=0
andcount=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.
Related issues
Updated by Peter Amstutz 10 months ago
- Target version changed from Future to Development 2024-02-28 sprint
- Description updated (diff)
Updated by Peter Amstutz 9 months ago
- Target version changed from Development 2024-02-28 sprint to Development 2024-03-13 sprint
Updated by Peter Amstutz 9 months ago
- Target version changed from Development 2024-03-13 sprint to Development 2024-03-27 sprint
Updated by Peter Amstutz 9 months ago
- Target version changed from Development 2024-03-27 sprint to Development 2024-04-10 sprint
Updated by Peter Amstutz 8 months ago
- Target version changed from Development 2024-04-10 sprint to Development 2024-04-24 sprint
Updated by Peter Amstutz 8 months ago
- Target version changed from Development 2024-04-24 sprint to Development 2024-05-08 sprint
Updated by Peter Amstutz 8 months ago
- Target version changed from Development 2024-05-08 sprint to Development 2024-06-05 sprint
Updated by Peter Amstutz 6 months ago
- Target version changed from Development 2024-06-05 sprint to 439
Updated by Peter Amstutz 6 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
Updated by Peter Amstutz 6 months ago
- Target version changed from 439 to Development 2024-06-19 sprint
Updated by Peter Amstutz 6 months ago
- Target version changed from Development 2024-06-19 sprint to Development 2024-07-03 sprint
Updated by Peter Amstutz 5 months ago
- Target version changed from Development 2024-07-03 sprint to Development 2024-07-24 sprint
Updated by Peter Amstutz 4 months ago
- Target version changed from Development 2024-07-24 sprint to Development 2024-08-07 sprint
Updated by Peter Amstutz 3 months ago
- Subject changed from Use count=none & keyset paging to Use count=none when fetching pages
Updated by Peter Amstutz 3 months ago
- Target version changed from Development 2024-08-07 sprint to Development 2024-08-28 sprint
Updated by Peter Amstutz 3 months ago
- Target version changed from Development 2024-08-28 sprint to Development 2024-09-11 sprint
Updated by Stephen Smith 2 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
- 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
- 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
Updated by Peter Amstutz 2 months ago
- Target version changed from Development 2024-09-11 sprint to Development 2024-09-25 sprint
Updated by Peter Amstutz 2 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).
Updated by Stephen Smith 2 months ago
- Status changed from In Progress to Resolved