views:

14750

answers:

15

Are there any major differences in performance between http and https? I seem to recall reading that https can be up to 1/5 times slower than http. Is this valid with the current generation webservers/browsers? If so, are there any whitepapers to support it?

A: 

This is almost certainly going to be true given that SSL requires an extra step of encryption that simply isn't required by non-SLL HTTP.

Orion Adrian
What is certainly true?
Sklivvz
That there is a difference in performance between the two cases.
David The Man
But the quesiton is "Are there any **major** differences in performance between http and https?"
Sklivvz
A: 

HTTPS has encryption/decryption overhead so it will always be slightly slower. SSL termination is very CPU intensive. If you have devices to offload SSL, the difference in latencies might be barely noticeable depending on the load your servers are under.

Corey Goldberg
A: 

There is overhead in HTTPS due to the packets being encrypted. I don't think the overhead is 80% though. The rule of thumb is to only use HTTPS for security critical sections of your website (credit card processing, private data exchange, etc.)

Mike Brown
A: 

There is an overhead involved, and therefore a performance penalty is imposed. As for roughly how slower or faster, I can't be sure of that.

ayaz
A: 

A more important performance difference is that an HTTPS session is ketp open while the user is connected. An HTTP 'session' lasts only for a single item request.

It you are running a site with a large number of concurrent users, expect to buy a lot of memory.

Martin Beckett
Non in HTTP 1.1. Connections are left open for a long time.
Sklivvz
A: 

There is a way to measure this. The tool from apache called jmeter will measure throughput. If you set up a large sampling of your service with jmeter, in a controlled environment, with and without SSL, you should get an accurate comparison of the relative cost. I would be interested in your results.

dacracot
+38  A: 

There's a very simple answer to this... Profile the performance of your web server to see what the performance penalty is for your particular situation. There are several tools out there to compare the performance of an HTTP vs HTTPS server (JMeter and Visual Studio come to mind) and they are quite easy to use.

No one can give you a meaningful answer without SOME information about the nature of your web site, hardware, software, and network configuration.

As others have said, there will be some level of overhead due to encryption, but it is highly dependent on:

  • Hardware
  • Sever software
  • Ratio of dynamic vs static content
  • Client distance to server
  • Typical session length
  • Etc (my personal favorite)
  • Caching behavior of clients

In my experience, servers that are heavy on dynamic content tend to be impacted less by HTTPS because the time spent encrypting (SSL-overhead) is insignificant compared to content generation time.

Servers that are heavy on serving a fairly small set of static pages that can easily be cached in memory suffer from a much higher overhead (in one case, throughput was havled on an "intranet").

Edit: One point that has been brought up by several others is that SSL handshaking is the major cost of HTTPS. That is correct, which is why "typical session length" and "caching behavior of clients" are important.

Many, very short sessions means that handshaking time will overwhelm any other performance factors. Longer sessions will mean the handshaking cost will be incurred at the start of the session, but subsequent requests will have relatively low overhead.

Client caching can be done at several steps, anywhere from a large-scale proxy server down to the individual browser cache. Generally HTTPS content will not be cached in a shared cache (though a few proxy servers can exploit a man-in-the-middle type behavior to achieve this). Many browsers cache HTTPS content for the current session and often times across sessions. The impact the not-caching or less caching means clients will retrieve the same content more frequently. This results in more requests and bandwidth to service the same number of users.

James Schek
James, was hoping you might be able to provide a brief commentary on the comparative speed of this aSSL solution: http://assl.sullof.com/assl/Off the top of your head, is there anything gained performance-wise? Thanks!
Matt Gardner
PS: It's my understanding that this solution requires a client side key (which could be implemented in the case of a webkit/titanium app), the goal is simply to maximize this component of the speed equation along with the others you mentioned.
Matt Gardner
Sorry if this has been covered, but there are h/w solutions available for severely impacted servers, see http://en.wikipedia.org/wiki/SSL_acceleration and I note Microsoft has been working with IHVs on "SSL Chimney" which allows the NIC to 'do the math'. Apparently the SSL overhead affects busy Exchange Servers, too.
Luke Puplett
+1  A: 

There isn't a single answer for this.

Encryption will always consume more CPU. This can be offloaded to dedicated hardware in many cases, and the cost will vary by algorithm selected. 3des is more expensive than AES, for example. Some algorithms are more expensive for the encrypter than the decryptor. Some have the opposite cost.

More expensive than the bulk crypto is handshake cost. New connections will consume much more CPU. This can be reduced with session resumption, at the cost of keeping old session secrets around until they expire. This means that small requests from a client that doesn't come back for more are the most expensive.

For cross internet traffic you may not notice this cost in your data rate, because the bandwidth available is too low. But you will certainly notice it in CPU usage on a busy server.

Darron
+25  A: 

HTTPS requires an initial handshake which can be very slow. The actual amount of data transferred as part of the handshake isn't huge (under 5 kB typically), but for very small requests, this can be quite a bit of overhead. However, once the handshake is done, a very fast form of symmetric encryption is used, so the overhead there is minimal. Bottom line: making lots of short requests over HTTPS will be quite a bit slower than HTTP, but if you transfer a lot of data in a single request, the difference will be insignificant.

However, keepalive is the default behaviour in HTTP/1.1, so you will do a single handshake and then lots of requests over the same connection. This makes a significant difference for HTTPS. You should probably profile your site (as others have suggested) to make sure, but I suspect that the performance difference will not be noticeable.

Graeme Perrow
It turns out this handshaking cost will be paid about 4-10x per session, at minimum, due to most browsers using multiple connections to the same server. Depending on how long the https-keep-alive is for a browser, it may be incurred repeatedly during a session.
James Schek
regarding HTTP keepalive feature, we have experienced the scenario where the connections are not staying persistent. For each request the request connection is being built and teared down-meaning MA-SSL handshake. There are possibilities wherein the client or server may have configured to closing the connections. Typically occurs in Tomcat/Websphere environments.
zkarthik
+1  A: 

I can tell you (as a dialup user) that the same page over SSL is several times slower than via regular HTTP...

Brian Knoblauch
+5  A: 

In addition to everything mentioned so far, please keep in mind that some (all?) web browsers do not store cached content obtained over HTTPS on the local hard-drive for security reasons. This means that from the user's perspective pages with plenty of static content will appear to load slower after the browser is restarted, and from your server's perspective the volume of requests for static content over HTTPS will be higher than would have been over HTTP.

Alexander
+16  A: 

The overhead is NOT due to the encryption. On a modern CPU, the encryption required by SSL is trivial.

The overhead is due to the SSL handshakes, which are lengthy and drastically increase the number of round-trips required for a HTTPS session over a HTTP one.

Measure (using a tool such as Firebug) the page load times while the server is on the end of a simulated high-latency link. Tools exist to simulate a high latency link - for Linux there is "netem". Compare HTTP with HTTPS on the same setup.

The latency can be mitigated to some extent by:

  • Ensuring that your server is using HTTP keepalives - this allows the client to reuse SSL sessions, which avoids the need for another handshake
  • Reducing the number of requests to as few as possible - by combining resources where possible (e.g. .js include files, CSS) and encouraging client-side caching
  • Reduce the number of page loads, e.g. by loading data not required into the page (perhaps in a hidden HTML element) and then showing it using client-script.
MarkR
+10  A: 

To really understand how HTTPS will increase your latency, you have to understand how HTTPS connections are established. Here is a nice diagram. The key is that instead of the client getting the data after 2 "legs" (you send a request, the server sends a response), the client won't get data until at least 5 legs. So, if it takes 100 ms for a packet to move between the client and the server, your first HTTP request will take at least 500 ms.

Of course, this can be mitigated by re-using the HTTPS connection (which browsers should do), but it does explain part of that initial stall when loading up an HTTPS web site.

twk
+1 for the nice diagram link
Mohit Nanda
+4  A: 

The current top answer is not fully correct. As others have pointed out here, https requires handshaking and therefore does more tcpip roundtrips. In a WAN environment typically then the latency becomes the limiting factor and not the increased CPU usage on the server. Just keep in mind that the latency from Europe to the US can be around 200ms (torundtrip time).

you can easily measure this (for the single user case) with HTTPWatch

kohlerm
+3  A: 

In a number of cases the performance impact of SSL handshakes will be mitigated by the fact that the SSL session can be cached on both ends (desktop and server). On Windows machines for example the SSL session can be cached for up to 10 hours. See http://support.microsoft.com/kb/247658/EN-US . Some SSL accelerators will also have parameters allowing you to tune the time the session is cached.

Another impact to consider is that static content served over HTTPS will not be cached by proxies, and this may reduce performance across multiple users accessing the site over the same proxy. This can be mitigated by the fact that static content will be cached at desktops as well, Internet Explorer versions 6 and 7 cache cacheable HTTPS static content unless instructed to do otherwise (Tools Menu/Internet Options/Advanced/Security/Do not save encrypted pages to disk).