Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for caching embedded objects without a self link & null responses #3415

Conversation

alexandrevryghem
Copy link
Member

@alexandrevryghem alexandrevryghem commented Oct 11, 2024

References

Description

Reduced the number of requests sent to the backend by caching embedded null objects (this will prevent unnecessary thumbnail requests). Also added support for caching embedded objects without a self-link. (Credit for this PR goes to @Atmire-Kristof)

Instructions for Reviewers

List of changes in this PR:

  • Added support to cache null responses.
  • Added support to cache embedded objects without self links.
  • Embedded the accessStatus in places where a separate request was made.

Guidance for how to test/review this PR:

  • On demo, go to your network tab and select Item Type Publication. Verify that a lot of thumbnail and accessStatus requests are made.
  • Perform the same action with this fix and verify that both the thumbnail and accessStatus requests are now cached.
  • These changes also apply to the browse page, the item page's related items section, the delete item tab, and the recent submissions section on the home page.

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

Atmire-Kristof and others added 8 commits October 2, 2023 13:31
# Conflicts:
#	src/app/core/cache/object-cache.reducer.ts
#	src/app/core/cache/object-cache.service.ts
…m submissions & the item page related items & delete tab when enabled
…107155_Performance-re-request-embeds-main

# Conflicts:
#	src/app/collection-page/collection-page.component.ts
#	src/app/core/breadcrumbs/item-breadcrumb.resolver.ts
#	src/app/core/browse/browse.service.spec.ts
#	src/app/core/browse/browse.service.ts
#	src/app/core/data/relationship-data.service.spec.ts
#	src/app/core/data/relationship-data.service.ts
#	src/app/item-page/edit-item-page/abstract-item-update/abstract-item-update.component.ts
#	src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.spec.ts
#	src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts
#	src/app/item-page/item.resolver.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts
#	src/app/shared/utils/relation-query.utils.ts
@alexandrevryghem alexandrevryghem added bug component: Discovery related to discovery search or browse system performance / caching Related to performance, caching or embedded objects claimed: Atmire Atmire team is working on this issue & will contribute back labels Oct 11, 2024
@alexandrevryghem alexandrevryghem added this to the 9.0 milestone Oct 11, 2024
@alexandrevryghem alexandrevryghem self-assigned this Oct 11, 2024
@ybnd
Copy link
Member

ybnd commented Oct 16, 2024

Note: #3163 should probably remain open since this PR doesn't cover everything mentioned there (search facets)

Copy link
Member

@kshepherd kshepherd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 I tested search, browse, item status / edit item, My DSpace, related entities / items and can verify fewer requests (many fewer requests in the case of item lists with no thumbnails) as both an unauthenticated and authenticated user. No errors or issues encountered.
The code changes look good to me too, nothing big stood out (though this +1 is more of a practical test and feedback than a thorough code review.)
Thanks @alexandrevryghem ! Looks like great progress towards improving performance and efficiency

@tdonohue tdonohue added port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release labels Oct 29, 2024
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @alexandrevryghem ! This looks great and works well. I can verify this has many fewer requests on all browse/search pages. I did notice however that we still have several /items/[uuid]/accessStatus calls occurring on the MyDSpace (but those /accessStatus calls no longer occur for the search/browse pages).

Nonetheless, this is a huge improvement, so I'll go ahead and merge it and see if it can be ported automatically to 7.x and 8.

@tdonohue tdonohue merged commit f2c2fda into DSpace:main Oct 30, 2024
13 checks passed
@dspace-bot
Copy link
Contributor

Backport failed for dspace-7_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-7_x
git worktree add -d .worktree/backport-3415-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-3415-to-dspace-7_x
git switch --create backport-3415-to-dspace-7_x
git cherry-pick -x be6dbdec66e6caf000c966a2e1e30f3acf199458 984c9bfc2a2271e65190e02902ea0589dcfe6c4f 704cc06f1647c29fadb0ba12f93fde5d190d8a7f b709ee03000086cd52f5de9bc67d5619a64df29d

@dspace-bot
Copy link
Contributor

Backport failed for dspace-8_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-8_x
git worktree add -d .worktree/backport-3415-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-3415-to-dspace-8_x
git switch --create backport-3415-to-dspace-8_x
git cherry-pick -x be6dbdec66e6caf000c966a2e1e30f3acf199458 984c9bfc2a2271e65190e02902ea0589dcfe6c4f 704cc06f1647c29fadb0ba12f93fde5d190d8a7f b709ee03000086cd52f5de9bc67d5619a64df29d

@tdonohue
Copy link
Member

@alexandrevryghem : Would you be able to (manually) port this to both dspace-8_x and dspace-7_x? Both of the automated ports have failed.

@alexandrevryghem alexandrevryghem deleted the w2p-107155_Performance-re-request-embeds-main branch October 30, 2024 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug claimed: Atmire Atmire team is working on this issue & will contribute back component: Discovery related to discovery search or browse system high priority performance / caching Related to performance, caching or embedded objects port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Null objects aren't cached Use projections to avoid multiple accessStatus requests per page.
6 participants