If every TLS message has to be encrypted / decrypted by both hosts involved in the secure connection, is this consuming a lot of CPU time?
I believe the website "Is TLS Fast Yet" https://istlsfastyet.com can answer your question. Here's a quote from the top of the page:
"On our production frontend machines, SSL/TLS accounts for less than 1% of the CPU load, less than 10 KB of memory per connection and less than 2% of network overhead. Many people believe that SSL/TLS takes a lot of CPU time and we hope the preceding numbers will help to dispel that." -- Adam Langley, Google
Just performed some tests on single board ARM CPU PC: As many web questions I stumbled, also here the answer is "it depends". I tested with AB (Apache Benchmark) from PC on same network and just HTTP1.1 (do not have HTTP2 due to old Linux/Apache version)
So... if KeepAlive is disabled- performance is really bad. CPU load is high.
If AB uses KeepAlive and Apache uses KeepAlive 5 or 10- performance is still bad. Still high CPU load.
If KeepAlive is insane high 200... performance is acceptable.
So if domain sharding is used, the HTTPS performance is bad. If just one domain is used with high keepalive than the performance is acceptable.
First handshake to establish the connection makes the difference.
And yes HTTPS is like taking taking medicine if you are cold, but having to travel to next city. If you have to go for every pill to the next city and ask for directions to the next open pharmacy- it hurts you more. If you take the pack- it is acceptable.
p.s. I guess that the ARM CPU does not have hardware acceleration for the encryption or it is not enabled. It is like the CPU software rendering of games vs the GPU cores vs dedicated graphic card.
No matter how fast your systems are: Time == Money. CPU Time == CPU Money
The issue is not as much "is encryption under TLS or SSL fast" but rather "how much processor do you have to spare?".
AES encryption (used in TLS) is computationally intensive and expensive. As an answer points out here "SSL/TLS accounts for less than 1% of the CPU load". If, for example, it accounted for (being generous) 0.5% of the CPU load and the system had 199 simultaneous TLS connections being processed, the 200th one would have to wait because the processor was maxed out.
But 200 is not really a realistic number of connections... Lets say you are in the top web sites in the world... say in the top 0.1%, up there with NASA during Xmas, the IRS around April 15 or just an average day on CNN's web site. You are talking somewhere well beyond 70,000,000 HTTPS connections (hits) a day. So lets do the math...
70,000,000 HTTPS connections (hits) a day is 2,916,666 hits an hour 48,611 hits a minute 810 hits a second.. a hit is a file download...
So if that system is using HTTPS instead of HTTP and we give the encryption the benefit of the doubt that it is only 0.5% processor load then...
That means that you to handle the same traffic at the same load factor we need to increase the capacity of the system to handle... 0.5% * 810 is 4.05 hits per second or 0.5% * 48,611 is 243 hits per minute or 0.5% * 2,916,666 is 14,583 hits per hour 0.5% * 70,000,000 is 350,000 hits per day
The cost is 350,000 hits per day the extra capacity needed to use HTTPS.
This translates in architectural terms into adding extra SSL/TLS accelerator CPUs to keep the load off the actual web servers. And of course, any reasonable hosting architecture has to have redundancy so multiply the SSL/TLS accelerator box cost times 2, then stir in both human support costs and tech refresh costs to adequately maintain your HTTPS
Now consider if this is all for non-authenticated access... nothing that required encryption to keep it private... (like free news or sales and marketing material) then you just wasted your money and time with HTTPS vs unencrypted HTTP.
What makes more sense is to encrypt that which needs to be secure (logins, connections to restricted or private content) and leave the rest that need not be secured, unencrypted.
Arbitrarily using HTTPS for public data is like taking an antibiotic each time you get a cold... WebMD Cold Guide