I created a simple server client using Asio (non-Boost), and am using it for a simple test of data transfer speed.
Server:
- Create buffer (4 MB)
- When a client connects (callback from
async_accept
)- Start timer
- Send buffer to client (
async_write
) - Wait for response from client (callback from
async_read
) - Repeat step 2-3 100 times
- Stop timer
- Calculate transfer speed (100 * buffer size * 8 / time)
Client
- Connect to server
- Wait for data from server (callback from
async_read
) - Send a single byte back to server (
async_write
) - Repeat
- Wait for data from server (callback from
I have implemented this both with and without SSL/TLS encryption. The non-secure version achieves speeds at around 15.0 Gbps through localhost, but the encrypted version slows way down to about 0.3 Gbps.
Is this expected? If not, any ideas what could be causing this?