- Java EE 8 and Angular
- Prashant Padmanabhan
- 248字
- 2021-07-02 19:22:38
Build for failure
The demand of distributed computing requires services to be written so that they are capable of handling failures. The failure of one service can lead to a cascading effect across all and can be the biggest bottleneck in the application. When invoking REST APIs, consider using time outs, as waiting for long periods will have an adverse effect on the response times. When a response doesn't meet the defined service level agreement (SLA), you could have a default response kept available for such cases.
If a service is timing out, then there's a good chance that it may be down or it may not be available for a longer period. Using a circuit breaker allows you to avoid calling the service that is timing out frequently. If a service is timing out beyond a defined number of times, then the circuit breaker would prevent any further calls. After a defined interval, the circuit-breaker would retry the target service, thereby allowing it time to recover.
These patterns can be written in plain Java code without relying on libraries to do it for you. As an example, you could create an interceptor for all external calls made, which keeps track of failures. Once the threshold of failures is reached, the interceptor can have logic that tells it to not make any further calls to the target service until a defined period. After the configured period is over, the interceptor can start allowing new calls to the service.
- Web前端開發技術:HTML、CSS、JavaScript(第3版)
- Learning ROS for Robotics Programming(Second Edition)
- Visual C++串口通信開發入門與編程實踐
- Objective-C應用開發全程實錄
- Mastering RStudio:Develop,Communicate,and Collaborate with R
- Modular Programming in Java 9
- Couchbase Essentials
- QGIS Python Programming Cookbook(Second Edition)
- 大話Java:程序設計從入門到精通
- Java編程從入門到精通
- ActionScript 3.0從入門到精通(視頻實戰版)
- Python函數式編程(第2版)
- OpenCV 3計算機視覺:Python語言實現(原書第2版)
- HTML+CSS+JavaScript前端開發(慕課版)
- 數據預處理從入門到實戰:基于SQL、R、Python