0

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!

Community
  • 1
  • 1
jogoe
  • 482
  • 6
  • 18

1 Answers1

3

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.

Robbie
  • 17,605
  • 4
  • 35
  • 72