-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
10.6.1 to 12.x
Bug summary
We have a site with 6 languages. We also have uMarketing suite installed. For some pages multiple segment variants are created with uMarketing suite.
We noticed while adding more languages, and the customer creating personalized content with uMarketingSuite this slows down loading of content in the backoffice. The frontend runs just fine.
We noticed that getting a response from this API method is slow :
| public ActionResult<ContentItemDisplayWithSchedule?> GetById(int id) |
On our live environment this takes up between 8 to 10 seconds to return a result. With the copy of the database of the live environment on our local machine this takes between 5 and 7 seconds.
Adding more variants (culture or segment) increases the response time. Removing variants decreases the response time.
We see the same behavior when use this database on a clean Umbraco install. So we can rule out uMarketing suite.
Specifics
I did a debugging session against the Umbraco source code and found where the majority of time is spent.
It happens in this method :
| public override void Map(IProperty originalProp, ContentPropertyDisplay dest, MapperContext context) |
This mapping function is called for each property in each variant. Because this happens in a loop we are executing code that is the same for all properties in all variants.
For example getting the datatype configuration. But this is the same for all variants, so there is no need to get it over and over again.
This can be probably be improved by getting all this information earlier in the mapping process and pass it on using the MappingContext.
Steps to reproduce
Create a site with a lot of culture variants. If needed install uMarketingSuite and some personalized content as well.
See the performance of the GetById degrading with each variant added.
Expected result / actual result
Adding more variants should not slow down the retrieval of content significantly.