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

Andrey Yarovoy updated HDDS-13020:
----------------------------------
    Status: Patch Available  (was: Open)

> The LinkedBlockingQueue in ContainerReportQueue may cause unnecessary 
> contentions between EventExecutors
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HDDS-13020
>                 URL: https://issues.apache.org/jira/browse/HDDS-13020
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: SCM
>    Affects Versions: 1.4.0
>            Reporter: Shangshu Qian
>            Assignee: Andrey Yarovoy
>            Priority: Major
>              Labels: pull-request-available
>
> In the current implementation of `ContainerReportQueue`, the `orderingQueue` 
> is initialized as a `LinkedBlockingQueue`, and the 
> `FixedThreadPoolWithAffinityExecutor` expects a BlockingQueue interface for 
> its internal `workQueues`.
> Using a `LinkedBlockingQueue` introduces unnecessary locking at every queue 
> operation, and could be of low performance. We can substitute it with 
> `ConcurrentLinkedQueue`, which has a much better performance.
> Plus, it seems that we don't really need the blocking behavior of the queue 
> because we would check the remaining capacity even before adding value to the 
> queue. Also, we already holds a lock for this object. There is no need for 
> additional locking.
> {code:java}
>   @Override
>   public boolean add(@NotNull ContainerReport value) {
>     Objects.requireNonNull(value);
>     synchronized (this) {
>       if (remainingCapacity() == 0) {
>         throw new IllegalStateException("capacity not available");
>       }      return addValue(value);
>     }
>   }
> {code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to