[
https://issues.apache.org/jira/browse/CASSANDRA-4292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423951#comment-13423951
]
Yuki Morishita commented on CASSANDRA-4292:
-------------------------------------------
Here's the code for choosing disk from attached patch.
{code}
// DiskWriter.java
private ExecutorService selectExecutor(DiskBoundTask task)
{
// sort by available disk space
SortedSet<DiskBoundTaskExecutor> executors;
synchronized (perDiskTaskExecutors)
{
executors = ImmutableSortedSet.copyOf(perDiskTaskExecutors);
}
// if there is disk with sufficient space and no activity running on it,
then use it
for (DiskBoundTaskExecutor executor : executors)
{
long spaceAvailable = executor.getEstimatedAvailableSpace();
if (task.getExpectedWriteSize() < spaceAvailable &&
executor.getActiveCount() == 0)
return executor;
}
// if not, use the one that has largest free space
if (task.getExpectedWriteSize() <
executors.first().getEstimatedAvailableSpace())
return executors.first();
else
return task.recalculateWriteSize() ? selectExecutor(task) : null; //
retry if needed
}
{code}
Before choosing disk, we sort by available disk space, but then choose the one
that 1) fits for new sstable and 2) has zero task.
If we cannot find, then 3) we choose the one with largest free space.
So I think above code works as you described.
> Per-disk I/O queues
> -------------------
>
> Key: CASSANDRA-4292
> URL: https://issues.apache.org/jira/browse/CASSANDRA-4292
> Project: Cassandra
> Issue Type: Improvement
> Components: Core
> Reporter: Jonathan Ellis
> Assignee: Yuki Morishita
> Fix For: 1.2
>
> Attachments: 4292-v2.txt, 4292.txt
>
>
> As noted in CASSANDRA-809, we have a certain amount of flush (and compaction)
> threads, which mix and match disk volumes indiscriminately. It may be worth
> creating a tight thread -> disk affinity, to prevent unnecessary conflict at
> that level.
> OTOH as SSDs become more prevalent this becomes a non-issue. Unclear how
> much pain this actually causes in practice in the meantime.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira