问题描述
我建立一个基于web的聊天应用程序,这将需要一个AJAX请求发送或接收的每一封邮件。我想要对数据进行加密和我倾向于通过HTTPS运行AJAX(与长轮询)。
I'm building a web-based chat app which will need to make an AJAX request for every message sent or received. I'd like the data to be encrypted and am leaning towards running AJAX (with long-polling) over HTTPS.
然而,由于这里的请求的频率比基本的网页浏览高了很多,我想更好地了解开销(网络使用情况,时间,服务器的CPU,客户端CPU)的建立加密连接每个HTTPS请求。
However, since the frequency of requests here is a lot higher than with basic web browsing, I'd like to get a better understanding of the overhead (network usage, time, server CPU, client CPU) in setting up the encrypted connection for each HTTPS request.
除了普通的任何信息/咨询,我很好奇:
Aside from any general info/advice, I'm curious about:
- 作为一个非常粗略的估计,有多少额外的时间并不HTTPS请求采取比HTTP?假设1个字节的内容长度和普通的PC。
- 请问以后每AJAX请求第一次有什么显著缓存,允许它建立连接更快?如果是这样,如何更快?
感谢你在前进: - )
Thank you in advance :-)
推荐答案
在HTTPS一切都慢。个人信息不应该被缓存,你必须在两端加密和SSL握手是比较慢的。
Everything in HTTPS is slower. Personal information shouldn't be cached, you have encryption on both ends, and an SSL handshake is relatively slow.
长轮询会有所帮助。长期保留是不错的。在服务器上启用SSL会话会避免很多的开销也是如此。
Long-polling will help. Long keep-alives are good. Enabling SSL sessions on your server will avoid a lot of the overhead as well.
真正的技巧是将做负载平衡或任何形式的合法的缓存。不知道有多少,这将开始发挥作用,在您的系统,是一个聊天服务器,但它的东西要考虑。
The real trick is going to be doing load-balancing or any sort of legitimate caching. Not sure how much that will come into play in your system, being a chat server, but it's something to consider.
这篇关于了解HTTPS连接建立开销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!