You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/10/06 07:41:18 UTC

[GitHub] [pulsar] 315157973 opened a new pull request #8208: Use ThreadPoolExecutor instead of EventLoop

315157973 opened a new pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208


   ### Motivation
   When Netty's `EventLoop` receives a new task,it will call `eventFdWrite`, and then trigger system calls, such as: system_call_fastpath, eventfd_write
   After we replaced EventLoop with a native jdk thread pool, the performance improved
   
   ### Modifications
   Use ThreadPoolExecutor instead of EventLoop
   
   ### Verifying this change
   We use pulsar perf for testing
   before:
   Aggregated throughput stats --- 11715556 records received --- 68813.420 msg/s --- 537.605 Mbit/s
   
   after:
   Aggregated throughput stats --- 18392800 records received --- 133314.602 msg/s --- 1041.520 Mbit/s


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

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



[GitHub] [pulsar] codelipenghui commented on a change in pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#discussion_r501720145



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
##########
@@ -145,6 +147,7 @@ public PulsarClientImpl(ClientConfigurationData conf, EventLoopGroup eventLoopGr
         conf.getAuthentication().start();
         this.cnxPool = cnxPool;
         externalExecutorProvider = new ExecutorProvider(conf.getNumListenerThreads(), getThreadFactory("pulsar-external-listener"));
+        internalExecutorService = new ExecutorProvider(conf.getNumIoThreads(), getThreadFactory("pulsar-client-io"));

Review comment:
       ```suggestion
           internalExecutorService = new ExecutorProvider(conf.getNumIoThreads(), getThreadFactory("pulsar-client-internal"));
   ```




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

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



[GitHub] [pulsar] aahmed-se commented on pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
aahmed-se commented on pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#issuecomment-704422719


   @315157973 can you provide more details on the setup you used to get theses perf numbers.


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

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



[GitHub] [pulsar] 315157973 commented on pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#issuecomment-704098611


   > Is there any other ConsumerXX class that needs this change ?
   
   If this PR is accepted, I will continue to modify other ConsumerXX :)


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

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



[GitHub] [pulsar] codelipenghui commented on a change in pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#discussion_r501029758



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
##########
@@ -145,6 +147,8 @@ public PulsarClientImpl(ClientConfigurationData conf, EventLoopGroup eventLoopGr
         conf.getAuthentication().start();
         this.cnxPool = cnxPool;
         externalExecutorProvider = new ExecutorProvider(conf.getNumListenerThreads(), getThreadFactory("pulsar-external-listener"));
+        ioExecutorService = new ThreadPoolExecutor(conf.getNumIoThreads(), conf.getNumIoThreads(), 0L, TimeUnit.MILLISECONDS,
+                new LinkedBlockingQueue<>(), getThreadFactory("pulsar-io-thread"));

Review comment:
        Now we already have threads named `pulsar-client-io`, so it's better to use a different name for the new threads. And I noticed some internal tasks of the client also uses the `externalExecutorProvider` for executing the internal task of the Pulsar client. Maybe we can add an `internalExecutorService` for handing the internal tasks of the client.




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

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



[GitHub] [pulsar] sijie commented on pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
sijie commented on pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#issuecomment-704408174


   @315157973 how did you do the test? We'd prefer you to attach the details on how you run the perf test. This would give the context for the reviewers to review this change.


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

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



[GitHub] [pulsar] 315157973 commented on pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#issuecomment-704668015


   Hello, I have already replied in another pr, refer to #8207 


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

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



[GitHub] [pulsar] eolivelli commented on pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#issuecomment-704096826


   Is there any other ConsumerXX class that needs this change ?


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

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



[GitHub] [pulsar] codelipenghui commented on pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#issuecomment-706794847


   @315157973 Please fix the conflicts.


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

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



[GitHub] [pulsar] codelipenghui merged pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208


   


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

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



[GitHub] [pulsar] 315157973 commented on pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#issuecomment-706871075


   /pulsarbot run-failure-checks


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

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



[GitHub] [pulsar] 315157973 commented on pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#issuecomment-706717524


   /pulsarbot run-failure-checks


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

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



[GitHub] [pulsar] eolivelli commented on a change in pull request #8208: Use ThreadPoolExecutor instead of EventLoop

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #8208:
URL: https://github.com/apache/pulsar/pull/8208#discussion_r500069038



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
##########
@@ -145,6 +147,8 @@ public PulsarClientImpl(ClientConfigurationData conf, EventLoopGroup eventLoopGr
         conf.getAuthentication().start();
         this.cnxPool = cnxPool;
         externalExecutorProvider = new ExecutorProvider(conf.getNumListenerThreads(), getThreadFactory("pulsar-external-listener"));
+        ioExecutorService = new ThreadPoolExecutor(conf.getNumIoThreads(), conf.getNumIoThreads(), 0L, TimeUnit.MILLISECONDS,

Review comment:
       we must shutdown this executor, otherwise we are leaking threads




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

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