PranaviAncha commented on code in PR #3085:
URL: https://github.com/apache/helix/pull/3085#discussion_r2592103127


##########
website/1.4.3/src/site/markdown/tutorial_messaging.md:
##########
@@ -25,6 +25,26 @@ under the License.
 
 In this chapter, we\'ll learn about messaging, a convenient feature in Helix 
for sending messages between nodes of a cluster.  This is an interesting 
feature that is quite useful in practice. It is common that nodes in a 
distributed system require a mechanism to interact with each other.
 
+### Performance Considerations
+
+**IMPORTANT:** When using the messaging API with `Criteria`, be aware of the 
following performance characteristics:
+
+- **ExternalView Scanning:** By default, the messaging service uses 
`DataSource.EXTERNALVIEW` to resolve criteria. This can scan **all** 
ExternalView znodes in the cluster, even when targeting specific instances. At 
high resource cardinality (thousands of resources), this can cause severe 
performance degradation.
+
+**Recommended Patterns:**
+
+- **Use `DataSource.LIVEINSTANCES`** when you only need to target live 
instances and do not require resource/partition-level filtering. This is much 
faster and more efficient.
+- **Specify exact resource names** instead of wildcards if you must use 
ExternalView scanning.
+
+Example of efficient messaging:
+```java
+Criteria recipientCriteria = new Criteria();
+recipientCriteria.setInstanceName("instance123");
+recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
+recipientCriteria.setDataSource(DataSource.LIVEINSTANCES); // Efficient: 
avoids EV scan

Review Comment:
   ```suggestion
   recipientCriteria.setDataSource(DataSource.LIVEINSTANCES);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to