bn_sqr8x_internal function consumes a lot of CPU time

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

bn_sqr8x_internal function consumes a lot of CPU time

Thang Pham
Dear all,

I do not know if it is legitimate to ask this question here, but maybe
you guys can help.

We have a service running behind nginx that using HTTPS. Recently the
CPU utilization has raised to 100%, and using perf we see that nginx's
using ~69% of CPU time. Inside nginx, bn_sqr8x_internal uses 32% of
total CPU time (and mul4x_internal uses 11%).

All information I could find about bn_sqr8x_internal is that it belongs
to bignum library in libcrypto(?). There is an idea here, that tells
that they belong to handshake step, but it's BoringSSL, so I'm not sure
if it's my case.

Could anyone please tell me what is nginx/libcrypto/libssl doing with
this function, so I can find a clue to optimize the server?

Thank you very much,

--

Thang

Reply | Threaded
Open this post in threaded view
|

Re: bn_sqr8x_internal function consumes a lot of CPU time

Patrick Steuer
Its an x86_64 assembly subroutine of bn_mul_mont which implements
montgomery modular multiplication. Its heavily used in rsa comutations.

Just set a breakpoint in the debugger and have a look at the callstack.