[
https://issues.apache.org/jira/browse/CASSANDRA-5581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13662686#comment-13662686
]
Mikhail Mazursky commented on CASSANDRA-5581:
---------------------------------------------
Are you sure? ReadCallback.get() reduces the timeout and then calls await().
await() reduces that timeout once again by the same amount.
{noformat}
public boolean await(long timePastStart, TimeUnit unit)
{
long time = unit.toNanos(timePastStart) - (System.nanoTime() - start);
try
{
return condition.await(time, TimeUnit.NANOSECONDS);
}
catch (InterruptedException ex)
{
throw new AssertionError(ex);
}
}
public TResolved get() throws ReadTimeoutException, DigestMismatchException
{
// SpeculativeReadExecutor may have already called await, using up some
of the timeout
long timeout = TimeUnit.MILLISECONDS.toNanos(command.getTimeout()) -
(System.nanoTime() - start);
if (!await(timeout, TimeUnit.NANOSECONDS))
{
ReadTimeoutException ex = new
ReadTimeoutException(consistencyLevel, received.get(), blockfor,
resolver.isDataPresent());
if (logger.isDebugEnabled())
logger.debug("Read timeout: {}", ex.toString());
throw ex;
}
return blockfor == 1 ? resolver.getData() : resolver.resolve();
}
{noformat}
> Use System.nanoTime() to measure intervals
> ------------------------------------------
>
> Key: CASSANDRA-5581
> URL: https://issues.apache.org/jira/browse/CASSANDRA-5581
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Mikhail Mazursky
> Assignee: Mikhail Mazursky
> Priority: Minor
> Fix For: 2.0
>
> Attachments: 5581-v2.txt, trunk-5581.txt
>
>
> System.nanoTime() should always be prefered to System.currentTimeMillis() to
> measure time intervals. It's not affected by system clock adjustments & drift.
> While testing C* we found that it's very unstable if system clock drifts.
> Problems happen even under low load with tiny dataset. In our case other VMs
> on the same hardware box produced high CPU load and system clock drifted a
> lot in C* VMs. We fixed that but there is definitelly room for improvement in
> C* itself.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira