Hello,
currently, I am writing my master thesis on benchmarking different TLS libraries on their response time.
Basically, I measure the time on TCP level that the TLS server takes to respond to client messages for different cipher suites and handshake flows (normal, with resumption, with OCSP, etc.)
During my testing, I observed up to 30x longer response times for the first ServerHello message when using the WolfSSL server example for TLS1.2 cipher suites with DHE key exchange compared to ECDHE key exchange. I didn't see that behaviour with other libraries (like openssl).
Also, when using the DHE cipher suites for a resumption handshake, the time consumption is only high for resumption with session ID but not for resumption with session ticket.
Below I listed some details on the testsetup and testresults. The given values are the average response time of 1000 test repetitions.
The results are also visualized here https://wg.sebastianhahn.net/nextcloud/ … 7oCndHMHob. I also marked the details in a wireshark log for comparison: https://wg.sebastianhahn.net/nextcloud/ … aQZLBXtQZ8 (this wireshark log file only shows two repetitions to keep it managable - actual .pcap file is here: https://wg.sebastianhahn.net/nextcloud/ … rkxYisLYam)
Test Setup
wolfssl-5.7.2, configured with ./configure --enable-all
Usage of ./example/server/server -p 4444 -v 3 -c <RSA2048 CERT> -k <RSA2048 KEY> -d -i -f
TLS library for comparison was OpenSSL 3.3.1: ./openssl s_server -cert <RSA2048 CERT> -key <RSA2048 KEY> -port 4455
client and server are both running on local machine
Performed 1000 TLS handshakes for each testcase to derive statistical metrics
Results for Time Consumption of Server Response to ClientHello*
* when using a resumption handshake, we also only care about the first time the server responds to client hello / for the resuming handshake, the server response time was - as expected - always very low
Testcase: TLSv1.2, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, normal handshake
Testcase: TLSv1.2, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, Session Resumption with Session ID
Testcase: TLSv1.2, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, Session Resumption with Session Ticket
For comparison I did the same tests just using ECDHE instead of DHE for the key exchange. Here I don't see any significant difference either between OpenSSL and WolfSSL or within WolfSSL between no resumption or with session ID or ticket.
Testcase: TLSv1.2, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, normal handshake
Testcase: TLSv1.2, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, Session Resumption with Session ID
Testcase: TLSv1.2, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, Session Resumption with Session Ticket
It seems like that the time delay is dependent on the key exchange as we don't see it with ECDHE.
But I also find it interesting that the delay is only happening for DHE if we have no resumption or a resumption with session ID. The difference between those cases and resumption with session ticket could be how the session is treated. When using session tickets the session is usually considered stateless. But I am not sure whether this influences the internal statemachine of wolfSSL in any way that also affects the response times.
I would be very much interested whether others have seen similar artifacts.
It would be interesting to understand why this is happening and whether I should use the server example differently.
Thanks a lot!
Leonie