aparnasuresh85 commented on code in PR #2571:
URL: https://github.com/apache/solr/pull/2571#discussion_r1695462899


##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java:
##########
@@ -246,6 +257,52 @@ public void testAliasHandling() throws Exception {
         2, client.query(null, 
paramsWithMixedCollectionAndAlias).getResults().getNumFound());
   }
 
+  @Test
+  @LogLevel("org.apache.solr.servlet.HttpSolrCall=DEBUG")
+  public void testHttpCspPerf() throws Exception {
+
+    String collectionName = "HTTPCSPTEST";
+    CollectionAdminRequest.createCollection(collectionName, "conf", 2, 
1).process(cluster.getSolrClient());
+    cluster.waitForActiveCollection(collectionName, 2, 2);
+
+    CloudSolrClient solrClient = null;
+    try (LogListener entireClusterStateLogs = 
LogListener.info(HttpSolrCall.class).regex(PATTERN_WITHOUT_COLLECTION); 
LogListener collectionClusterStateLogs = 
LogListener.info(HttpSolrCall.class).regex(PATTERN_WITH_COLLECTION); 
LogListener adminRequestLogs = 
LogListener.info(HttpSolrCall.class).substring("[admin]")) {
+
+      solrClient = createHttpCSPBasedCloudSolrClient();
+
+      SolrInputDocument doc = new SolrInputDocument("id", "1", "title_s", "my 
doc");
+      solrClient.add(collectionName, doc);
+      solrClient.commit(collectionName);
+      for (int i = 0; i < 3; i++) {
+        assertEquals(1, solrClient.query(collectionName, params("q", 
"*:*")).getResults().getNumFound());
+      }
+
+      assertLogCount(adminRequestLogs, 12);
+      assertLogCount(collectionClusterStateLogs, 10);
+      assertLogCount(entireClusterStateLogs, 1);

Review Comment:
   I had the explanation in a prior commit I believe and forgot to add it back 
upon a subsequent refactor.
   
   Out of the 12 /admin requests asserted by the `CloudHttp2SolrClientTest`, 10 
originate from the call to fetch the `CLUSTERSTATUS` for a given collection, 1 
from a call to fetch the entire `CLUSTERSTATUS`, and there is also a call to 
`LISTALIASES` that gets invoked from `resolveAliases()`  via the call to 
`resolveAlias()`
   
   **What adds up to 10 calls to fetch `CLUSTERSTATUS` for a collection?**
   For the `add()`, there is a call to fetch `CLUSTERSTATUS` via 
`resolveAliases()` and then via `getDocCollection()/getCollectionRef()` (first 
lookup of collection) for a total of 2 calls
   
   2 calls each for `commit()`, followed by 3 /select requests, coming from 
`resolveAliases()`, invoked from `CSC.retryRequestWithStaleState() `and then 
again in` CSC.sendRequest()`
   



-- 
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