I've came to the conclusion that the performance drop that I am seeing is due to WebSocket++ or (let me not rush to conclusions)
the way I am using it.
Here are the results that I am getting:
All server programs were located on the same Windows Server 2012 OS machine.
All client programs were run from the same Windows 7 OS machine. Both machines are on the same LAN.
Boost version used was 1.54.0, while OpenSSL version was 1.0.0i.
Boost servers were asynchronous and minimally adapted from Boost cpp03 examples.
WebSocket++ servers were echo_server and echo_server_tls, minimally adapted in the same way.
This adaptation involves reading just one 32 bit integer, incrementing it and sending it back right away.
WebSocket++ clients were developed from WebSocket++ samples and boost clients were cast in the same mold to make
client code as similar as possible.
All clients send one integer, as soon as connection gets established, then use a high performance timer,
from boost chrono library, to measure the time it takes to receive the number bigger by 1 than the one just sent.
Note, however, that this adaptation to incrementing integer is irrelevant for the tests performed.
Tests involved a single client, running Boost io_service on just one thread, talking to a single server.
In the case of boost this was done like so:
asioThread_ = boost::thread([this](){ io_service_.run();});
and in the case of WebSocket++ client like so:
asioThread_ = websocketpp::lib::thread(&client::run, &client_);
WebSocket++ clients and servers had logging suppressed like so:
client_.clear_access_channels(websocketpp::log::alevel::all);
client_.clear_error_channels(websocketpp::log::elevel::all);
Representative results for boost client/server combination, standard sockets, with no SSL:
Roundtrip took 510188 nanoseconds
Roundtrip took 521993 nanoseconds
Roundtrip took 476312 nanoseconds
Roundtrip took 519941 nanoseconds
Roundtrip took 471180 nanoseconds
Roundtrip took 504542 nanoseconds
Roundtrip took 473747 nanoseconds
Results for boost client/server combination, standard sockets, with OpenSSL:
Roundtrip took 727814 nanoseconds
Roundtrip took 717549 nanoseconds
Roundtrip took 716522 nanoseconds
Roundtrip took 667248 nanoseconds
Roundtrip took 682647 nanoseconds
Roundtrip took 746291 nanoseconds
Roundtrip took 692912 nanoseconds
Results for WebSocket++ client, echo_server combination, with no SSL (ws protocol):
Roundtrip took 931581 nanoseconds
Roundtrip took 970590 nanoseconds
Roundtrip took 970590 nanoseconds
Roundtrip took 1139968 nanoseconds
Roundtrip took 1001386 nanoseconds
Roundtrip took 919776 nanoseconds
Roundtrip took 1066571 nanoseconds
Results for WebSocket++ client, echo_server_tls combination, with OpenSSL (wss protocol):
Roundtrip took 263297234 nanoseconds
Roundtrip took 254142586 nanoseconds
Roundtrip took 264079454 nanoseconds
Roundtrip took 252430324 nanoseconds
Roundtrip took 263652929 nanoseconds
Roundtrip took 253435302 nanoseconds
Roundtrip took 246399939 nanoseconds
I don't know what to make of the last result. I would expect the same kind of overhead that
you see when comparing standard and WebSockets with no SSL, which is about the factor of 2.
But a factor of 250?!
It is good news that Boost asio, with OpenSSL, doesn't seem to be the issue. With the going rate
of maintenance of these libraries, any deep problem would be hard to get fixed quickly.
I tried some profiling but at this point I am getting way too much information to parse.
I will need to make educated guesses and concentrate on the parts of code, in order to
start seeing some clues in profiler reports.
Some dumb user (that is, my) error is still not excluded, of course.
Any suggestions appreciated.