Skip to main content

Performance Improvement in Hybris eCommerce

Below points will specially help grocery based projects where adding 50-60 products per cart is a common trend and where complex promotions are used using drools engine.

  1. Add/Update to cart  à In OOB Hybris whenever any new product is added to cart or quantity of existing product is updated in cart (from PLP, PDP, Search page etc) then calculateCart() method is called in order to calculate total price of the cart. This call can be prevented (to increase performance) in case the business requirement is to just show notification of add to cart without total price in minicart.

  1. View Cart à In case 50-60 products are added in cart and approx. 30% of the products have promotions applied then OOB Hybris view cart can take between 10-15 seconds to load (based on complexity of promotion). In order to avoid custom waiting 10-15 sec to see view cart this operation of can be split into below 3 steps so that every 3-4 seconds rendering of data starts and customer can see cart page data in parts.

    1. Step 1 : On click of minicart cart directly redirect (i.e. no wait of 15 sec) customer to cart page with just header, footer and loading(animation) icon in main content area with message that your cart is getting prepared.
    2. Step 2 : After step 1, trigger Ajax call to load list of cart entries including product name, image, quantity & price but without any promotion call as promotion messages ( potential or fired will not be shown at this instance). Also OOB recalculate() cart method is not called at this instance because we will not show total price, discount etc information at this stage.
    3. Step 3 : After step 2, trigger one more Ajax call to fetch list of promotions messaged per cart entry and also execute recalculate() cart to show total , subtotal & discount price.

  1. Caching Cart page promo messages : When potential promotion messages are shown per cart entry level then view cart can take significant time to load specially when promotions are complex and cart has 50-60 products added. In this case its recommended to cache potential promotion messages by creating dedicated EhCache and customization will be required to cache message per promotion id. (based on requirement).

  1. Promotion : As drools engine maintains multiple version of promotions, the entries in “promotion” and “droolsengine” increases exponentially so these tables should be cleaned regularly. Also custom promotion archival job should be created to archive (and undeploy) all versions of promotions rules that have end data in past.

  1. PLP /Search : Below recommendation are valid for both category & search page:

    1. In Product listing/Search page products are returned from solr and for each product several database calls are executed to fetch potential promotion messages, this can reduce the response time. Hence its always recommended to Index the Promotion messages in Solr to avoid all the database calls in the Category page (Product list page)/Search page. (Note : This might increasing solr indexing overall time).

    1. Implement Infinite Scroll approach for Category and Search pages: This approach consists in kind of pagination Solr calls triggered when user reaches end of page.

  1. Integrate SAP Page Caching AddOn: The Page Cache Solution Add-On is a set of extensions that enables the caching of HTML pages by adding a page cache container into the uppermost layer of the platform architecture to maximise performance. HTML pages won't be dynamically built, but instead will just be taken from the page cache container, meaning response times and CPU activity will decrease.

  1. Create explicit Entity Cache for PriceRows & AbstractRuleEngineRules : It is always advisable to create dedicated entity cache for item types that holds major space of the cache.

  1. HANA: Enable Prepared Statement caching :  The HANA JDBC Driver allows caching Prepared Statements. It is supported since driver version 2.3.4. This feature is disabled by default. Indexing time will also be improved with this change.

  1. Frontend optimization : Use free tool like GTmetrix to analyzes webpage page's speed performance. Tools like this uses PageSpeed and YSlow to generates scores of the pages and offers solutions to make site faster by offering suggestion like minification, gzip compression, media caching etc.

  1. Dynatrace : This tool helps a lot in identifying the bottlenecks of various pages/functionalities and with CCV2, Dynatrace is available externally (starting April 2019). This certainly opens doors to explore & optimize performance further.

Comments

Popular posts from this blog

How does Disney Hotstar capture 5 Billion Emojis during a tournament?

  Here is my understanding of how the system works. 1. Clients send emojis through standard HTTP requests. You can think of Golang Service as a typical Web Server. Golang is chosen because it supports concurrency well. Threads in GoLang are lightweight.  2. Since the write volume is very high, Kafka (message queue) is used as a buffer. 3. Emoji data are aggregated by a streaming processing service called Spark. It aggregates data every 2 seconds, which is configurable. There is a trade-off to be made based on the interval. A shorter interval means emojis are delivered to other clients faster but it also means more computing resources are needed. 4. Aggregated data is written to another Kafka.  5. The PubSub consumers pull aggregated emoji data from Kafka.  6. Emojis are delivered to other clients in real-time through the PubSub infrastructure.  The PubSub infrastructure is interesting. Hotstar considered the following protocols: Socketio, NATS, MQTT, and gRPC, a...

Use of PartOf in Hybris

Definition PartOf modifier is used to define the aggregation relationship between Parent and Child objects. To explain it better I would say PartOf is used to defining cascade delete.  When we delete a Parent object then all its child objects(partOf) will be deleted automatically. Why or When to use PartOf? PartOf may make sense when the relationship involves "is part of" description. For example, an OrderEntry record(AbstractOrderEntry) is part of its parent Order(AbstractOrder), and older entries will never be shared between multiple orders. If the Order were to vanish, the OrderEntry should as well, and an order entry without an Order would be a problem. How to use PartOf? Looking into the following items.xml snippet we can able to understand the importance of PartOf This also can be defined at the attribute level. Like <itemtype code="User" extends="Principal" jaloclass="de.hybris.platform.jalo...

World of Drool Engine

  Rule Engine Within mission-critical applications, the process of maintaining business logic within the source code can become too complicated. Business rules can be used to ease the development and maintenance by separating business logic from the source code. In the Java world, most of the rules engines libraries implement JSR94 standard known as  Java Rule API Engine .     The following table highlights the top five major Rule Engine based technologies: Popularity Rule Engine Summary 1 Drools A Business Rules Management System (BRMS) solution which provides a core business rules engine (BRE), a web authoring and rules management application (Drools Workbench) and an Eclipse IDE plugin for core development 2 OpenRules A general-purpose business rules and decision management system 3 EasyRules EasyRules pro...