[
https://issues.apache.org/jira/browse/CASSANDRA-8457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14249940#comment-14249940
]
Benedict commented on CASSANDRA-8457:
-------------------------------------
bq. The only way to avoid it is to lock while checking the queue empty
condition and updating the needs wakeup field, or to have a 1:1 mapping between
sockets and dispatch threads (AKA not SEP). This would force producers to lock
on task submission as well. I don't see how the dispatch task can atomically
check that there is no work to do and set the needs wakeup flag at the same
time. At that point is there a reason to use a lock free queue?
{code}
private Runnable dispatchTask = new Runnable() {
@Override
public void run() {
while (true)
{
while (!backlog.isEmpty())
dispatchQueue();
needsWakeup = true;
if (backlog.isEmpty() ||
!needsWakeupUpdater.compareAndSet(OutboundTcpConnection.this, TRUE, FALSE))
return;
}
}
};
{code}
> nio MessagingService
> --------------------
>
> Key: CASSANDRA-8457
> URL: https://issues.apache.org/jira/browse/CASSANDRA-8457
> Project: Cassandra
> Issue Type: New Feature
> Components: Core
> Reporter: Jonathan Ellis
> Assignee: Ariel Weisberg
> Labels: performance
> Fix For: 3.0
>
>
> Thread-per-peer (actually two each incoming and outbound) is a big
> contributor to context switching, especially for larger clusters. Let's look
> at switching to nio, possibly via Netty.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)