user1453345
user1453345

Reputation: 338

How is delay of the akka scheduler?

I wrote an actor, using a scheduler each 5 milliseconds to assign a time stamp to a field.

And in test, I found that the result of (System.currentTimeMillis() - timeField) is at least 35

And if I use a scheduleAtFixedRate() method from the Executors.scheduledThreadPool, the result is right.

So is the scheduler delay has a min value ?

Answer: the default tick duration is 100 milliseconds.

Upvotes: 4

Views: 1539

Answers (2)

Viktor Klang
Viktor Klang

Reputation: 26587

Akka has a fairly extensive documentation.

Here's an excerpt:

"The default implementation of Scheduler used by Akka is based on the Netty HashedWheelTimer. It does not execute tasks at the exact time, but on every tick, it will run everything that is overdue. The accuracy of the default Scheduler can be modified by the “ticks-per-wheel” and “tick-duration” configuration properties. For more information, see: HashedWheelTimers."

Upvotes: 1

Related Questions