Developing nopCommerce we always pay attention to high performance rate for future sites on our platform. By today nopCommerce powers large stores that work extremely good, and our own store demo gets 100/100 at Google PageSpeed.
To gain the same result for your store you need to make sure that all the settings were made in a proper way. In this performance guide, we will show you how. Below you will find the set of practices with proven efficiency that our team formed in the last few years.
In brief, working on performance improvement consists of several aspects: proper nopCommerce settings, checking the customization that was done, choosing the right hosting and some other moments. Let’s consider them in turn.
Here are the settings at nopCommerce platform itself that have a big impact on sites’ performance.
1. Performance setting
Go to admin area > Configuration > Settings > Catalog setting and check the following settings in the “Performance” panel. It’s highly recommended to tick them. But please read its description (hints) first. In some cases, it’s not possible to enable them because it will switch off some functionality.
- Ignore ACL rules
- Ignore "limit per store" rules
- Ignore discounts
- Ignore featured products
- Cache product prices
2. Bundling and minification
- HTML minification (allows to minify and compress HTML pages to increase the download speed).
- CSS bundling and minification (similarly, allows to combine several CSS files into one file; do not enable this setting if you’re running nopCommerce in IIS virtual directory).
- Use response compression (it will replace the default gzip).
3. Localization settings
Go to admin area > Configuration > Settings > General settings and see “Localization settings” panel. It has several really important checkboxes. When they are enabled, the application start will be slower, but then all pages could be opened much faster:
- Load all locale resources on startup.
- Load all localized properties on startup (for the cases when you have two or more languages enabled. This requires more memory, and not recommended when you have a large catalog or several thousand entities).
- Load all search engine friendly names on startup (also requires more memory and not recommended to enable with large catalogs or several thousand entities, because it may slow down running your site).
nopCommerce has “Maintenance” page in admin area with quite useful functionality (System > Maintenance). Run it periodically to delete obsolete information from the database and the file system:
- Deleting guest customers (choose the period for deleting old records regarding guest customers out of the database).
- Deleting abandoned shopping carts (delete abandoned shopping carts created before a certain period of time).
- Deleting old exported files (choose the desired period to keep the file system up to date).
- Re-index database tables (it modifies existing tables by removing the indexes of goods that no longer available).
5. Other settings
- Always use the latest version of nopCommerce. If you cannot upgrade to the latest version for some reasons, then manually apply all performance changes that nopCommerce team implemented since the release date.
- Fix all warnings in admin area > System > Warnings.
- If it doesn’t help, then temporarily delete all third-party plugins. Just to test it out and compare performance. Sometimes third-party developers release plugins that do not work properly.
- Set "WWW prefix requirement" to the "Pages should have WWW prefix"; this will reduce the overhead of redirects on the website. You can do it in Configuration > Settings > General settings.
- For the versions of nopCommerce before 4.10, it is recommended to store the images at the file system. Go to Configuration > Settings > Media settings and choose this option at the top of the page.
- Check if you have unused entities in the settings. First of all, you should pay attention to entities such as currencies, languages, stores. You have to remove all unnecessary items because each of them can slow down your store.
- Also, delete all unused plugins and themes.
- Ensure that the following schedule tasks are enabled - “Clear log”, “Delete guests”, “Clear cache”, “Keep alive”.
- Disable “Store last visited page” and “Store IP addresses” settings in Configuration > Settings > Customer settings.
- Always monitor your log (System > Log) and ensure that you don’t have any errors.
In case of customization and extending the default nopCommerce functionality, you need to ensure that the changes you have made do not affect performance. According to our practice, quite often you can find the code that was written non-optimal.
This section will be useful for developers mostly.
- First of all, you need to analyze all the changes that were made. We at nopCommerce always start from finding them out with WinMerge. We analyze the changes and then improve the code if possible.
- Based on our experience, the most common mistakes of third-party developers are connected to work with databases. E.g. some SQL request is too slow or executed too frequently. In this case, it is recommended to identify such problems and then make caching in nopCommerce itself (check out ICacheManager interface).
- Also, nopCommerce has in-built profiler that might help to find out which request exactly causes slow down. You can activate it in All settings (advanced) > storeinformationsettings.displayminiprofilerinpublicstore
Besides that, a lot of reliable and ready-to-use practices of performance improvement were already written. We recommend to start from the following ones and read them in details:
- ASP.NET Core Performance Best Practices by the team of ASP.NET developers;
- Performance Diagnostic Tools;
- Monitoring SQL Performance. There are a lot of guides about it, and this is very important.
- We’d recommend to read about performance tuning in SQL Server - for example, from here.
- Perform load testing is also important to ensure there are no critical issues in code that slow pages downloading. For testing Microsoft services you can use in-built tools - know more about it from here. Also, for your work you can use one of free load testing services, like https://loader.io/.
In this section, several aspects are described, that are not related to nopCommerce directly but also very important:
- Configure and use a content delivery network (CDN). The geographically distributed network of proxy servers and data centers will provide quick pages loading for users in different countries.
- Use HTTP/2. This version of network protocol decreases latency to improve page load speed in web browsers.
- Use content optimization tools to make sure that the site is loading fast no matter what type of device the user is surfing from.
- Optimize cache header so to the browsers correctly cache the resources of a site to minimize the need for new requests.
To automatically set up all of these tools you can use one of the cloud network platforms. The choice is up to you, of course; our recommendation is Cloudflare - it is one of the world’s largest cloud platform trusted by IBM, Reuters, and Digital Ocean. Many of such services also provide website protection against DDoS and other attacks - at least, Cloudflare does.
Other several important recommendations:
- Make sure that all the software at your server (Windows, MS SQL Server, etc) is updated to the latest versions and has all the latest security patches;
- Set up nopCommerce and the database at the same server (MS SQL Server) if possible - it would increase performance due to more quickly SQL queries processing.
- Make backups regularly.
Hosting and your server
The wrong chosen hosting or tariff plan can negate all the previous efforts to increase the performance. To be sure it will not happen to your store, you can use the hosting from our recommended list.
Here are the most important criteria when choosing the hosting:
- Support for needed technologies and scripts
- 24/7 server and technical support
- Uptime (look for a company that provides 99,9% uptime)
- Regular backups
- Protection against DDoS attacks
- Ability to move up from shared to semi-dedicated, or dedicated servers easily as your business grows
Also, when choosing the hosting or the server, it is extremely important to make sure that you have a good HDD (preferably SATA) and enough RAM.
After implementing these instructions, your store should start to work much faster. Nevertheless, if it does not happen for some reason, you may order the audit of your site as the part of our premium support services, or search for the solving of the problem at our forum.
If you have something to complete this guide with, please write it in comments.