How to Optimize & Diagnose Performance when using Tweakwise Personal Merchandising in Magento

Based on performance research conducted by our partner Emico.

Enabling Personal Merchandising (PM) in Tweakwise introduces dynamic, real-time product sorting tailored to individual visitors. Because each visitor sees a personalized sequence, category product lists cannot be fully cached in Varnish.

This step-by-step guide helps developers, system integrators, and merchants prepare their Magento environment (Luma or Hyvä), establish performance baselines, and troubleshoot slowness in production setups.


Step 1: Understand the Performance Baseline

Before enabling Personal Merchandising, understand how page rendering behaves in a clean Magento environment:

  1. Non-cacheable List Fragment:
    The product list block (category.products.list) bypasses Varnish cache (PRODUCT_LIST_TTL = 0) to fetch personalized rankings. Individual product cards remain cached as ESI fragments.
  2. Expected Latency:
    • Warm Cache (Best Case): Adds ~100 ms to 150 ms of extra PHP execution time per category page view.
    • Cold Cache: The initial request after clearing page cache incurs an extra +0.35s to +0.45s overhead.
  3. Storefront Comparison:
    Luma and Hyvä behave almost identically regarding PM overhead (~140 ms vs ~130 ms).
  4. Throughput Impact:
    Because requests hit PHP-FPM for the personalized list, server throughput drops under load (e.g., from ~850–975 req/s down to ~47–50 req/s per node at 10 concurrent users).

Step 2: Account for Tweakwise Instance Size & Catalog Complexity

In benchmark tests using a standard demo instance, the uncached product list execution time broke down into:

  • Tweakwise Navigation API Call: ~53% – 57% (~60–72 ms).
  • Magento Core / Layout Rendering: ~43% – 47% (~53–54 ms).

Important: Larger client instances with extensive product catalogs, complex merchandising rules, or heavy personalization setups will experience higher API processing times than a simple demo instance.

How to optimize for larger instances:

  • Minimize Payload: Ensure the category.products.list API request only asks for necessary attributes and bypasses unused facets/filters.
  • Audit Merchandising Rules: Regularly review active rules and fallback strategies in Tweakwise to eliminate redundant algorithms.
  • Establish an Instance Baseline: Benchmark the Tweakwise API response time directly from your production server using your actual catalog data before going live.

Step 3: Prepare Infrastructure Capacity

Because personal merchandising routes category list rendering directly through PHP-FPM, full-page cache won't shield your server from high concurrent traffic on category pages.

Actions:

  • Scale PHP Workers: Ensure your hosting environment has adequate PHP worker processes and CPU capacity to process concurrent un-cached requests during peak sales events.
  • Optimize Network Latency: Ensure keep-alive connections are enabled and latency between your Magento server and Tweakwise endpoints is minimized.

Step 4: Diagnose & Troubleshoot Latency in Customized Environments

If your live environment exceeds the expected baseline (~100–150 ms added time), follow these diagnostic steps:

  1. Profile Magento Execution:
    • Use tools like Blackfire.io or Magento’s built-in profiler.
    • Check if Magento core execution time (excluding the API call) exceeds ~50 ms.
    • Look for third-party modules or custom observers listening to category.products.list layout rendering.
  2. Check Connection & API Times:
    • Measure TLS/TCP handshake times (~40 ms on cold connections) and verify connection reuse.
  3. Avoid Unnecessary ESI Modifications:
    • Refactoring layout handles or creating lightweight custom ESI endpoints yields negligible gains (~10 ms) and increases risk. Focus optimization on server capacity, custom code efficiency, and API payload size instead.