Hystrix limits the number of concurrent calls to a component中的舱壁实现。这样,等待组件响应的资源(通常是线程)的数量是有限的。
假设您有一个基于请求的多线程应用程序(例如一个典型的 Web 应用程序) ,它使用三个不同的组件: A、 B和 C。如果对组件 C的请求开始挂起,最终所有处理请求的线程都将挂起,等待来自 C的答复。这将使应用程序完全没有响应。如果对 C的请求处理得很慢,那么如果负载足够高,我们也会遇到类似的问题。
Hystrix' implementation of the bulkhead pattern limits the number of concurrent calls to a component and would have saved the application in this case. Assume we have 30 request handling threads and there is a limit of 10 concurrent calls to C. Then at most 10 request handling threads can hang when calling C, the other 20 threads can still handle requests and use components A and B.