What 1 hystrix that?
Netflix (the largest foreign similar, love Fantastic Art, Youku) video site five or six years ago, too, felt the system, the entire site, often a failure, availability is not too high
Sometimes some of the vip members can not pay, sometimes watching video on Caton, could not watch the video. . .
Affect the company's revenue !!!
Fifty-six years ago, netflix, api team, to enhance the high-availability, the development of a framework similar to the spring, mybatis, hibernate, and so on such a framework
High availability framework, hystrix
hystrix, framework, offers a variety of features related to high availability, and then make sure to say under the protection hystrix, the entire system can be in the long-term availability of state
Under ideal conditions, the failure of the software, it should not say leads to some failures collapse of the entire system, server hardware, redundant service
The only likely to lead to the total collapse of the system is similar to before, the accident Alipay, construction workers, Waduan cable, leading to several rooms have blackout
Not available, and have some fault or bug distinction
2 hystrix functionality provided
Resource isolation, current limiting, fuse, demotion, operation and maintenance monitoring
Resource isolation
Let your system, a piece of something, in case of failure, the system will not run out of resources, such as thread resources
I was actually a case of the project, there is a thing, is to use multiple threads to do something, junior partner doing the project, did not pay attention too, resource isolation, that piece of code, in the case of encounter some failures, each threads running at the time, because the bug, directly on the cycle of death, resulting in a large piece of something to start threads, each thread infinite loop
I eventually leading to system resource depletion, collapse, does not work, is not available, was destroyed
Resource isolation, that piece of code, up to a maximum of 10 threads is spent, not more, and to destroy, and limited number of good resources
Limiting
High concurrent influx of traffic coming in, for example, suddenly a second one million QPS, was destroyed, 100,000 QPS into the system, other 900 000 QPS was rejected
Fuse
Some systems rely on back-end, which some fault, for example, hang mysql, each request is given, and a fuse, not directly over the subsequent requests received, denied access, and then try to see mysql After 10 minutes no recovery
Demote
mysql hung up, the system is found, automatically downgrade, small amounts of data stored in the memory, to extract some data out
Operation and maintenance monitoring
+ + Optimized alarm monitoring, various abnormal situations, there are problems timely alarm, and parameter optimization of some system configuration, or the code
3 How to explain this piece of content?
(1) How eshop-cache, cache core service transformed into a highly available architecture
(2) part of hystrix in a single pull out, made a free small courses, as benefits paid out
(3) eshop-cache , write code, eshop-cache-ha, business scenarios, join up with before, to re-write the code
(4) hystrix do a service availability of this content, just explain to a business context, to re-write the code, independent
eshop-cache, cache data in case of failure at all levels, will re-call interface from the source system, depending on the source system to query the mysql database to retrieve data
If you depend on a variety of services with failure, then it may cause your system unusable
hystrix the system a variety of high-availability systems strengthening to cope with various situations unavailable
4 design principles of Hystrix
-
Dependence on service calls occur when call delay call fails and control and fault protection.
-
In the complex distributed system, one of its dependencies prevent service failure spread throughout the system. For example, one of service failure, leading to other services also followed the failure.
-
Provide fail-fast (fast failure) and rapid recovery support.
-
Providing graceful degradation fallback support.
-
Support for near real-time monitoring, alarm and operation and maintenance operations.
5 Hystrix design principles more details
-
Prevent any dependent services run out of resources, such as resources, all threads in the tomcat.
-
Request queuing and avoiding a backlog, current-limiting and fail fast fault controlled.
-
Downgrade to provide fallback mechanism to deal with failure.
-
Use resource isolation techniques, such as bulkhead (bulkhead isolation technology), swimlane (lane technology), circuit breaker (circuit technology) to limit the impact of any failure of a dependent service.
-
Through near real-time statistics / monitoring / alarm function, to improve the speed of faults found.
-
Through near real-time thermal properties and configuration modification capabilities to improve troubleshooting and speed recovery.
-
Protect all fault conditions depend on service calls, not just of a network failure.
Reference:
https://www.nowcoder.com/discuss/188033