문제

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.

도움이 되었습니까?

해결책

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")

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top