PHP的Apache卷曲仅在每个浏览器的每个服务器上打开一个连接

I'm having a problem with curl in PHP that I can't figure out. I have a web server (Apache) that talks to a web service over HTTPS on another Apache server. We'll call them "server A" and "server B".

The problem I'm seeing is that server A only makes one connection at a time using curl to server B per browser that's connected to server A. I'm not sure if this is a curl or apache problem. I have seen references in several places to a max connection per server setting of one for a curl client but I can't verify that it exists.

Scenario:

  • I load up twenty different pages in three different browsers, each in its own tab/window within that browser. I tried Firefox, Chrome, and Konqueror all at the same time. Firefox had all its per-server connection limits raised significantly through about:config
  • All of those pages are hosted on server A and loading was started close to simultaneously
  • Each instance of the page on server A talks to server B using curl
  • A single call of this type to server B normally takes ~10 seconds
  • Only one TCP connection from A->B is open at any one time per browser that is connected to server A (3 total from A->B)
  • I verified that multiple connections from the browsers are opened to server A

AFAICT the requests are all serialized. I'm able to verify that multiple connections are open from browsers to server A, but only one https connection is open from A->B per browser connected to A.

Server B can handle many connections simultaneously but for some reason server A won't open multiple connections to server B. I have tried sending "Connection: close" from both servers A and B to see if that would help. It did not.

I have found lots of people talking about making multiple asynchronous connections per script but what I want to do is open multiple connections across different page instances to one external server.

Any ideas on what the problem is or how to fix it?

Native php sessions(files handler) use an exclusive locking model - only a single process/thread can work with the data for a specific session id at a time. When session_start() is called, execution will block until the process can acquire a lock on the session file. The lock is released when session_write_close() is called, which php automatically calls upon script termination. You can call it manually to release the lock and commit your changes. If desired, you can session_start() and session_write_close() multiple times per script execution.

Did you consider that server B allows only 1 secure connection ?

As i know this is a browser security issues that allows only 1 secure connection to same host at 1 time.