doucheng9634 2016-12-02 08:16
浏览 47
已采纳

Http-bind需要6000ms

I have a CRM that is programmed with PHP,javascript and jQuery. We also have a XMPP and http-bind for voip.

My problem is: When I load the CRM, the first couple of http-binds take normal time (<50ms), after that they always take around 6000ms.

The code for this is split over multiple files and is a LOT. I don't really know which part of the code to add so I'll just leave out code right now and add parts of it if needed.

I am fairly new to http-binding and XMPP and sadly couldn't find anything helpful yet, so I appreciate any information or help.

Log:LOG

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • duanhui4160 2016-12-05 22:37
    关注

    Three facts that provide the information:

    1. Firefox by default used to have a maximum of 8 connections per server. This is configurable but be careful if you change. http://kb.mozillazine.org/Network.http.max-connections-per-server. (Note: I think the max is no 15 persistent connections, but it doesn't look like you're using the latest Firefox or dev plugins?)

    2. By default, persistent connections (i.e. connections to a server that remain open and can be re-used - see https://en.wikipedia.org/wiki/HTTP_persistent_connection) remain open for 60 seconds before closing.

    3. The browser makes 8 concurrent calls, and then waits 60 seconds before the next ones.

    What should be happening:

    1. Browser opens (up to) 8 connections and makes (up to) 8 parellel requests.
    2. Once a request is responded to, the browser will re-use the same connection.
    3. Failing that, it will issue a "keep-alive" to tell the server to keep the connection open.
    4. If the connection is not used for X seconds (X depends on server) and no keep-alive is received, server will close the connection.

    Where you are failing is step (2), the browser is not re-using the same connection. It then can't make a 9th call while it has 8 connections open

    So either the browser is failing to re-use the connection but does send "keep-alives" for up to 60 seconds and then stopping (so server closes connection) OR the browser fails to close the connection and the server is configured for a 60 second timeout (which is huge!)

    Solutions

    1. I presume it's unlikely that both browser and server are broken / misconfigured, and as it looks like you're using an old version of Firebug (or some clone or plug in for another browser) start there? For testing,change both browser and debug tools:

      • If Firebug: this is not being developed any more so you should start using the in-build FireFox dev tools (but if that fails, try another browser completely)

      • If Chrome or Edge, use their built-in tools.

      • Alternatively, use Fiddler (windows) or Charles (Mac). But still, remember to also try another browser.

    2. You're alternative is to turn off keep-alives/persistent connections and check the server is configured for <60 second time-outs. A bit more involved, so start with the browser and debug tools.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法