[Help-gnutls] Performance of gnutls_record_recv(session, &c, 1)?

Nikos Mavrogiannopoulos nmav at gnutls.org
Wed Mar 5 19:31:31 CET 2008

Martin Lambers wrote:
> Hi all,
> Dimitrios Apostolou reported a large performance difference between the
> OpenSSL and GnuTLS versions of mpop, a POP3 client, when querying the
> status of a large POP3 mail box (>70000 messages).
> In this situation, mpop needs to read a large amount of data (size
> listings and UIDs, but not the mails itself). This takes 1m15s with
> GnuTLS and only about 15s with OpenSSL. The 1m15s are completely spent
> at 100% CPU.
> Mpop uses gnutls_record_recv(session, &c, 1) for reading the data, i.e.
> it reads the characters one at a time. It does not do any buffering
> because the TLS library needs to do buffering internally anyway.
> The OpenSSL variant of mpop does the equivalent: SSL_read(ssl, &c, 1).
> Can this performance difference be caused by different TLS session
> parameters? If so, which parameters would that be? 
> Should mpop perform additional buffering and read larger chunks of data
> with gnutls_record_recv()?

Indeed gnutls_record_recv wasn't written for 1 byte reads. Currently it 
has quite an overhead for reading few bytes.


More information about the Gnutls-help mailing list