MongoDB with Redis and Azure CDN in GrandNode
Today, performance is one of the most important metrics you need to evaluate when you are developing online store based on GrandNode. Nowadays, if you want to keep your customers engaged you need to improve your performance and reduce page load times.
When you are running online store, which always interact with database, operations between store and database may become a bottleneck. Unfortunatelly, with MongoDB there is no exceptions. And with huge amount of queries, actions, your server may slow down. Of course, it will happen faster with relational databases, but with non relational it is also possible.
Luckily, with help comes method called caching. With it you can speed this procedure up. In this short article we will show you how to configure Redis caching and Azure CDN to improve performance of your GrandNode shopping cart.
MongoDB what is it?
MongoDB is an open source NoSQL database which we are using in our open source, free e-commerce solution GrandNode. MongoDB is a cross-platform document-oriented database. The data are stored as JSON-style documents, which enables applications to process more natural,making the integration of data in certain types of applications easier and faster, while maintaining the possibility of creating a hierarchy and indexing.
MongoDB offers many benefits, such as:
- Flexible Data Model. Unlike relational databases, NoSQL databases easily store and combine any type of data, both structured and unstructured. You can also dynamically update the schema to evolve with changing requirements and without any interruption or downtime to your application.
- Elastic Scalability. NoSQL databases scale out on low cost, commodity hardware, allowing for almost unlimited growth.
- High Performance. NoSQL databases are built for great performance, measured in terms of both throughput and latency.
To verify the quality and effectiveness it’s worth to mention which companies are using MongoDB in their applications – eBay, Adobe, Facebook, Forbes, Bosch,
Redis – short overview
Redis – Remote Dictionary Server - is an open source (BSD Licensed) in-memory data structure store, used as a database, cache and message broker. Redis was created in 2009 year. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius quries.
Redis is one of the most popular framework used for distributed caching. It was a matter of time when Redis caching will be available in nopCommerce since Redis was available as a service in Azure. To be honest Redis caching makes difference when you have several stores on your Azure. In the case of a single store, it won’t make any visible and noticeable difference.
Azure CDN – what Microsoft says about it?
The Microsoft Azure Content Delivery Network (CDN) offers developers a global solution for delivering high-bandwidth content that is hosted in Azure or any other location. Using the CDN, you can cache publicly available objects loaded from Azure blob storage. Azure CDN helps you to reduce load time of your store content such as images.
Main benefits of using Azure CDN (Content Delivery Network):
- Accelerated performance and availability
- Global reach
- High scalability
- Reliable security
Examples of Azure CDN uses (according to http://docs.microsoft.com):
- delivering static resources for client applications, often from a websites, such us images
- Delivering public static and shared content to devices
- Serving entire websites that consist of only public static content to clients
- Streaming video files to the client
- Generally improving the experience for users, who are located far from the datacenter
- Handling the growing load on applications that support IoT solutions
- Coping with peaks and surges in demand without requiring the application to scale
When you are planning to use CDN you must face with several challenges, such us:
- Versioning and cache-control
- SEO cases
- Content and client security
How to configure it in GrandNode?
This features are recommended to use with web farms, available in GrandNode and nopCommerce from 3.70 version.
In short steps you should to:
- Install and setup Redis.
- When you done installation and configuration in GrandNode enable Redis in web.config file. Find „RedisCaching” config element. Attribute „Enabled” set as „True” then specify „ConnectionString” pointing to your Redis server (configured in the first step).
- Also you need to enable Redis as your distributed session management. Open your web.config file. Find and uncomment „sessionState” element. Specify its’ attributes (host, accessKey, etc.) pointing to your Redis server.
- Ensure that your scheduled tasks are running on one farm node at a time.
If you will have any problem with configuring Redis in GrandNode feel free to leave short note on our community forum https://grandnode.com/boards. Our Team will help you with pleasure.
Leave your comment