Sitecore.Boost Update Released

Following on from my first introduction to Sitecore.Boost post, I have made some further improvements.

Before delving into the results of the announcement, Sitecore.Boost patches will also work for Sitecore pre 8.1😉

You can find the project here: https://github.com/cardinal252/Sitecore.Boost

The results

A small update has been released for Sitecore.Boost. This update results in the following:

  • An approximate 61% improvement in rendering performance over Sitecore 8.1 OOTB
  • An approximate 84% improvement in rendering performance over Sitecore 8.2 OOTB

Using all boost patches on both 8.1 and 8.2, this results in Sitecore 8.1 being 67% faster than Sitecore 8.2. Sitecore 8.1 is still slower than its predecessors, so the trend continues – at least this takes it some of the way back😀

Happy boosting😉😀

Introducing Sitecore.Boost

For a while now, I have been (not so) quietly working away on performance testing on various codebases as well as Sitecore itself for varying clients and my own satisfaction.

You can find it here: https://github.com/cardinal252/Sitecore.Boost

What is it?

With the concepts behind some of this work, I decided to create an open source project to allow others to see what has been done and contribute their production tested performance patches for the Sitecore platform.

This project contains a test harness setup complete with jMeter tests & serialized content.

The test content when deployed renders ‘Hello World’ renderings varying by the following:

  • Number of renderings – 10 to 25
  • Output Caching – Cached on Item, Cached on Standard Values, Cached on Rendering Definition, Uncached
  • Rendering type – Controller / View Renderings
  • Model – With / without

By putting the Sitecore rendering engine under load and performing profiles (using your tool of choice), many areas of Sitecore have shown consistent traits that can benefit from optimisation to their code.

Continue reading

CI / CD Build Tooling for Sitecore

Being a sell sword, I can comment on a lot of different stacks (along with providing my preferred). Following on from a discussion Sitecore Community – CI / CD I thought I would share my thoughts a little on this subject:

Fundamentally most Continuous Integration / Delivery environments involve the following elements (in a very rough ordering): Source Control > Build Tool > Automated Testing Tools > Code Metrics Tool(s) > Deployment Tool(s) > Sitecore Content Deployment Tools > Environment Scaffolding > Monitoring

Before I go any further, I think I should state what I believe to be the MOST important goals of your CI build environment.

  • The simplest to manage / manipulate. The tooling should get out of you way and soak close to zero time.
  • Should be maintainable by the majority of the development team, not ‘key holders’.
  • Deployments should be done by non-developers.
  • It just works – once set up, you shouldn’t have to tinker with it.

My biggest bug bear of any system is where only the Solution Architects / Team Leads can manage the build process. QA’s testers / product owners should be responsible for sending stuff to QA / Production (if there is to be ANY human involvement at all).

So hear it is split down by element:

Continue reading

Glass Mapper 4.2: The most flexible Sitecore ORM just got more flexible

Over the last couple of months, within the Glass Mapper team we have been busy considering a few things regarding the framework and decided this upcoming release of Glass Mapper should aim to improve on the flexibility of certain areas of the product as well as the ability for developers to get involved with our source more easily. Here is a run down of the key features of this new release and what it means.

Continue reading

Advanced Content Security Module (ACS) Released

A while ago I started the process to soft release a little module I have been working on. It is called the ‘Advanced Content Security’ module (ACS). It’s primary purposes are the following:

  • To provide alternative layouts to pages that are ‘restricted’ but not unreadable by users – think the average newspaper site that allows you 10 views before you have to sign up.
  • To provide rules based read and restriction security
  • To provide a rules engine based solution to the initialisation of users

Today, the latest version was approved and added to the market place.

For a more detailed overview, you can find more information about it here:

https://cardinalcore.co.uk/advanced-content-security-module/

The source code resides here:
https://github.com/cardinal252/Sitecore.AdvancedContentSecurity/

The module itself can be downloaded here
https://marketplace.sitecore.net/Modules/A/Advanced_Content_Security.aspx?sc_lang=en

Life Through a Lens – Extending and Modifying Glass Rendering Output

Have been asked a couple of times lately about ways to extend Glass Mapper given that in many cases it does not call the renderField pipeline. Glass Mapper is a mature and extensible API, so it in itself is not so tricky to customise.

Below are a couple of example snippets on how you can modify / extend rendering of html (note – this code compiles, I have not run it in a production solution).

Continue reading

Quick creation of a Sitecore Item to pass in unit tests

This is a super quick post.

In quite a number of test scenarios I would choose to abstract the ‘doing’ something with a Sitecore item to a repository class that could only be integration tested. This would mean that for that test scenario, generally the only necessity is to ensure that the item is not null, then rely on the repository to do the real work for me.

I recently came up with this method of creating a dummy item to enable unit testing of a method that takes an item as a parameter. Note – this is no substitute for FakeDb – but in the majority of scenarios – for real unit testing, I would be using Glass Mapper anyway.

Here is a simple method to create a test item without any app.config or anything.

Continue reading

Life Through a Lens – Using the Sitecore ContentDatabase in Glass Mapper

This post should hopefully be a short one. Just to note that in the since v4.0.3 of Glass Mapper we have added a SitecoreContentContext. This class inherits from ISitecoreContext just as the regular SitecoreContext does.

This differs from the standard SitecoreContext in that it uses Sitecore.Context.ContentDatabase instead of Sitecore.Context.Database.


ISitecoreContext sitecoreContext = new SitecoreContentContext();

Happy Mapping!!

The constructor ‘work done’ dilemma

In a recent Glass release I was working on an issue that led to Mike making a comment on how I work as a programmer. The particular issue in question was actually quite straight forward to solve – I wrote unit tests that showed the issue, wrote some sandbox tests that showed how code behaved in the underlying Sitecore library, then fixed the tests approriately. All typical of TDD. The normal thing for me though is then to write a unit test that performs this simple fix 1,000,000 times emitting the result of stopwatch timings at various points. Mike jokingly commented at the time that this was ‘typical Nat’ which, to be fair, he was right on.

In this post I will look at the effect on work done in the constructor and how it has affects your development life in the context of modern DI practice – in particular – the DI principle.

Continue reading

Life Through a Lens – Lesser known Glass Mapper features

Mapping types

[SitecoreNode] / Node() – This mapping type allows you to map to another item in Sitecore directly by the string representation of id as a guid or by its path. You would typically map this to another Glass mapped type.
[SitecoreLinked] / Linked() – This mapping type allows you to map to an IEnumerable for items that are linked to the mapped item (think navigate > links in the standard Sitecore ribbon). This (using the configuration options) can be referrers / referred to items.
[Ignore] / Ignore() – this can definitely be handy for example when injecting content from external sources into your models from controller code.

Supported types
Whilst not mapping types, Glass can indeed map to types that are not quite so commonly used.
RuleList – if you map to a rulelist (technically a [SitecoreField] mapping) then you can actually get out a usable set of conditions for use in the Sitecore rules api.
Nullable Mapping – Glass Mapper has long supported mapping to nullable .net types (e.g. int? or Nullable), this includes the majority of regular mappings with HasValue generally referring to whether the Sitecore field was empty or not.

Typed Edit Frames
“Because I am lazy” is the best and most useful introduction to a feature I have seen in a while – brought to to from this V4 Demo at around 26min 15secs. The whole video is well worth a watch, but it shows them in use. Typed edit frames though are a feature to allow the creation of edit frames based upon Glass models.

Mapping to / from external data

One of the great advantages of Glass models being detached from Sitecore (unlike most wrapping based solutions) is the ability to map data from external third party solutions. In the Glass Mapper tutorials, there is a great example of mapping Glass Mapper objects using external data.

Data transfer between environments

Another great advantage of Glass models being detached from the Sitecore item is that, using a Glass model, you can breach the master / web boundary or even environment boundary. So, for example, it would be perfectly easy to write a web service (maybe for transferring data from web to master for the purpose of saving user submitted FAQ’s for example), that would construct a Glass model on the web node, post it to the master node and save it using regular Glass code.

Model Caching
Model caching was primarily designed to allow the caching of models that are used in locations that cannot use regular Sitecore caching. This could be for example, a rendering that contains a form and would thus need to respond to postbacks etc.

Configuration Maps
Configuratioin maps are a wrapper for regular Glass fluent configuration that allows better separation from the models, it was covered in further detail in V4 – Configuration Maps

VersionCountDisabler
The version count disabler is a simple structure that allows Glass to behave a little more like the standard Sitecore API, in use it is really this simple

using(new VersionCountDisabler)
{
   var whatever = sitecoreContext.GetItem<IWhatever>(); // this code will get the item even if the version count is 0
}

More information on version count disabling can be found at Glass.lu – VersionCountDisabler

Typed Glass Controllers
A relatively recent addition to Glass Mapper has been the addition of a typed GlassController, this was described further in Unit Testing with GlassController

Further Reading / Watching

Glass Mapper V4 release post
Glass Mapper V4 release video