{"action":"opened","issue":{"url":"https://api.github.com/repos/AvanzaBank/astrix/issues/23","labels_url":"https://api.github.com/repos/AvanzaBank/astrix/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/AvanzaBank/astrix/issues/23/comments","events_url":"https://api.github.com/repos/AvanzaBank/astrix/issues/23/events","html_url":"https://github.com/AvanzaBank/astrix/issues/23","id":117363741,"number":23,"title":"Change in Bean Fault Tolerance","user":{"login":"eliaslindholm","id":1237937,"avatar_url":"https://avatars.githubusercontent.com/u/1237937?v=3","gravatar_id":"","url":"https://api.github.com/users/eliaslindholm","html_url":"https://github.com/eliaslindholm","followers_url":"https://api.github.com/users/eliaslindholm/followers","following_url":"https://api.github.com/users/eliaslindholm/following{/other_user}","gists_url":"https://api.github.com/users/eliaslindholm/gists{/gist_id}","starred_url":"https://api.github.com/users/eliaslindholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eliaslindholm/subscriptions","organizations_url":"https://api.github.com/users/eliaslindholm/orgs","repos_url":"https://api.github.com/users/eliaslindholm/repos","events_url":"https://api.github.com/users/eliaslindholm/events{/privacy}","received_events_url":"https://api.github.com/users/eliaslindholm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AvanzaBank/astrix/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-17T14:19:19Z","updated_at":"2015-11-17T14:19:19Z","closed_at":null,"body":"This ticket proposes a change in the way fault tolerance is applied to Astrix Beans. \r\n\r\nCurrent implementation (0.38.x) groups Astrix beans by the `AstrixApiProvider` they are defined in. Each service bean defined in the same api will share the same undelying Hystrix thread-pool when threads are used for fault isolation (i.e for all \"synchronous\" invocations).\r\n\r\n#### Problems with the current design\r\n* It is fairly complicated to understand the mapping between an invoked Astrix bean, and the underlying Hystrix command used to protect the invocation. This makes it hard to understand how to configure the underlying Hystrix command used to protect the invocation to an Astrix bean (thread pool size, timeout, etc)\r\n* All `AstrixBeanSetting`s that relates to configuration of the associated Hystrix thread pool are broken by design (for instance `AstrixBeanSetting.INITIAL_CORE_SIZE`). The problem is that `AstrixBeanSettings` are defined for individual Astrix beans, whereas the Hystrix thread pool settings applies to all Astrix bean defined in the same ApiProvider. If two Astrix Beans defined in the same api has different values for a thread pool property, then it is not deterministic which value will apply at runtime (the first bean created will \"win\").\r\n* Astrix doesn't know if the underlying Hystrix-configuration changes at runtime. Ideally Astrix should use the same timeout for a remote service call and the associated `HystrixCommand`. However, the current design doesn't tie the two together. The Hystrix timeout can change at runtime by using the dynamic configuration mechanism supported by Hystrix, without Astrix becoming aware of the change.\r\n\r\n#### Proposed changes\r\n* Each Astrix bean has a dedicated Hystrix thread-pool. This means that there is a one-to-one mapping between Astrix beans and the thread-pool used for fault-isolation.\r\n* Fault tolerance is fully configured using `AstrixBeanSetting`s. The usage of Hystrix is completely hidden from the user of the framework. This requires that Astrix uses its own `HystrixPlugins`. \r\n\r\n#### Custom HystrixPlugin's\r\nSince Astrix allows multiple `AstrixContext` within the same JVM, and the AstrixBeanSettings should be associated with one `AstrixContext`, Astrix implemens a dispatcher mechanism that delegates calls from the global Hystrix instance to the associated `AstrixContext` instance."}}