Shangshu Qian created HDDS-13020: ------------------------------------ Summary: 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
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 (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org