josh-mckenzie commented on code in PR #1783:
URL: https://github.com/apache/cassandra/pull/1783#discussion_r945802633


##########
src/java/org/apache/cassandra/transport/Dispatcher.java:
##########
@@ -80,7 +101,16 @@ public Dispatcher(boolean useLegacyFlusher)
 
     public void dispatch(Channel channel, Message.Request request, 
FlushItemConverter forFlusher, Overload backpressure)
     {
-        requestExecutor.submit(new RequestProcessor(channel, request, 
forFlusher, backpressure));
+        // if native_transport_max_auth_threads is < 1, don't delegate to new 
pool on auth messages
+        if (DatabaseDescriptor.getNativeTransportMaxAuthThreads() > 0 && 
(request.type == Message.Type.AUTH_RESPONSE || request.type == 
Message.Type.CREDENTIALS))
+        {
+            // importantly will handle the AUTHENTICATE message which may be 
CPU intensive.
+            authExecutor.submit(new RequestProcessor(channel, request, 
forFlusher, backpressure));
+        }
+        else
+        {
+            requestExecutor.submit(new RequestProcessor(channel, request, 
forFlusher, backpressure));

Review Comment:
   I think I prefer taking it a step further and just restructuring it entirely:
   ```
       public void dispatch(Channel channel, Message.Request request, 
FlushItemConverter forFlusher, Overload backpressure)
       {
           // if native_transport_max_auth_threads is < 1, don't delegate to 
new pool on auth messages
           boolean isAuthQuery = 
DatabaseDescriptor.getNativeTransportMaxAuthThreads() > 0 &&
                                 (request.type == Message.Type.AUTH_RESPONSE || 
request.type == Message.Type.CREDENTIALS);
   
           // Importantly, the authExecutor will handle the AUTHENTICATE 
message which may be CPU intensive.
           LocalAwareExecutorPlus executor = isAuthQuery ? authExecutor : 
requestExecutor;
   
           executor.submit(new RequestProcessor(channel, request, forFlusher, 
backpressure));
           ClientMetrics.instance.markRequestDispatched();
       }
   ```



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