可不可不要这么样徘徊在目光内 / 你会察觉到我根本寂寞难耐 / 即使千多百个深夜曾在梦境内 / 我有吻过你这毕竟并没存在 / 人声车声开始消和逝 / 无声挣扎有个情感奴隶 / 是我多么的想她 / 但我偏偏只得无尽叹谓 / 其实每次见你我也着迷 / 无奈你我各有角色范围 / 就算在寂寞梦内超出好友关系 / 唯在暗里爱你暗里着迷 / 无谓要你惹上各种问题 / 共我道别吧别让空虚使我越轨 /

https vs http 性能

上一篇 / 下一篇  2007-12-26 15:58:06 / 个人分类:性能测试

最近比较忙,blog 也更新的有点慢

今天谈谈 https 的性能问题,个人见解。

今天去看微软的一些recorded 的webcast,没有想到livemeeting 的webserver 竟然都是全部https的。用户的登陆验证过程还可以理解,没有想到所有的文件资源居然也是通过https去访问,这个其实就做的过于安全了。一个20M的流文件,光服务端加密估计就要消耗很多cpu和能源了,不过微软的服务器够power。跟着俺的客户端也要解密这一部分,其实也消耗了俺的资源,hoho。总结一下,我觉得https 不应该用到不该用的地方。

 

1.      HTTPS一定要有明确的选择理由.

a)        HTTPS实际上是SSL用于HTTP.

b)       主要解决了两部分的问题.

                        i.             1.信任主机的问题.采用httpsserver必须从CA申请一个用于证明服务器用途类型的证书.改证书只有用于对应的server的时候,客户度才信任次主机.所以目前所有的银行系统网站,关键部分应用都是https.客户通过信任该证书,从而信任了该主机.其实这样做效率很低,但是银行更侧重安全.这一点对我们没有任何意义,我们的server ,采用的证书不管自己issue还是从公众的地方issue,客户端都是自己人,所以我们也就肯定信任该server.

                      ii.             2.通讯过程中的数据的泄密和被窜改.这里有两个层次

1.        一般意义上的https,就是server有一个证书.

a)        主要目的是保证server就是他声称的server.这个跟低一点一样.

b)       服务端和客户端中件的所有通讯,都是加密的.

                                                                i.             具体讲,是客户端产生一个对称的密钥,通过server的证书来交换密钥.一般意义上的握手过程.

                                                                ii.             加下来所有的信息往来就都是加密的.第三方即使截获,也没有任何意义.因为他没有密钥.当然窜改也就没有什么意义了.

2.        少许对客户端有要求的情况下,会要求客户端也必须有一个证书.

a)        这里客户端证书,其实就类似表示个人信息的时候,除了用户名/密码,还有一个CA认证过的身份.应为个人证书一般来说上别人无法模拟的,所有这样能够更深的确认自己的身份.

b)       目前少数个人银行的专业版是这种做法,具体证书可能是拿U盘作为一个备份的载体.

2.      HTTPS一定是expensive.

a)        本来简单的http协议,一个get一个response.由于https要还密钥和确认加密算法的需要.单握手就需要6/7个往返.

                        i.             任何应用中,过多的round trip肯定影响性能.

b)       接下来才是具体的http协议,每一次响应或者请求,都要求客户端和服务端对会话的内容做加密/解密.

                        i.             尽管对称加密/解密效率比较高,可是仍然要消耗过多的CPU,为此有专门的SSL芯片.如果CPU信能比较低的话,肯定会降低性能,从而不能serve更多的请求.

                      ii.             加密后数据量的影响.

1.        这个我用128bitRC2测试了一下,加密后数量跟加密前基本相同.

3.      HTTP VS HTTPS的性能

a)        这个由于很多人测试的背景不一样,由于时间太紧,我没有写出了一个类似ACT一样测试web https的压力工具.看了一下别人的观点.

b)       有些人说https的性能是http40 % ,有些人说可能80%.

c)       我的观点.

                        i.             https的关键性能影响是CPU和往返.如果CPU很强的话,性能可能就是有人讲的80%.如果cpu是瓶颈的话,有人讲原来可以server 330-500个请求每秒,现在只有30-50%

                      ii.             不需要用https的地方,就尽量不要用.

1.        考虑前面提到的权衡

                     iii.             微软在设计高性能的web应用程序中这么讲:

Segregate Secure and Non-Secure Content[1]

When you design the folder structure of your Web site,clearly differentiate between the publicly accessible areas and restricted areas that require authenticated access and Secure Sockets Layer (SSL).Use separate subfolders beneath the virtual root folder of your application to hold restricted pages such as forms logon pages, checkout pages, and any other pages that users transmit sensitive information to that needs to be secured by using HTTPS. By doing so, you can use HTTPS for specific pages without incurring the SSL performance overhead across your entire site.

Only Use SSL for Pages That Require It

Using SSL is expensive. Only use SSL for pages that require it. This includes pages that contain or capture sensitive data, such as pages that accept credit card numbers and passwords. Use SSL only if the following conditions are true:

·                    You want to encrypt the page data.

·                    You want to guarantee that the server to which you send the data is the server that you expect.

For pages where you must use SSL, follow these guidelines:

·                    Make the page size as small as possible.

·                    Avoid using graphics that have large file sizes. If you use graphics, use graphics that have smaller file sizes and resolution. Or, use graphics from a site that is not secure. However, when you use graphics from a site that is not secure, Web browsers display a dialog box that asks the user if the user wants to display the content from the site that is not secure.


TAG: 性能测试

 

评分:0

我来说两句

Open Toolbar