I decided to run some tests on an empty EpiServer site with the following 3 scenarios:
We've identified that UrlResolver.GetUrl is one of the culprits in the severe degradation of performance we see when using this module, so I decided to use that as reference. 5 iterations of 500 calls to the method gave the following results:
Note: Subsequent testing doesn't always replicate these results. I'm not sure why yet, but UrlResolver.GetUrl works fine suddenly (no code changes). Still, the results with active A/B tests are in the 200 - 230ms range, almost 3x the results without the plugin installed.
The code used for testing:
var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>(); List<string> results = new List<string>(); for (int x=0;x<5;x++) { var watch = Stopwatch.StartNew(); for (int i=0;i<500;i++) { urlResolver.GetUrl(Model.TestRef); } watch.Stop(); results.Add(string.Format("500 iterations took {0}ms", watch.ElapsedMilliseconds)); }
So why is this so much slower? SQL Profiler might have the answer.
Are we doing something wrong when configuring our sites, or is this plugin simply not usable on production sites?
I am very curious about this. Could someone at episerver please answer this? We are about to install this on a multisite soluton with +30 websites and this might be very bad if we are having trouble with performance.
We have filed a support incident with EPiServer on this issue, I'll update the thread as soon as I hear anything from them.
We have gotten a response from EPiServer support on this issue, and they suggest to cache all calls to UrlResolver.GetUrl.
Not really a solution, but might be an alright workaround until EPiServer have implemented a better fix. (Haven't tested myself yet)
I haven't dug into the AB testing myself but i have to ask.
Why does the AB test module affect the UrlResolver?
Will it return different urls depending on if it is in the A or B group?
If that is the case wouldn't caching really screw up the AB test result?
(i guess it would mitigate the performance issues if you install the AB test without using it but is that really what you need to solve?)
The A/B test hooks into the LoadedContent and LoadedChildren events triggered from IContentLoader or anything that implements IContentEvents. which in turn is used by UrlResolver, and lots of other places.
If there are active tests, the LoadedContent eventhandler in EPiServer.Marketing.Testing.Web.TestHandler loads more content, which triggers more of the LoadedContent eventhandler.
The same can happen for LoadedChildren, which may quicky escalate out of control if you have active AB tests on children and childrens children.
These events do quite a bit of logic (checking for cookie data, setting cookies, loading data from the database, saving test data).
Disclaimer: It's not easy to read decompiled code on a friday afternoon. Might have overlooked something obvious that mitigates some of this. Some caching is done on loading the tests, but theres still a lot more database traffic compared to a the same application without the Marketing.Testing nuget installed.
An update from support is that they've reported it to EPiSever developers, and will update me when they've gotten a response from them.
Got an updated response from EPiServer support who confirmed the bug, and told me that a fix is targeted for release on the 24th of August. :)
Hello. Were there any updates to this - links to the bug fix release notes for example?
I believe this is the link to the bug fix: https://world.episerver.com/documentation/Release-Notes/ReleaseNote/?releaseNoteId=MAR-1096.
It was released on July 24, 2017.
Thank you for great investigation @Vegard Helland. Pretty late to the party but did you have chance to test with a more recent version to see how much things were improved?
@Quan Mai: It's been a while since I tested this, but we now have the addon running succesfully on the site that we had issues with earlier. There's still a bit of a performance hit when running active AB-tests, but nothing close to as bad as it was earlier when it actually made the server unresponsive when running tests on a high load page.
Hi,
We are currently investigating some performance issues for a client, and it seems like the issues only appears once one or more A/B tests are running on the site.
When we set up A/B tests we get a lot of the following exceptions in the log files:
When checking the performance issues in detail, we have also a few database queries that use up to 10-11 seconds to complete when there's heavy load on the site. These queries are queries that involves tblABTest, tblABVariant, tblABKeyValueResult, tblKeyConversionResult, tblABKeyFinancialResult and tblABKeyPerformanceIndicator tables.
In sum this leads me to believe that there are some performance challenges with the EPiServer A/B testing module.
Has anyone else seen this?