kafka-jira mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Koen De Groote (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KAFKA-5930) Decide on consistent method for determining elapsed time.
Date Tue, 19 Sep 2017 10:24:00 GMT
Koen De Groote created KAFKA-5930:
-------------------------------------

             Summary: Decide on consistent method for determining elapsed time.
                 Key: KAFKA-5930
                 URL: https://issues.apache.org/jira/browse/KAFKA-5930
             Project: Kafka
          Issue Type: Improvement
            Reporter: Koen De Groote
            Priority: Minor


First ticket.

Going over the code a bit, I see mixed usage of System.currentTimeMillis and System.nanoTime,
all with the purpose of determining elapsed time.

For instance: https://github.com/apache/kafka/blob/trunk/tools/src/main/java/org/apache/kafka/tools/ThroughputThrottler.java#L104

As opposed to:
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/internals/KafkaFutureImpl.java#L98

The majority right now is currentTimeMillis.

That being said, there's a question of what is most important: precision or speed.

When looking this up, most of the results are StackOverFlow pages: https://stackoverflow.com/questions/19052316/why-is-system-nanotime-way-slower-in-performance-than-system-currenttimemill

And:
https://stackoverflow.com/questions/351565/system-currenttimemillis-vs-system-nanotime

Summary: nanotime is slower(might take microseconds to execute), but more precise, but not
threadsafe.

currentTimeMillies is faster, perhaps less accurate but thread safe.

Should something be done here or is this a non-issue?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message