Interface Circuit Breaking With AOP and Sliding-Window Error Control
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In data interaction scenarios, upstream service systems experience high failure rates due to continuous calls to abnormal service interfaces when downstream or third-party service systems respond anomalously, lacking appropriate service logic processing for failures.
Innovation Solution
An interface fusing method utilizing Aspect Oriented Programming (AOP) to manage circuit breakers, where meta information and configuration parameters determine whether to call a target method, count successful and error calls, and perform fusing processing based on sliding time windows and configuration parameters to mitigate failures.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If the upstream service system continuously calls the abnormal service interface, then the service processing can proceed, but the service failure rate increases
Solution Approach 1:
The circuit breaker is configured in advance with fusing parameters including error threshold, time window, and degradation policies. When the error rate reaches the threshold within the time window, the circuit breaker proactively triggers fusing processing before complete system failure occurs, thus maintaining service reliability while allowing normal processing to continue
Solution Approach 2:
The system continuously monitors service call results and feeds back error information to the circuit breaker. Based on this feedback, the circuit breaker dynamically adjusts whether to allow calls to proceed or trigger fusing degradation policies, resolving the contradiction between maintaining throughput and preventing failure accumulation
2Device complexity
If service logic processing for call failure is not set, then the system structure remains simple, but the service failure rate increases
Solution Approach 1:
The circuit breaker acts as an intermediary component between the service call and the target interface. It intercepts calls, monitors error rates, and independently decides whether to allow calls or trigger degradation policies, adding reliability functionality without complicating the core service logic
Solution Approach 2:
The circuit breaker automatically monitors service call status, calculates error rates, and triggers fusing processing without requiring external intervention or complex service logic configuration. This self-service mechanism maintains simplicity while improving reliability
3Reliability
If fusing processing is performed timely, then the service failure rate is reduced, but the system requires additional monitoring and control mechanisms
Solution Approach 1:
The circuit breaker merges multiple functions including error monitoring, statistical calculation, threshold judgment, and degradation policy execution into a single integrated component. This consolidation achieves timely fusing processing while minimizing the complexity increase by combining related mechanisms rather than adding separate systems
Data Source
AI summary
An interface fusing method, an interface fusing apparatus, and a computer-readable storage medium are provided. The method includes: determining, according to a fusing configuration parameter and a current status of a circuit breaker, whether a target method meets a calling condition, determining whether the target method is called successfully, if yes, executing a preconfigured fusing rule according to meta information of the target method; if an executing result of the fusing rule is true, counting the quantity of calling times and the quantity of error calling times; if the target method is failed to be called, determining, with reference to the fusing configuration parameter and according to the quantity of calling times and the quantity of error calling times in a preset sliding time window, whether to perform fusing processing on the target method, if yes, performing fusing processing on the target method.


