[PATCH] Use clock_gettime(REAL_FAST) on DragonFlyBSD

Maxim Dounin mdounin at mdounin.ru
Thu Jun 2 15:05:49 UTC 2016


On Thu, Jun 02, 2016 at 08:48:19PM +0800, Sepherosa Ziehau wrote:

> On DragonflyBSD only clock_gettime(*_FAST) avoids system call and time
> counter read cost (kinda like Linux VDSO).  This gives some
> improvement for performance and reduces latency.

At least FreeBSD also has clock_gettime(*_FAST), from where it was 
taken to DragonFly BSD.  And Linux 2.6.32+ has 

We do have plans to use monotonic versions, see 

> My testing setup consists two clients and one nginx (recent head code)
> server, two clients connected to the nginx server through two 10Ge
> (82599).  15K concurrent connections from each client; client runs a
> modified version of wrk and each connection only carries one request
> for an 1KB file.
> Performance goes from 183Kreqs/s to 184Kreqs/s (admittedly pretty
> minor).  Average latency reduces 2ms (98ms -> 96ms).  Latency stdev
> reduces 6ms (198ms -> 192ms).

This doesn't look statistically significant.  Have you tried 
something like ministat(1) to test the results?

Note that nginx only uses gettimeofday() once per event loop 
iteration, so I wouldn't expect it to make measureable difference.


Maxim Dounin

More information about the nginx-devel mailing list