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.
Thanks in advance!
Three facts that provide the information:
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?)
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.
The browser makes 8 concurrent calls, and then waits 60 seconds before the next ones.
What should be happening:
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
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.
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.