1.3. バランシングの要求
Hot Rod Java クライアントは、Data Grid サーバークラスターへの要求のバランスを取り、読み取りおよび書き込み操作がノード全体に分散されるようにします。
BASIC または TOPOLOGY_AWARE インテリジェンスを使用するクライアントは、すべての要求に対して要求バランシングを使用します。HASH_DISTRIBUTION_AWARE インテリジェンスを使用するクライアントは、目的のキーを格納するノードに直接要求を送信します。ノードが応答しない場合、クライアントはフォールバックしてバランシングを要求します。
デフォルトのバランシング戦略はラウンドロビンであるため、Hot Rod クライアントは次の例のようにリクエストバランシングを実行します。ここで、 s1、s2、s3 は Data Grid クラスター内のノードです。
カスタムバランシングポリシー
Hot Rod クライアント設定にクラスを追加する場合は、カスタムの FailoverRequestBalancingStrategy 実装を使用できます。
ConfigurationBuilder
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.addServer()
.host("127.0.0.1")
.port(11222)
.balancingStrategy(new MyCustomBalancingStrategy());
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.addServer()
.host("127.0.0.1")
.port(11222)
.balancingStrategy(new MyCustomBalancingStrategy());
hotrod-client.properties
infinispan.client.hotrod.request_balancing_strategy=my.package.MyCustomBalancingStrategy
infinispan.client.hotrod.request_balancing_strategy=my.package.MyCustomBalancingStrategy