2

Server information:

$ httpd -v 
Server version: Apache/2.2.24 (Unix)
Server built:   May  8 2013 15:17:37

I create a self-signed SSL Certificate with openssl.

Test Code(Java with selenium webdriver):

      long startTime, useTime = 0, t;
      int count = 10;
      for (int i = 0; i < count; i++) {
         ChromeDriver driver = new ChromeDriver(capabilities);
         startTime = System.nanoTime();
         driver.get("https://*.*.*.*/pic.html");
         //When testing Http,it will be:driver.get("http://*.*.*.*/pic.html");
         //pic.html is a simple page with many images.
         t = System.nanoTime() - startTime;
         useTime += t;
         driver.quit();
      }
      System.out.println("Average Time: " + useTime/1000000.0/count +" ms");

Result:

HTTPs:Average Time: 1718.13659 ms
HTTP:Average Time: 2484.122677 ms

Thanks in advance.

2 Answers2

3

It might be that using https also enables transparent compression of the content. The time added for compression and encryption (and back of course) might be less than the time saved by transferring less content over a slow link.

You can verify this by:

  • Using incompressible content (e.g. a large JPEG image)
  • Speeding up the transfer link significantly (e.g. by using "localhost")
A.H.
  • 63,967
  • 15
  • 92
  • 126
  • I think the a large JPEG will be compressed too, I can't see why a larger JPEG will improve it. And I want to test it on Win7(But My server is on RHEL5), so it makes no sense to me for testing it in localhost –  May 11 '13 at 07:26
  • A JPEG already _is_ compressed, it is even lossy compressed. Therefore another _lossless_ compression step will not produce a significant size reduction. And regarding your second item: I'm not talking about doing the final measurements with "localhost", I'm just proposing to verify the assumption by _temporarily_ altering the test setup. Please note: This can also mean that you run the client on the server too. – A.H. May 11 '13 at 07:54
  • I use JPEG now, 13 pictures(total 4.38 MB). –  May 11 '13 at 09:36
  • I use JPEG now, 13 pictures(total 4.38 MB). And the new page load time is: HTTPS:Average Time: 1512.181204 ms HTTP: Average Time: 2302.5691539 ms –  May 11 '13 at 09:42
  • You are still using a HTML file referencing these pictures? Is this a big HTML file? Does this HTML file include more non-image stuff like loading JavaScript or CSS files? – A.H. May 11 '13 at 09:57
0

Because Apache and chrome (I see you're using chromedriver) both support http2.0 which is faster for reasons other than encryption but only works with encryption.

Hans
  • 2,230
  • 23
  • 23