What happened?
Description
All OS cultures are loaded and iterated on each and every request besides /, see https://github.com/Sitecore/ASP.NET-Core-SDK/blob/main/src/Sitecore.AspNetCore.SDK.RenderingEngine/Routing/LanguageRouteConstraint.cs#L26
Without ASP.NET OutputCache the issue is not that severe, ~15 req/sec (1.000 requests, concurrency 10) but when enabling OutputCache then / does ~40.000 req/sec (5.000 requests, concurrency 50) but all other pages only ~4.000 req/sec!
I see no reason to call CultureInfo.GetCultures(CultureTypes.AllCultures) at all since all supported cultures are already defined on Microsoft.AspNetCore.Builder.RequestLocalizationOptions.SupportedCultures during startup in UseRequestLocalization, see https://github.com/Sitecore/ASP.NET-Core-SDK/blob/main/tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/Localization/AdvanceLocalizationFixture.cs#L49.
Reproduction Steps
- Enable ASP.NET OutputCache
- Measure throughput on
/ and some other route, you will see a ~10x slow down on the other route
- Remove calls in startup to
Sitecore.AspNetCore.SDK.RenderingEngine.Extensions.MapSitecoreLocalizedRoute
- Measure throughput on
/ and some other route, you will see similar throughput of both root and the other route
Relevant log output
Code of Conduct
What happened?
Description
All OS cultures are loaded and iterated on each and every request besides
/, see https://github.com/Sitecore/ASP.NET-Core-SDK/blob/main/src/Sitecore.AspNetCore.SDK.RenderingEngine/Routing/LanguageRouteConstraint.cs#L26Without ASP.NET OutputCache the issue is not that severe, ~15 req/sec (1.000 requests, concurrency 10) but when enabling OutputCache then
/does ~40.000 req/sec (5.000 requests, concurrency 50) but all other pages only ~4.000 req/sec!I see no reason to call
CultureInfo.GetCultures(CultureTypes.AllCultures)at all since all supported cultures are already defined onMicrosoft.AspNetCore.Builder.RequestLocalizationOptions.SupportedCulturesduring startup inUseRequestLocalization, see https://github.com/Sitecore/ASP.NET-Core-SDK/blob/main/tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/Localization/AdvanceLocalizationFixture.cs#L49.Reproduction Steps
/and some other route, you will see a ~10x slow down on the other routeSitecore.AspNetCore.SDK.RenderingEngine.Extensions.MapSitecoreLocalizedRoute/and some other route, you will see similar throughput of both root and the other routeRelevant log output
Code of Conduct