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

Avoid repeated reloads of content and media cache following Deploy operations. #10360

Merged
merged 1 commit into from
Jun 15, 2021

Conversation

AndyButland
Copy link
Contributor

This PR is an attempt to mitigate some issues reported on Umbraco Cloud with deployment operations containing document type changes and large databases (either numbers of nodes, versions or both).

I've observed from logs that there are repeated calls to reload the content and media cache - twice for every document type in the deployment batch - so with 5 document types, there are 10 full reloads.

This seems unnecessary - as when a document type changes all content is reloaded. There's no logic to refresh parts of the cache for different document types, hence it seems we don't really care which document type has been updated in this context, just that one has.

So I've amended the logic for refreshing the cache to handle only single content type event, even if there are several.

I initially tried to adapt this in Deploy - by only raising one event instead of several - but there are other components, namely Heartcore, that rely on knowing exactly which content type has changed via the distributed cache.

To Test:

  • With a Cloud site, push an update containing several document type changes.
  • View the logs. You should see only one entry like the following associated with the deployment. Before this PR you'd see 2 x number of document types.
{"@t":"2021-05-31T13:54:34.1191291Z","@mt":"{StartMessage} [Timing {TimingId}]","StartMessage":"Loading content from database",...
{"@t":"2021-05-31T13:55:08.4989863Z","@mt":"{EndMessage} ({Duration}ms) [Timing {TimingId}]","EndMessage":"Completed.",...
{"@t":"2021-05-31T13:55:08.5249691Z","@mt":"{StartMessage} [Timing {TimingId}]","StartMessage":"Loading media from database",...
{"@t":"2021-05-31T13:55:09.3561273Z","@mt":"{EndMessage} ({Duration}ms) [Timing {TimingId}]","EndMessage":"Completed.",...

…and media cache multiple times after a deployment containing more than one changed document type.
@nikolajlauridsen
Copy link
Contributor

Code looks fine to me. I'm just wondering how we'd port this over to netcore, since the DistributedCacheBinder is no longer a thing and there is no equivalent to HandleEvents for notifications, so there's not really any place for this logic to live.

@rasmusjp
Copy link
Member

rasmusjp commented Jun 1, 2021

I'm wondering if there's a way (maybe in Deploy) to aggregate the events of the same type into a single one, given the properties that contain the changed data is an IEnumerable. That way we'll end up with at a single event for each service containing all the changes

@nul800sebastiaan nul800sebastiaan added category/performance Fixes for performance (generally cpu or memory) fixes release/8.15.0 type/feature labels Jun 15, 2021
@nul800sebastiaan nul800sebastiaan merged commit 348d167 into v8/dev Jun 15, 2021
@nul800sebastiaan nul800sebastiaan deleted the v8/bugfix/handle-single-content-type branch June 15, 2021 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/performance Fixes for performance (generally cpu or memory) fixes release/8.15.0 type/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants