Darrel Schneider created GEODE-6891:
---------------------------------------
Summary:
ClusterDistributionManager.SerialQueuedExecutorPool.getThrottledSerialExecutor
has some problems
Key: GEODE-6891
URL: https://issues.apache.org/jira/browse/GEODE-6891
Project: Geode
Issue Type: Bug
Components: messaging
Reporter: Darrel Schneider
The getThrottledSerialExecutor has the following issues:
1. It reads that stat: DistributionStats.getSerialQueueBytes(). If stats are
disabled then the throttling would be disabled. Someone needs to maintain this
value in a local atomic.
2. It reads the stat in three different places. One of those is outside the
loop but that seems wrong. Each time it is used inside the loop to calculate
how long to sleep it should be using the current value.
3. It is compared against two different constants. To get in the loop it must
be greater than TOTAL_SERIAL_QUEUE_THROTTLE. To exit the loop it must be >= to
TOTAL_SERIAL_QUEUE_BYTE_LIMIT. This seems wrong but it might be correct.
4. The constant TOTAL_SERIAL_QUEUE_THROTTLE is calculated from
SERIAL_QUEUE_BYTE_LIMIT. This looks like a copy and past mistake. I think it
should be TOTAL_SERIAL_QUEUE_BYTE_LIMIT
5. It looks like the intent of this code is to block message senders if we
currently have more than TOTAL_SERIAL_QUEUE_BYTE_LIMIT message bytes queued up
for sending. But the whole sleep calculation is scary. If we want this
throttling then it seems like instead of sleeping we should wait until we see
the value go below a threshold. We can make this event driven since it is our
code that will decrement the value as messages are removed from the queue.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)