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
Performance improvements mainly around front-end caching #8376
Conversation
…rializer for nucache
…ent when reading from the content cache
…from the contentNu table so we aren't duplicating strings when cold booting.
src/Umbraco.Web/PublishedCache/NuCache/DataSource/CultureVariation.cs
Outdated
Show resolved
Hide resolved
…Umbraco-CMS into v8/feature/nucache-perf
support uInt32
…Umbraco-CMS into v8/feature/nucache-perf
…Umbraco-CMS into v8/feature/nucache-perf
…property basis. Option for compressing the properties in sql/nucache.db. Option for immediate/lazy decompression of properties. Mapping support for shorter property alias. TODO: config file for property map TODO: HasValue and IsValue on propertyvalueconverterbase
…ession WIP Option C - Compress custom properties for nucache to reduce memory consumption
…che-perf # Conflicts: # src/Umbraco.TestData/LoadTestComposer.cs
…-perf # Conflicts: # src/Umbraco.Core/Sync/DatabaseServerMessenger.cs # src/Umbraco.Core/Sync/ISyncBootStateAccessor.cs # src/Umbraco.Core/Sync/NonRuntimeLevelBootStateAccessor.cs # src/Umbraco.Core/Sync/SyncBootState.cs # src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs # src/Umbraco.Tests/PublishedContent/NuCacheTests.cs # src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs # src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs # src/Umbraco.Tests/TestHelpers/TestSyncBootStateAccessor.cs # src/Umbraco.Web/Compose/DatabaseServerRegistrarAndMessengerComponent.cs # src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs # src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
I've added more benchmarks (above). The running memory and rebuild times aren't significantly different so nothing to really report on there. Though, that might be different if there are tens of thousands of nodes. The only thing I'd still like to benchmark is the effect of having the compressed property data and rendering. I've moved this as ready to review. I can see that v8/contrib needs to be re-merged in though. |
// which then performs a Clustered Index Scan on PK_umbracoPropertyData which means it iterates the entire table which can be enormous! | ||
// especially if there are both a lot of content but worse if there is a lot of versions of that content. | ||
// So is it possible to return this property data without doing an index scan on PK_umbracoPropertyData and without iterating every row | ||
// in the table? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the oldest version of SQL server Umbraco supports. Essentially are indexed views a possibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently says
SQL Server 2012 and higher
https://our.umbraco.com/documentation/Fundamentals/Setup/Requirements/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.. Just small comments. I fear the merge to v9 🙈
src/Umbraco.Web/PublishedCache/NuCache/DataSource/MsgPackContentNestedDataSerializer.cs
Outdated
Show resolved
Hide resolved
Happy to help with merge to v9. I've updated the PR based on your comments. |
One thing to test that I don't know if you did is to change the config: <add key="Umbraco.Web.PublishedCache.NuCache.Serializer" value="MsgPack"/> to <add key="Umbraco.Web.PublishedCache.NuCache.Serializer" value="JSON"/> which will force the nucache table to rebuild on startup with the correct format. You can verify this by looking in the nucache DB table. WIth MsgPack it will populate the binary column, with JSON it will populate the string column. |
I tested this and it seems to work as expected 🎉 I also executed the acceptance tests.. A Single test does not pass, but that is not related to this PR. (Fixed in this PR #10516) |
Please remember to mark with a release version. I've marked as 8.15. |
Thanks @Shazwazza I was about to do this as well! 👍 |
This is a merge PR which merges in #8376 to v9
@Shazwazza I just noticed some separate commits to fix the migration from this PR to support SQL CE, but that doesn't seem to drop the temp table after moving all rows back to the original table: Umbraco-CMS/src/Umbraco.Core/Migrations/Upgrade/V_8_15_0/AddCmsContentNuByteColumn.cs Lines 22 to 32 in 7dc0325
|
@ronaldbarendse good catch - I guess we're too late now and it will need to be in the next minor release 🤦♂️ 🤦♂️ 🤦♂️ @nul800sebastiaan any thoughts? |
We can add a release note mentioning you can manually remove the table ( Because it's only on SQL CE, this should only happen on development databases, so it's not a big issue anyway. And if we fix up this migration in a next patch release, upgrading a pre 8.15.0 site to 8.15.1 won't have this problem 👍🏻 Also note the double prefix of Umbraco-CMS/src/Umbraco.Core/Migrations/Upgrade/V_8_15_0/AddCmsContentNuByteColumn.cs Line 42 in 7dc0325
This is probably because of the comment on the original
We can also fix this up, but it shouldn't matter, as it's a temporary table anyway 😉 |
This is a branch of some ideas being chatted about in #8365
<add key="Umbraco.Web.PublishedCache.NuCache.Serializer" value="JSON"/>
. MessagePack will be the default that we ship with. There's a check in place during start to detect if the config switch has changed and it will rebuild the nucache tablesIPropertyCacheCompressionOptions
which will determine if a property should be compressed in memory. Example:composition.RegisterUnique<IPropertyCacheCompressionOptions, CustomPropertyCacheCompressionOptions>();
Other changes:
Benchmark
The raw numbers here are not the interesting part since that is largely dependent on my machine. It's the % that are the important figures. This Umbraco install has ~ 16k nodes.
Table Sizes
With MsgPack binary serialization the database table size is reduced by ~ 73%
Cold Boot time
An average based on 10 runs
The new code changes and with the MsgPack system performs ~ 70% better than the original implementation. It's also far more consistent. Before on average every 2nd cold boot would have a very long boot time.
Normal Boot time
This is based on the normal boot process (non cold boot) to see what the perf difference is of having the local nucache files vs loading directly from the database (i.e.
IgnoreLocalDb = true
). With the new DB indexes and code changes we perform about 15% faster when loading in memory nucache from the DB (this figure would be larger if running the database over the network/internet). But as you can see it's still quite a lot faster to have the local nucache files.Cold boot memory
This is a comparison of mem consumption during cold booting between this codebase and 8.13. This was run several times with the same result. The cold boot memory footprint of this code base is lower than 8.13
From bootup until page render. Significantly less memory.
After first page render and navigating several pages. This one is the most surprising because it seems that a cold boot before these changes even after boot requires more memory than normal to run.
Warm boot memory
This is a comparison of mem consumption during warm booting between this codebase and 8.13. This was run several times with the same result. The cold boot memory footprint of this code base is lower than 8.13
From bootup until page render. .Not a huge change but still less memory.
After first page render and navigating several pages. Not a huge change but still less memory.
String Duplicates
In this codebase there is some usages of string interning. Based on profiling you can see that this is working a bit but it's not perfect. We are trying to intern all common strings that are dynamic such as property type aliases, content type aliases, etc... Here's a comparison of this codebase vs 8.13 with the same data in the database and sorted by the highest duplicate string count. You can see that a lot of alias duplicates are reduced but they certainly still exist. We should continue to string intern these values throughout the codebase in the future to further reduce this.
This codebase:
8.13: