Re: [chrony-dev] nts_ke_server calling UTI_GetRandomBytesUrandom

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


mlichvar@xxxxxxxxxx said:
> I was surprised to see they switched arc4random in glibc to getrandom(). That
> has a significant performance impact on chronyd, as it calls the function for
> each generated RX and TX timestamp. In my 

NTPsec uses OpenSSL and their crypto package.  I noticed significant CPU going 
into randomness.  On investigation, there is high overhead.  The cycles per 
byte isn't horrible for longer chunks.  It's things like calling getpid() 
called during setup.

I've contemplated using a big buffer.  Fill it with one call to amortize the 
overhead.  Pass out small chunks as needed.  I haven't written any code.

-------

The code I use to poke around is in attic/random.c

Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz

Running on OpenSSL 3.0.5 5 Jul 2022
 times in ns         avg  fastest  lng
getpid():            389            (simple kernel call)
clock_gettime:        19            (overhead of fastest)
random():             18       36
RAND_bytes():       2122     2038    4
RAND_bytes():       2110     2041   16
RAND_bytes():       2363     2231   32
RAND_bytes():       2720     2628  160
RAND_bytes():       3090     2980  320
RAND_priv_bytes():  2120     2034    4
RAND_priv_bytes():  2107     2025   16
RAND_priv_bytes():  2326     2231   32
RAND_priv_bytes():  2732     2625  160
RAND_priv_bytes():  3107     2981  320


-- 
These are my opinions.  I hate spam.




-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/