Replies: 5 comments
-
Does Java scheduler accept nanos? |
Beta Was this translation helpful? Give feedback.
-
I'm no expert, but I'd generally expect that attempting to wait for a fraction of millisecond will be futile. The actual time waited is likely to be much longer, because of inaccuracies of system clocks. |
Beta Was this translation helpful? Give feedback.
-
We might explore throttling in the future. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply, looking forward to it. What I do for now is skipping the delay every X amount of events. For example, delay 1 ms every 10 events (each event is 0.1ms delay on average) to achieve 10,000 TPS. It is not perfect, but at least it's close to what we need. |
Beta Was this translation helpful? Give feedback.
-
At the mean time, do you think we need to change the scheduler to accept nano? The problem is Although I agree with @Ladicek that system clock will not be accurate as we goes down fraction of milliseconds. But at least it's not 0ms if user set anything smaller than 1ms. |
Beta Was this translation helpful? Give feedback.
-
I'm attempting to implement some kind of throttling at high throughput.
For example, In order to throttle to 10,000 transaction per second (TPS), I will need to add a small delay of 0.1ms in between each event. 0.05ms to get 20k TPS and so on.
Delaying with
Duration.ofNanos
doesn't seem to work.I suspect this might be why. Any duration smaller than 1ms will simply be converted to 0.
However, changing the scheduler to accept nano second time unit present another problem where the scheduler cannot process it accurately.
Any idea what I can do?
Beta Was this translation helpful? Give feedback.
All reactions