Back

ssl (https) 的速度(与 传统的http 速度对比) , 耗时是7倍

发布时间: 2017-01-31 22:52:00

参考:  http://www.ruanyifeng.com/blog/2014/09/ssl-latency.html

2017年开始,所有的app store的应用都要使用https协议.  所以,我们要开始关注https了.

根据阮一峰 的博客, 可以使用 curl 命令来查看.  ( -w time_appconnect 这个参数)

siwei@siwei-linux:~$ curl -w "TCP handshake: %{time_connect}, SSL handshake: %{time_appconnect}\n" -so /dev/null https://www.alipay.com
TCP handshake: 0.052, SSL handshake: 0.348
siwei@siwei-linux:~$ curl -w "TCP handshake: %{time_connect}, SSL handshake: %{time_appconnect}\n" -so /dev/null https://www.alipay.com
TCP handshake: 0.046, SSL handshake: 0.339
siwei@siwei-linux:~$ curl -w "TCP handshake: %{time_connect}, SSL handshake: %{time_appconnect}\n" -so /dev/null https://www.alipay.com
TCP handshake: 0.053, SSL handshake: 0.338
siwei@siwei-linux:~$ curl -w "TCP handshake: %{time_connect}, SSL handshake: %{time_appconnect}\n" -so /dev/null https://www.alipay.com
^[[ATCP handshake: 0.054, SSL handshake: 0.352
siwei@siwei-linux:~$ curl -w "TCP handshake: %{time_connect}, SSL handshake: %{time_appconnect}\n" -so /dev/null https://www.alipay.com
TCP handshake: 0.046, SSL handshake: 0.339
^[[Asiwei@siwei-linux:~$ curl -w "TCP handshake: %{time_connect}, SSL handshake: %{time_appconnen" -so /dev/null https://www.alipay.com
TCP handshake: 0.053, SSL handshake: 0.348

可以看出,  平均耗时是 7倍.   除非内容很重要, 否则我建议还是使用http. (当然了, 包含敏感内容的东东除外)

Back