magibney commented on code in PR #2313:
URL: https://github.com/apache/solr/pull/2313#discussion_r1571157518


##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java:
##########
@@ -1017,19 +1023,21 @@ public String getBaseURL() {
   }
 
   private static class AsyncTracker {
-    private static final int MAX_OUTSTANDING_REQUESTS = 1000;
+    private static final int DEFAULT_MAX_OUTSTANDING_REQUESTS = 1000;
 
     // wait for async requests
     private final Phaser phaser;
+    private final int maxOutstandingRequests;
     // maximum outstanding requests left
     private final Semaphore available;
     private final Request.QueuedListener queuedListener;
     private final Response.CompleteListener completeListener;
 
-    AsyncTracker() {
+    AsyncTracker(int maxOutstandingRequests) {
       // TODO: what about shared instances?
+      this.maxOutstandingRequests = maxOutstandingRequests;
       phaser = new Phaser(1);
-      available = new Semaphore(MAX_OUTSTANDING_REQUESTS, false);
+      available = new Semaphore(maxOutstandingRequests, false);

Review Comment:
   I'm all but certain that the semaphore _is_ working -- in fact it's the only 
thing that practically needed to be changed in our [local 
mitigation](https://github.com/cowpaths/fullstory-solr/pull/124). Notably, that 
mitigation changed `getMaxRequestsQueuedPerDestination()` to return a constant 
(3k -- effectively unchanged from current `main`) independent of the 
configuration of `maxOutstandingRequests`. There's some [relevant 
discussion](https://github.com/cowpaths/fullstory-solr/pull/124#discussion_r1294915329)
 there that explores the distinction between `maxOutstandingRequests` as 
enforced by the `available` Semaphore (across all destinations), vs. 
`getMaxRequestsQueuedPerDestination()` which, as the method name suggests, is 
per destination.



-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to