Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public RWQueueRpcExecutor(final String name, final int handlerCount, final int m
numWriteQueues = calcNumWriters(this.numCallQueues, callqReadShare);
writeHandlersCount = Math.max(numWriteQueues, calcNumWriters(handlerCount, callqReadShare));

int readQueues = calcNumReaders(this.numCallQueues, callqReadShare);
int readQueues = callqReadShare > 0 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the return value of calcNumReaders if callqReadShare is 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If callqReadShare==0, it will not be an instance of RWQueueRpcExecutor, then will not call calcNumReaders. But readQueues will be 0 under other circumstances by the origin design, when the numCallQueues=1 and numWriteQueues=1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "will not call calcNumReaders"? Either in the old code or in your new code, we will always call the calcNumReaders method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I think when callqReadShare is 0, the RpcExecutor will be FastPathBalancedQueueRpcExecutor by default (see SimpleRpcScheduler line 88), not based on RWQueueRpcExecutor(which by default will create FastPathRWQueueRpcExecutor), and then there are not distinguished queues, all queues serve for read and write.

Math.max(1, calcNumReaders(this.numCallQueues, callqReadShare)) :
calcNumReaders(this.numCallQueues, callqReadShare);
int readHandlers = Math.max(readQueues, calcNumReaders(handlerCount, callqReadShare));

int scanHandlers = Math.max(0, (int) Math.floor(readHandlers * callqScanShare));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,16 @@ public void testFifo() {
RpcScheduler rpcScheduler = factory.create(this.conf, null, null);
assertTrue(rpcScheduler.getClass().equals(FifoRpcScheduler.class));
}

@Test
public void testRWQWithSmallCallQueueFactor() {
// Set some configs just to see how it changes the scheduler. Can't assert the settings had
// an effect. Just eyeball the log.
this.conf.setDouble(RWQueueRpcExecutor.CALL_QUEUE_READ_SHARE_CONF_KEY, 0.5);
this.conf.setDouble(RpcExecutor.CALL_QUEUE_HANDLER_FACTOR_CONF_KEY, 0.000001);
this.conf.setDouble(RWQueueRpcExecutor.CALL_QUEUE_SCAN_SHARE_CONF_KEY, 0.5);
RpcSchedulerFactory factory = new SimpleRpcSchedulerFactory();
RpcScheduler rpcScheduler = factory.create(this.conf, null, null);
assertTrue(rpcScheduler.getClass().equals(SimpleRpcScheduler.class));
}
}