[ 
https://issues.apache.org/jira/browse/CASSANDRA-13329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksandr Sorokoumov updated CASSANDRA-13329:
---------------------------------------------
    Reviewer: Alex Petrov
      Status: Patch Available  (was: Open)

{{JMXEnabledThreadPoolExecutor}} (used by {{HintsDispatchExecutor}} and 
{{PerSSTableIndexWriter}}) extends {{DebuggableThreadPoolExecutor}}.

According to the docs on {{DebuggableThreadPoolExecutor}} it works in the 
following way:
1. If fewer than corePoolSize threads are running, the Executor always prefers 
adding a new thread rather than queuing.
2. If corePoolSize or more threads are running, the Executor always prefers 
queuing a request rather than adding a new thread.
3. If a request cannot be queued, a new thread is created unless this would 
exceed maximumPoolSize, in which case, the task will be rejected.

In both {{HintsDispatchExecutor}} and {{PerSSTableIndexWriter}}, 
{{JMXEnabledThreadPoolExecutor}} is constructed with corePoolSize equal to 1, 
maximumPoolSize equal to some constant and a work queue being unbounded 
{{LinkedBlockingQueue}}. In that setup when there are no tasks running, the new 
incoming task will add a thread to the pool (according to #1). However, because 
the queue is unbounded, according to #2 all the consequent tasks will be added 
to the queue instead of adding threads to the pool. Having corePoolSize equal 
to maximumPoolSize solves the problem because then the pool will maintain 
maximumPoolSize threads and submit tasks to them before queueing.

*Link to the branch*: https://github.com/Gerrrr/cassandra/tree/13186-3.10

> max_hints_delivery_threads does not work
> ----------------------------------------
>
>                 Key: CASSANDRA-13329
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13329
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Fuud
>            Assignee: Aleksandr Sorokoumov
>              Labels: lhf
>
> HintsDispatchExecutor creates JMXEnabledThreadPoolExecutor with corePoolSize  
> == 1 and maxPoolSize==max_hints_delivery_threads and unbounded 
> LinkedBlockingQueue.
> In this configuration additional threads will not be created.
> Same problem with PerSSTableIndexWriter.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to