Kentico CMS allows developers to create web applications very rapidly by leveraging a tremendous amount of features already present within the software. With these features often comes complex, dynamic data and functionality. Much of this functionality requires frequent hits to the database or 3rd party system to retrieve information. Too much of this functionality can severely impact the performance of a site. To help with this issue I compiled a few ways you can ensure your site is performing optimally and providing the best user experience possible.
1. Use caching
Kentico has put a great deal of development into providing multiple ways to cache your application. These include:
- Site level caching
- Page level caching
- Control level caching
Site level caching
After installation, a Kentico site will be set at 10 minute caching for images and page info and 0 minutes for content. This setting is used throughout the site and provides a good standard for caching for all items. The default settings may work well for some sites, however, individual companies need to decide how often content is changing and then how often they need that content displayed. If you company doesn’t change you site very often, you can increase this caching to 60+ minutes for all three to prevent unnecessary trips to the database as users browse your site. Some companies frequently update content and need the site updated much more often. Regardless of your caching requirements, a good “default” caching setting should be used to ensure all content is cached appropriately in the event page/control level caching is not used.
Page level caching
Page level caching allows developers to cache the contents of a specific page. Many sites have content that changes frequently and other content that is relatively static. Using page level caching may allow you to optimize sections of your site by leveraging caching for non-updated content. This will save unnecessary trips to the database for those pages. Frequently changing pages can be set to a lower caching setting to enable users to receive the most up to data information. Another great feature of Kentico is ability to inherit this cache setting to allow you to quickly configure entire sections at once.
Control (Partial) level caching
In addition to site and page level caching, Kentico offers the ability to cache specific controls. This is one of the most powerful forms of caching, allowing developers to isolate resource-intensive controls and minimize their impact on the rest of the site. I recommend using control-level caching whenever developing data-driven sites with large amounts of content. This setting will take precedence over all other cache settings for a site.
2. Delayed Loading
Kentico development often involves working with a lot of information you are trying to deliver to the user. This information may not always be static, but rather dynamic based on user selection/environmental variables. Caching this type of data is near impossible due to ever-changing variables. Kentico helps these situations by allowing the developer to delay the loading of certain controls. This delayed loading allows the rest of the site to load quickly, then loads the resource-intensive control afterwards, often without the user even realizing it.
A good scenario for this type of caching is a dynamic menu with dynamic sub menu items. This is often achieved via a nested repeater within the main repeater which pulls the data specific to the current item in the main repeater. This is a recipe for a sluggish, unresponsive web application due to the amount of data the site must get. To get around this, you can enable “DelayedLoading” on the nested repeater. This allows the site to load quickly along with the main menu. Meanwhile, the site will build up the sub menu items (repeaters) behind the scenes, ensuring your user gets content quickly and responsively..
3. Good design
Another major cause of poor site performance can be the design and functionality of the site itself. Companies want to deliver information to their users as efficiently as possible, however, sometimes that information is a tremendous amount of data that has to be compiled and computed prior to the getting to the user. That type of functionality requires time and resources to do. If you overload your site/page with too much of this type of functionality, there is very little you can do overcome the performance hits you’ll receive. Try to plan you site logically, understanding the technical limitations of the site/server. Ensure that no one page within you site has too much data-intensive functionality and you will mitigate your performance issues.
4. Good coding
In any type of development there is no substitute for clean, efficient coding practices. The most capable and configured site can be brought to a stand-still by an endless loop or improper allocation of resources. Microsoft .NET development provides many mechanisms for connection pooling, garbage collection, and re-use of functionality to assist developers build solid, efficient applications. Understanding and implementing these are essential to any Kentico site, as well as all .NET development. Make sure your developing with the correct standards in mind to and always comment your code!
Good coding also applies to SQL queries. "SELECT *" is certainly the quickest and easiest way to get data from a table but is also one of the most costly. “SELECT *” requires the database to extract all the data, often containing unnecessary columns and data which slows the response. Limiting queries to only the necessary data will improve the response of the database and the speeds of your queries. For complex queries consider using stored procedures and functions. These are pre-compiled on the server and offer some of the fastest access to your data.
5. Database configuration
The brains behind any data-driven site is a database. All content is contained in it, therefore, it must be very efficient at storing and delivering the data. Without a properly performing database any Kentico site will not provide a good user experience and run very slowly. SQL Server is an enterprise-class database and runs many of the world’s largest web sites. Kentico comes with a number of views and indexes pre-configured to help the performance of a site. Even with those “default” settings, it may be necessary to modify/add your own efficiency improvements to your database. It always pays to have a knowledgeable engineer configure and fine tune your database!
6. Web Server configuration
If the above items are not getting the result you need then it may be time to get a little deeper into the hardware. Web servers are like any other piece of hardware and need to be spec’d according to their function. Kentico sites can use 1+GB of memory (depending on the application) so ensuring the web server has adequate memory and space is essential. It’s also important to know what other functions the web server is performing. Many “low-cost” hosting companies will load hundreds of clients onto a “shared” server which can limit the available resources to your Kentico site.
There are many other ways to improve performance of your site, all of which will be different for every company/project. Be sure to thoroughly test your application under your expected traffic loads to keep your site running as smooth as possible!