Performance optimizations in nopCommerce 3.3

Performance optimizations in nopCommerce 3.3

Following our previous blog post on what's new in nopCommerce 3.3, I would like to point your attention to a few performance optimizations in the new version. I would also discuss a couple of optimizations from previous versions of nopCommerce, which you might not be aware of.

Please note that in the following 3 points I will discuss 5 settings, which can be set from the administration of your nopCommerce store and are extremely important to its performance.

1. In nopCommerce 3.3 now there is a new "Ignore ACL rules" setting.

NopCommerce does have a powerful ACL (Access control lists) system, which grants permissions to customer roles to certain parts of both the administrative and public website. You can configure the ACL by going to the nopCommerce administration -> Configuration -> Access Control List. Since version 2.7 the nopCommerce team have been gradually adding ACL permissions for the major entities (Products, Categories, Manufacturers). For example if you edit a product in nopCommerce you would find an "Access control list" tab where you can set who can browse and edit the product:

nopCommerce Product ACL

While this is a powerful tool for the store owner it means that every product needs to be checked against the current customer roles. Both in the administration and the public site there are several product, category and manufacturer list pages. So for example if you are browsing the category page on the public site the whole product list will go through the ACL check. Let's take another example. Our JCarousel plugin, which can be configured to show products (related, cross sell, new, custom list, etc...) in a carousel on different public pages. All products in the carousel need to go through ACL checks too. All this ACL overhead is true for categories and manufacturers too.

But often store owners would not need ACL permissions on any of their products, categories or manufacturers. Still the checks will be performed creating additional work for the system and thus adding to the response time of the website.

Until version 3.3. Now if you set the new "Ignore ACL Setting" the ACL checks will be bypassed.

Our tests showed that on a category page with just 8 products, on a cleared system cache, this setting reduced the response time of the server by almost 50%.

2. In nopCommerce 3.3 there is a new "Ignore limit per store rules" setting.

Similar to the ACL permissions, when you have a multi-store nopCommerce, you can set the visibility of products, categories and manufacturers per store:

nopCommerce store configuration per product

Just like with ACL, every product, category or manufacturer will be checked against the current store. But what if you do not have multiple stores but just one store. The checks will still occur.

Until version 3.3. Now if you set the new "Ignore limit per store rules" the store checks will be bypassed.

Our tests showed that on a category page with just 8 products, on a cleared system cache, this was reducing the response time of the server by almost 25%.

So combine this with the 50% improvement from bypassing the ACL checks and you get an enormous performance boost in your nopCommerce. To make use of this you need to go to the nopCommerce administration -> Settings -> Catalog Settings and enable the two settings:

nopCommerce ignore ACL and store rules

 

3. Although we are on the subject of nopCommerce 3.3, I would like to show you three very important settings, which were introduced in nopCommerce 3.2 and which will again reduce your server response time enormously.

If you go to the nopCommerce administration -> General and Miscellaneous Settings -> Localization settings you would notice the following three settings:

nopCommerce localization settings for performance improvement

Locale resources refer to all strings in nopCommerce, which are not properties of the shop entities. For example such strings are the "Information", "Customer Service", etc. titles in the footer. So if you are browsing a product page, the system would need to load both the product information and the locale resources as the footer is present on every page in the public website.

Localized properties refer to all properties of an entity (product, category, manufacturer, etc...), which could be localized for different languages. For example such properties are the product name, short description, full description and SEO information. These are stored in a separate table (different from the main entities tables) in the database.

Search engine friendly names refer to the URL slugs (parts), which map to an entity in the shop. For example if your Laptop category has Id 1 in the database and has the following URL in your shop http://www.myshop.com/laptops, the "laptops" part of the URL is what tells the system that it needs to load the category with Id 1. This is possible because there is a separate table and entry in the database, which maps the "laptops" slug/search engine friendly name to the category with Id 1.

What is common in these three cases is that there is information which needs to be fetched with every request but is stored separately from the main request data in the database. For example if you are browsing a category page, nopCommerce would query the database once for the category search engine friendly name, once for the category information, once for the the category localized properties and once for every locale resource. In addition, to build the main menu of the website as well as the category navigation panel, nopCommerce would have to query the database for each an every category search engined friendly name and category localized name. Product or manufacturer links and names present on the current page would result in the same type of requests.

As you can see, before the page data has been cached by nopCommerce, the number of requests to the database for just a single page, becomes enormous.

To avoid this you need to set the three settings. Our tests showed that on a category page with 20 products, on a cleared system cache, setting the:

  • "Load all locale resources on startup" reduced the response time by more than 15%.
  • "Load all localized properties on startup" reduced the response time by more than 30%.
  • "" reduced the response time by more than 18%.

Combine this improvement with the gain from the Ignore ACL and store limitations settings and you do get a much better response time from your nopCommerce.

4. In nopCommerce 3.3 there are a few performance optimizations which might not be so obvious to the store owner but are still important and worth mentioning:

  • When you have thousands of categories the admin area could become very slow as hundreds of database requests were being made. Now there is just one request.
  • The category pages now load all specification attributes with just one request and not with one request for every attribute.
  • Checkout attributes are not being loaded for each HTTP request anymore as it is not necessary. This was being done to render the mini-shopping cart block resulting in additional load time for every single page, as the mini-shopping cart is present in the header of the website, thus on every page.
  • Customer language and currency are being cached between requests and not loaded every time.

5. In nopCommerce 3.3 there is a new Clear Log scheduled tasks, which would reduce the size of your database significantly and keep it from bloating unnecessary.

nopCommerce clear log scheduled task

You do need to set an interval on this task, which would allow you enough time to investigate any possible errors or activities that might occur on the website.

6. In nopCommerce 3.3 when you go to System -> Message Queue, there is a new function Delete All, which will delete all queued emails and will again reduce significantly the size of your database.

nopCommerce delete all emails


Emails that are being sent from the system are kept in a separate table in the database. So you end up having them both in your email account Sent folder and your nopCommerce database. Deleting them from your database is perfectly alright. Before you do this do make sure to go through the emails that are marked as not sent or in other words have failed.

This concludes our review of nopCommerce 3.3. I hope that learning about all the performance tips and tricks will prove at least as useful to you as it has to us and our work. Do also checkout our previous blog post on the nopCommerce 3.3.

As usual your comments are more than welcomed!

Next we will follow with more details on our new nopCommerce 3.3 plugins and functionality. So stay tuned as we continue to cover the best .NET e-commerce system!