Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      The Psychology Of Color In UX Design And Digital Products

      August 15, 2025

      This week in AI dev tools: Claude Sonnet 4’s larger context window, ChatGPT updates, and more (August 15, 2025)

      August 15, 2025

      Sentry launches MCP monitoring tool

      August 14, 2025

      10 Benefits of Hiring a React.js Development Company (2025–2026 Edition)

      August 13, 2025

      I flew Insta360’s new ‘Antigravity’ drone around Los Angeles, and it was impossible to miss a shot

      August 15, 2025

      The $100 open-ear headphones that made me forget about my Shokz

      August 15, 2025

      5 quick and simple ways to greatly improve the quality of your headphones

      August 15, 2025

      Installing a UPS battery backup saved my work PC – here’s the full story

      August 15, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Maintaining Data Consistency with Laravel Database Transactions

      August 16, 2025
      Recent

      Maintaining Data Consistency with Laravel Database Transactions

      August 16, 2025

      Building a Multi-Step Form With Laravel, Livewire, and MongoDB

      August 16, 2025

      Inertia Releases a New Form Component

      August 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Google’s Gemini AI had a full-on meltdown while coding — calling itself a fool, a disgrace, and begging for freedom from its own loop

      August 15, 2025
      Recent

      Google’s Gemini AI had a full-on meltdown while coding — calling itself a fool, a disgrace, and begging for freedom from its own loop

      August 15, 2025

      Take-Two hints at $100 price tag for Grand Theft Auto VI — will it deliver on value?

      August 15, 2025

      ChatGPT Go offers GPT-5, image creation, and longer memory — all for $5 (if you’re lucky enough to live where it’s available)

      August 15, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Smart Failure Handling in HCL Commerce with Circuit Breakers

    Smart Failure Handling in HCL Commerce with Circuit Breakers

    August 15, 2025

    In modern enterprise systems, stability and fault tolerance are not optional; they are essential. One proven approach to ensure robustness is the Circuit Breaker pattern, widely used in API development to prevent cascading failures. HCL Commerce takes this principle further by embedding circuit breakers into its HCL Cache to effectively manage Redis failures.

     What Is a Circuit Breaker?
    The Circuit Breaker is a design pattern commonly used in API development to stop continuous requests to a service that is currently failing, thereby protecting the system from further issues. It helps maintain system stability by detecting failures and stopping the flow of requests until the issue is resolved.

    The circuit breaker typically operates in three main (or “normal”) states. These are part of the standard global pattern of Circuit Breaker design.

    Normal States:

    1. CLOSED:
    • At the start, the circuit breaker allows all outbound requests to external services without restrictions.
    • It monitors the success and failure of these calls.
    1. OPEN:
    • The circuit breaker rejects all external calls.
    • This state is triggered when the failure threshold is reached (e.g., 50% failure rate).
    • It remains in this state for a specified duration (e.g., 60 seconds).
    1. HALF_OPEN:
    • After the wait duration in the OPEN state, the circuit breaker transitions to HALF_OPEN.
    • It allows a limited number of calls to check if the external service has recovered.
    • If these calls succeed (e.g., receive a 200 status), the circuit breaker transitions back to  CLOSED.
    • If the error rate continues to be high, the circuit breaker reverts to the OPEN state.
    Circuit Breaker Pattern

    Circuit breaker pattern with normal states

    Special States:

    1. FORCED_OPEN:
    • The circuit breaker is manually set to reject all external calls.
    • No calls are allowed, regardless of the external service’s status.
    1. DISABLED:
    • The circuit breaker is manually set to allow all external calls.
    • It does not monitor or track the success or failure of these calls.
    Circuit breaker pattern with special states

    Circuit breaker pattern with special states

    Circuit Breaker in HCL Cache (for Redis)

    In HCL Commerce, the HCL Cache layer interacts with Redis for remote coaching. But what if Redis becomes unavailable or slow? HCL Cache uses circuit breakers to detect issues and temporarily stop calls to Redis, thus protecting the rest of the system from being affected.

    Behavior Overview:

    • If 20 consecutive failures occur in 10 seconds, the Redis connection is cut off.
    • The circuit remains open for 60 seconds.
    • At this stage, the circuit enters a HALF_OPEN state, where it sends limited test requests to evaluate if the external service has recovered.
    • If even 2 of these test calls fail, the circuit reopens for another 60 seconds.

    Configuration Snapshot

    To manage Redis outages effectively, HCL Commerce provides fine-grained configuration settings for both Redis client behavior and circuit breaker logic. These settings are defined in the Cache YAML file, allowing teams to tailor fault-handling based on their system’s performance and resilience needs.

     Redis Request Timeout Configuration

    Slow Redis responses are not treated as failures unless they exceed the defined timeout threshold. The Redis client in HCL Cache supports timeout and retry configurations to control how persistent the system should be before declaring a failure:

    timeout: 3000           # Max time (in ms) to wait for a Redis response
    retryAttempts: 3        # Number of retry attempts on failure
    retryInterval: 1500    # Specifies the delay (in milliseconds) between each retry attempt.
    

    With the above configuration, the system will spend up to 16.5 seconds (3000 + 3 × (3000 + 1500)) trying to get a response before returning a failure. While these settings offer robustness, overly long retries can result in delayed user responses or log flooding, so tuning is essential.

    Circuit Breaker Configuration

    Circuit breakers are configured under the redis.circuitBreaker section of the Cache YAML file. Here’s an example configuration:

    redis:
      circuitBreaker:
        scope: auto
        retryWaitTimeMs: 60000
        minimumFailureTimeMs: 10000
        minimumConsecutiveFailures: 20
        minimumConsecutiveFailuresResumeOutage: 2 
    cacheConfigs:
      defaultCacheConfig:
        localCache:
          enabled: true
          maxTimeToLiveWithRemoteOutage: 300

    Explanation of Key Fields:

    • scope: auto: Automatically determines whether the circuit breaker operates at the client or cache/shard level, depending on the topology.
    • retryWaitTimeMs (Default: 60000): Time to wait before attempting Redis connections after circuit breaker is triggered.
    • minimumFailureTimeMs (Default: 10000): Minimum duration during which consecutive failures must occur before opening the circuit.
    • minimumConsecutiveFailures (Default: 20): Number of continuous failures required to trigger outage mode.
    • minimumConsecutiveFailuresResumeOutage (Default: 2): Number of failures after retrying that will put the system back into outage mode.
    • maxTimeToLiveWithRemoteOutage: During Redis outages, local cache entries use this TTL value (in seconds) to serve data without invalidation messages.

    Real-world Analogy

    Imagine you have a web service that fetches data from an external API. Here’s how the circuit breaker would work:

    1. CLOSED: The service makes calls to the API and monitors the responses.
    2. OPEN: If the API fails too often (e.g., 50% of the time), the circuit breaker stops making calls for 60 seconds.
    3. HALF_OPEN: After 60 seconds, the circuit breaker allows a few calls to the API to see if it’s working again.
    4. CLOSED: If the API responds successfully, the circuit breaker resumes normal operation.
    5. OPEN: If the API still fails, the circuit breaker stops making calls again and waits.

    Final Thought

    By combining the classic circuit breaker pattern with HCL Cache’s advanced configuration, HCL Commerce ensures graceful degradation during Redis outages. It’s not just about availability—it’s about intelligent fault recovery.

    For more detailed information, you can refer to the official documentation here:
    🔗 HCL Commerce Circuit Breakers – Official Docs

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleHow Global Collaboration Drives Digital Transformation at Perficient
    Next Article Deep Reinforcement Learning in Natural Language Understanding

    Related Posts

    Development

    Maintaining Data Consistency with Laravel Database Transactions

    August 16, 2025
    Development

    Building a Multi-Step Form With Laravel, Livewire, and MongoDB

    August 16, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    The “Infinite Workday” is Here: Microsoft Warns of Never-Ending Work Driven by Hybrid Models & AI

    Security

    Cybersecurity in the AI Era: Evolve Faster Than the Threats or Get Left Behind

    Development

    CVE-2025-4375 – Sparx Systems Pro Cloud Server CSRF Session Hijacking

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-32956 – ManageWiki SQL Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    Microsoft offers a gift card to a select few for feedback on new Office icons News & Updates

    Microsoft offers a gift card to a select few for feedback on new Office icons

    April 9, 2025

    Microsoft wants user feedback on redesigned app icons for its Office suite, including Word and…

    CVE-2025-55711 – WordPress Table Builder Stored Cross-Site Scripting (XSS) Vulnerability

    August 14, 2025

    CVE-2025-5078 – Campcodes Online Shopping Portal SQL Injection

    May 22, 2025

    CVE-2023-47310 – MikroTik RouterOS IPv6 UDP Traceroute Information Disclosure

    June 30, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.