May 19, 2020
Estimated Post Reading Time ~

How Load Balancing & Caching Delivers Content to Your Customers Faster

Nothing is worse than trying to pull up a site and it just doesn’t load. We’ve all had that spinning wheel just keep spinning and spinning, and it seems like the page will never load completely. The speed of your site can be crucial to your business, especially when you are requiring the user to enter information or purchase a product.

A slow site not only frustrates users but can hurt the credibility of your business. After all, if your site can’t load, what makes the user think they would trust you with their money or delivering a product to them.

There are many ways you can speed up your site, from optimizing the code, asynchronously loading content, optimizing images, caching content, etc. Perhaps the approach that has the most impact is caching content that is requested frequently. One of Adobe Experience Manager’s (AEM) most important features is the dispatcher, which is its caching and load balancing tool.

Load Balancing
Let’s first discuss exactly what load balancing is. Consider a scenario when there is a flood of requests coming in for a page on your website. Load balancing evenly distributes the requests across the network so that no single server or device is overwhelmed. AEM’s dispatcher works in a similar way and spreads the requests across multiple AEM instances. This ensures that each instance has fewer requests to process and in-turn improves the response time. Now the question is, how does the dispatcher decide which AEM instance to talk to? The dispatcher keeps internal statistics about how fast each AEM instance processes documents. Based on the scores, the dispatcher estimates which instance will provide the quickest response time when responding to a request and reserves the necessary computation time on that instance.

Cache
Caching content is another important part of speeding up the load time of your site. Think of the cache as a storage compartment for your documents. But why is this so important and why do we need it? We already have our documents stored in the JCR or a database, right? The location and the strategy for storing documents in the cache makes it fast and efficient. The cache sits inside the dispatcher and is optimized to serve documents that are requested frequently. When the document is requested for the very first time it is retrieved from the content repository and served to the user, as well as stored in the cache. When subsequent requests for the same page come in, the page is served faster since the resource doesn’t need to be pulled out of the large content repository due to it being available in the cache.Thus, the dispatcher can be used to cache documents for better performance of your site.

Security
Another important feature of the dispatcher is its security. Adobe Experience Manager (AEM) provides a security checklist explained here that ensures your AEM installation is secure when deployed. We’ll highlight some of the important aspects. One important aspect, and perhaps the most basic, is to make very little information about your system available to the users. You can use /filter property to decide what should be cached by the dispatcher. For example, change the caching rules to limit caching to the expected mime types, such as gif, html, pdf, js, ppt. In addition, the selectors are a very useful utility in AEM. But if not done correctly, the attacker can flood the dispatcher cache. The dispatcher cache treats each combination of selectors like a different page and caches it separately. If there is no limit on what can be cached, then all the selectors will be cached and fill your cache directory. This means that every request will be forwarded to the AEM instance and response time is high.

The dispatcher is another one of the many useful tools in the AEM toolkit. This is particularly beneficial because of how fast you can get load balancing and cache set up. You don’t have to install tons of server software and go through a million different hoops and configuration options to get it tuned and set up properly. Instead, you install it on a supported web server, install the dispatcher module, configure the dispatcher, and configure AEM so that content updates invalidate the cache. It’s important to note that proper setup can help you handle thousands upon thousands of requests and never slow down your site, and you shouldn’t get that dreaded spinning wheel that just keeps spinning and spinning.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.