Re: Unnecessary connection overhead due copy-on-write (mainly openssl)

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Unnecessary connection overhead due copy-on-write (mainly openssl)
Дата
Msg-id 03fd56b7-9547-42cb-9d7f-73f4be48f837@eisentraut.org
обсуждение исходный текст
Ответ на Unnecessary connection overhead due copy-on-write (mainly openssl)  (Andres Freund <andres@anarazel.de>)
Ответы Re: Unnecessary connection overhead due copy-on-write (mainly openssl)
Список pgsql-hackers
On 05.06.25 21:58, Andres Freund wrote:
> The reason for this difference is that by default openssl registers an atexit
> handler that frees a lot of memory that was initialized in postmaster. That in
> turn triggers page-faults due to the relevant pages now differing in child
> processes. Which a) isn't cheap b) causes contention with postmaster, since
> those datastructures are shared.
> 
> 
> It's possible to tell openssl to not register an atexit handler, see [2]:
> 
>> OPENSSL_INIT_NO_ATEXIT
>>    By default OpenSSL will attempt to clean itself up when the process exits via
>>    an "atexit" handler. Using this option suppresses that behaviour. This means
>>    that the application will have to clean up OpenSSL explicitly using
>>    OPENSSL_cleanup().

It seems weird to me that openssl spends so much effort tidying up its 
memory allocations just before exiting.  We could just skip that. 
Looking through the code of OPENSSL_cleanup(), there might be one or two 
cases of log or trace files that get flushed during cleanup, so it's not 
an absolute no-brainer to skip all the cleanup.




В списке pgsql-hackers по дате отправления: