I'm setting up a load testing solution, and as I've been reading through JMeter's docs, I see that you can set numerous properties for test plans. I've got tests already running just fine and producing results, graphs, etc., but as I tried to gain a more in-depth understanding of JMeter and accuracy of results and such, I come across the blurb below.
From JMeter's documentation, I read the following:
# Whether to use System.nanoTime() - otherwise only use System.currentTimeMillis()
sampleresult.useNanoTime=true
# Use a background thread to calculate the nanoTime offset
# Set this to <= 0 to disable the background thread
sampleresult.nanoThreadSleep=5000
Now, I understand that nanotime
is going to be based off of a fixed, but arbitrary, origin time, whereas currenttimeinmillis
is based off of system time (i.e., wallclock). And I know that nanotime
is going to be more precise, which is why I'm interested in using it: I'm doing load testing and need the response time measurements to be as accurate and precise as possible.
But the issue I'm having is understanding how to use nanoThreadSleep
. What exactly is a nanotime offset? Why would i want, or not want, a background thread to calculate the nanotime offset? What happens if I enable JMeter to run using nanotime, but don't use the nanoThreadSleep
setting explicitly?
I've searched StackOverflow and Google for some sort of explanation, but I cannot find one other than what JMeter's docs say about it in the tiny blurb I pasted here. Can others help me in understanding this and how I can use it correctly and effectively?