You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/asciidoc/api.adoc
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ will pick a new URI randomly in case of disconnection.
72
72
===== Understanding Connection Logic
73
73
74
74
Creating the environment to connect to a cluster node works usually seamlessly.
75
-
Creating publishers and consumers can cause problems as the client uses hints from the cluster to locate the nodes where stream leaders and replicas are located to connect to the appropriate nodes.
75
+
Creating publishers and consumers can cause problems as the client uses hints from the cluster to find the nodes where stream leaders and replicas are located to connect to the appropriate nodes.
76
76
77
77
These connection hints can be accurate or less appropriate depending on the infrastructure.
78
78
If you hit some connection problems at some point – like hostnames impossible to resolve for client applications - this https://blog.rabbitmq.com/posts/2021/07/connecting-to-streams/[blog post] should help you understand what is going on and fix the issues.
@@ -204,6 +204,10 @@ a new connection is open. The value must be between 1 and 255.
204
204
Used as a prefix for connection names.
205
205
|`rabbitmq-stream`
206
206
207
+
|`addressResolver`
208
+
|Contract to change resolved node address to connect to.
209
+
|Pass-through (no-op)
210
+
207
211
|`tls`
208
212
|Configuration helper for TLS.
209
213
|TLS is enabled if a `rabbitmq-stream+tls` URI is provided.
@@ -225,6 +229,24 @@ and does not use a client private key. **Only for development**.
225
229
|Disabled by default.
226
230
|===
227
231
232
+
===== When a Load Balancer is in Use
233
+
234
+
A load balancer can misguide the client when it tries to connect to nodes that host stream leaders and replicas.
235
+
The https://blog.rabbitmq.com/posts/2021/07/connecting-to-streams/["Connecting to Streams"] blog post covers why client applications must connect to the appropriate nodes in a cluster and how a https://blog.rabbitmq.com/posts/2021/07/connecting-to-streams/#with-a-load-balancer[load balancer can make things complicated] for them.
236
+
237
+
The `EnvironmentBuilder#addressResolver(AddressResolver)` method allows intercepting the node resolution after metadata hints and before connection.
238
+
Applications can use this hook to ignore metadata hints and always use the load balancer, as illustrated in the following snippet:
239
+
240
+
.Using a custom address resolver to always use a load balancer
<2> Use load balancer address for initial connection
247
+
<3> Ignore metadata hints, always use load balancer
248
+
249
+
The blog post covers the https://blog.rabbitmq.com/posts/2021/07/connecting-to-streams/#client-workaround-with-a-load-balancer[underlying details of this workaround].
The run will start one producer and will use the `stream-1` producer reference (default stream is `stream` and the number of the producer is 1.)
479
479
480
+
===== Load Balancer in Front of the Cluster
481
+
482
+
A load balancer can misguide the performance tool when it tries to connect to nodes that host stream leaders and replicas.
483
+
The https://blog.rabbitmq.com/posts/2021/07/connecting-to-streams/["Connecting to Streams"] blog post covers why client applications must connect to the appropriate nodes in a cluster.
484
+
485
+
Use the `--load-balancer` flag to make sure the performance tool always goes through the load balancer that sits in front of your cluster:
The same blog post covers why a https://blog.rabbitmq.com/posts/2021/07/connecting-to-streams/#with-a-load-balancer[load balancer can make things more complicated] for client applications like the performance tool and how https://blog.rabbitmq.com/posts/2021/07/connecting-to-streams/#client-workaround-with-a-load-balancer[they can mitigate these issues].
493
+
480
494
===== Monitoring
481
495
482
496
The tool can expose some runtime information on HTTP.
0 commit comments