Xperience 13 .Net Core - Speed, Baseline, Tools
It's been six months since I've last published an article, but I can assure you, it hasn't been spent doing nothing. Kentico has released it's Xperience 13, and with it compatibility for .Net Core (3.1 default, .Net 5.0 with hotfix 13.0.5). Now .Net 4.8 is still supported in 13, but there is no reason to not build in .Net Core (unless you're upgrading from K12 MVC). In this article, we're going to take a look at why.
Built for Speed
Moving into MVC from portal engine brought about some series performance increases. The bloat of portal engine gone, rendering pages got a lot faster. With Output caching, you got responses sub-50ms in many cases once cached. We had some sites even get the legendary 100 for Lighthouse's site performance, which is amazing!
But that's nothing compared to .Net Core. I ran some tests with two identical sites, one in Xperience 12 MVC .Net 4.6.1, the other with .Net Core 5.0. Here's the results:
Task |
KX 12 MVC |
KX 13 Core |
Rebuild Project |
8.4sec, 7.2sec |
6.8sec, 5.4 sec |
Build after minor change |
about 1.5 sec |
about 1.5 sec |
Load Home page from fresh rebuild |
14.4 sec |
3.13 sec |
Navigate to About page |
3.28 sec |
.097 sec |
Navigate to Side Nave Example page |
3.06 sec |
.037 sec |
Navigate back to About page |
0.014 sec* |
0.017 sec |
* This was now fully output cached, which is why it was so fast
It also should be noted, that while we have data caching enabled on both sites, there was NO rendering cache enabled on KX 13 core. Kentico is still working on integrating the .net core Cache TagHelper into their system, with that we'll see the speeds get even faster!
Part of this is probably to do with the heavy asynchronous integration with .Net Core. Almost every aspect is designed to allow you to leverage asynchronous programming. I've updated a lot of my tools to also use Async now as well.
Wait, How did you Test This?
Glad you asked, or at least I asked on your behalf (come on, you know you were wondering). After spending about 70 hours upgrading all of my tools to KX 13, and then another 30 hours converting the existing K12 Baseline, I have finished the KX 13 Core Baseline project! The same KX12 Baseline project that you loved is now upgraded, and ready for you to use (as long as you hotfix to 13.0.5).
Check out the Heartland Business Systems Github, although the Baseline will probably not get up until the week of December 28th as I need the authentication code from our general mailbox to log in and set up the repository (sad day indeed).
What I Love about .Net Core
Dependency Injection EVERYWHERE
One awesome feature of .Net Core is that Dependency Injection is baked in. Once you register your implementations, Controllers, View Components, really anything has access to inject the interfaces. Even views have dependency injection! (Say goodby to HTML extension methods and static functions!)
.Net Core has TagHelpers
, which allow you to call custom logic and modify context by just typing specially formatted html tags. I've already updated many of my tools to use this (more on that later). This has made development in views much cleaner, and a lot fewer @ symbols.
View Components
Where in .Net 4.8 you had RenderActions
, now you have View Components
. These are like webparts in the old days, you can configure your properties, render out your content very easily. Kentico Widgets / Page Templates also tend to leverage these.
Cheaper Hosting
.Net Core can be hosted on Linux, so for Azure it's going to spell some savings $$ wise (i may actually finally upgrade this blog site from Kentico 9 to KX 13....maybe...)
What I *Don't* Love about .Net Core
I will say, that upgrading all my tools, learning .net Core, and running into many headaches did give me some battle scars. And for .net Core, what I don't like is the Middleware Pipeline. Basically there is a pipeline (chain of events) that each request runs along. If you don't have things in the right order, it can spell disaster. I spent hours trying to get something to work, only to find out I had accidently put one service in the wrong spot. Luckily in the baseline, that's all configured for you now, so you don't have to suffer!
What I love about KX 13
For KX 12, I (sadly) had to write the book on Dynamic Routing. I did so for you, the community, so you could use KX 12 properly. I also did so with Kentico understanding what I did so they could implement it in KX 13. They did a great job of it, and I'm glad I don't need to maintain that nightmare project.
Page Type Features
Kentico has launched Page Type Features, bringing things like "Navigation" and "Meta Data" back that we used to use and love from Portal engine days. They are also looking at how it can be customized and expanded. This has been awesome to have these features in, and potentially a new way of implementing across-page type features.
More Interfaces
KX 13 comes with a slew of very useful interface classes that we had to build ourselves back in KX12. It's nice to not have to do so much heavy lifting. I or one of the other MVPs will probably make an article listing all of these.
Yes finally the Froala editor is baked into the platform as one of the default widgets, along with a Form Builder version of it. They added the Url Selector, which was sorely needed. Now you can select from Pages, Media Libraries, or just a hand-entered url. This was a huge pain the in butt for KX 12. Lastly in your widget configurations, you can now toggle visibility, which helps make more 'dynamic' widgets with the properties.
What I *Don't* Love about KX 13
There aren't a lot of things on the list...
Page Template selection is still not there fully. If there are page templates available, you MUST select one. And unlike Dynamic Routing which had a 'Fake' page template that allowed you to use normal routing, there isn't one of these yet. I had to set the page template field to null in the database to erase the existing page templates. I have an email in to see if we can't fix this.
Meta Data doesn't currently contain an image, which makes it hard to build social media share meta-tags without. Hopefully this too will be fixed soon.
You Mentioned Tools....
Yes, 70 hours later, my vast array of tools are now updated (pretty much all of them). I did want to highlight the status and improvements.
Kentico Authorization Attribute: Updated, no new features/functionality.
Relationships Extended: Updated, no new features on the admin side, however the MVC Side has a lot of improvements. I've added Query Extensions both on Object and Document Queries to be able to either grab child items of a parent object, or to filter parents by child items. This covers many scenarios, and makes grabbing related pages or objects easy!
Automatic Generated User Roles: Updated, no new features/functionality.
Partial Widget Page: Updated, massive overhaul. Thanks to Kentico opening up a class that was previously hidden, the Partial Widget Pages no longer need to do server side web requests to render other widget page's. The widget was updated in such a way that it shouldn't brake existing usage, and helper methods / tag helpers were added to easily switch the Page Builder Context so you can render out other pages/widget zones easily. The Baseline uses this for it's Header/Footer rendering, for a Tab system, and also a Shareable Content widget.
Bootstrap Layout: Updated, no new features/functionality.
Page Builder Containers: Updated, new Tag Helper added for .net core so you can easily wrap and configure anything in Page Builder Containers, not just widgets!
MVC Caching: Updated, new new features/functionality. It should be noted that for .net Core, how the MVC Caching system worked was not doable with the default dependency injection that .net core provides, so this tool does require AutoFac / Castle Windsor. If you wish to do things without that, fellow MVP and .net core Guru Sean G. Wright has some great design patterns on his blog to centralize queries and handle caching there.
I still have to update the following: Kentico URL Redirection Module and CSV Import Module.
The Future?
To be honest, you may not see many blog articles being written from me going forward. Instead, please check out Kentico Xperience's YouTube channel, where you can see my lovely face as I work with Kentico to make video tutorials and guides.
Also subscribe to my GitHub for updates, I'm always fixing bugs, adding new stuff, and you can keep up to date on new tools as they come out.
That's all, after pumping 100 hours worth of updating, upgrading, building, and the likes, i'm going on vacation for some much needed rest and relaxation!