[
https://issues.apache.org/jira/browse/HBASE-14331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14736406#comment-14736406
]
Hiroshi Ikeda commented on HBASE-14331:
---------------------------------------
About this patch.
This patch uses {{Semaphore}} based queue instead of {{BlockingQueue}}, unless
{{org.apache.hadoop.hbase.ipc.CallQueueFactories.useBlockingQueue=true}} in the
configuration, which uses adapters from {{BlockingQueue}}, and the property is
just intended for tests.
Also, this patch extends the behavior when a single queue is used:
(1) Even if you uses a single queue, additional single queues for read and scan
also can be used by {{hbase.ipc.server.callqueue.read.ratio}} (default 0,
indicating non-use) and {{hbase.ipc.server.callqueue.scan.ratio}} (default 0),
with distributing handlers by the ratios.
(2) When using a single queue, high priority handlers to deal with admin
requests, etc. also uses a just single queue. (You are using a single queue
because you think it is enough, don't you ?)
How many queues you uses is multiplied
{{hbase.ipc.server.callqueue.handler.factor=<float>}} (default 0) by
{{hbase.regionserver.handler.count=<number>}} (default 30) and if the result is
less than 2, a single queue is used for ordinary requests.
Calculating the distributed counts of queues and handlers for write/read/scan
is a little changed and it may a bit increase the sum of them as necessary
(instead of adjusting between write/read/scan. An existing class actually
contained bugs and unexpected logic).
{{org.apache.hadoop.hbase.util.Counter}} is used for counting the handlers to
simultaneously executing tasks. That is because incrementing and decrementing
the counter for each task may cause overhead (while I have been trying to
reduce such overhead by this issue !)
In order to shut out {{BlockingQueue}} from {{RpcExecutor}} I added a new
abstract package private class {{BlockingQueueRpcExecutor}}. One cannot easily
remove the protected methods because they are exposed to Coprocessor and
Phoenix via {{RWQueueRpcExecutor}} and {{BalancedQueueRpcExecutor}}.
> a single callQueue related improvements
> ---------------------------------------
>
> Key: HBASE-14331
> URL: https://issues.apache.org/jira/browse/HBASE-14331
> Project: HBase
> Issue Type: Improvement
> Components: IPC/RPC, Performance
> Reporter: Hiroshi Ikeda
> Assignee: Hiroshi Ikeda
> Priority: Minor
> Attachments: BlockingQueuesPerformanceTestApp-output.pdf,
> BlockingQueuesPerformanceTestApp-output.txt,
> BlockingQueuesPerformanceTestApp.java, CallQueuePerformanceTestApp.java,
> HBASE-14331-V2.patch, HBASE-14331.patch, HBASE-14331.patch,
> SemaphoreBasedBlockingQueue.java, SemaphoreBasedLinkedBlockingQueue.java,
> SemaphoreBasedPriorityBlockingQueue.java
>
>
> {{LinkedBlockingQueue}} well separates locks between the {{take}} method and
> the {{put}} method, but not between takers, and not between putters. These
> methods are implemented to take locks at the almost beginning of their logic.
> HBASE-11355 introduces multiple call-queues to reduce such possible
> congestion, but I doubt that it is required to stick to {{BlockingQueue}}.
> There are the other shortcomings of using {{BlockingQueue}}. When using
> multiple queues, since {{BlockingQueue}} blocks threads it is required to
> prepare enough threads for each queue. It is possible that there is a queue
> starving for threads while there is another queue where threads are idle.
> Even if you can tune parameters to avoid such situations, the tuning is not
> so trivial.
> I suggest using a single {{ConcurrentLinkedQueue}} with {{Semaphore}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)