[gnutls-devel] Automatic library initialization

Tim Ruehsen tim.ruehsen at gmx.de
Mon Nov 16 14:39:04 CET 2015


On Monday 16 November 2015 11:27:23 Jeremy Harris wrote:
> On 11/11/15 10:33, Nikos Mavrogiannopoulos wrote:
> > On Tue, Nov 10, 2015 at 4:23 PM, Tim Ruehsen <tim.ruehsen at gmx.de> wrote:
> >> an executable, dynamically linked with GnuTLS, automatically calls
> >> gnutls_global_init(). And thus (in my case) eats up 60x more CPU cycles
> >> than needed.
> >> The executable only needs GnuTLS under some conditions (TLS connection
> >> requested). In this case it 'manually' calls gnutls_global_init().
> > 
> > There is the undocumented env variable GNUTLS_NO_EXPLICIT_INIT. If you
> > set it to 1 you disable the use of constructor and destructors to load
> > gnutls.
> 
> Question: in a forking server will the initialisation cost be paid only
> at service start, and not per-worker?  Is this a valid model for GnuTLS?

On Linux, cost will be only once at service start.
This is true for automatic init and for manual init (assuming that a forking 
server would call gnutls_global_init() before calling fork()).

Regards, Tim



More information about the Gnutls-devel mailing list