Apache is not multithread?
I'm using Apache lounge over 3 month on localhost. Today I found that my Apache/PHP installation is not multi threaded by running a script that uses sleep(10) & opening 2 browser tab开发者_运维知识库s at same time. (second tab loads 10 seconds after first one was done).
I've installed Apache(apache.org version) and nothing changed. I'm using PHP 5.3.6 VC9 thread safe.
What is the problem?
You have to make sure you are using Apache's worker MPM, rather than the prefork one. Depending on your installation, you may simply be able to symbolically link /usr/sbin/httpd2 to /usr/sbin/httpd2-worker (or wherever it is installed).
Of course, in your case, you could also just increase the number of maximum processes in your config, which should enable you to open multiple tabs and have them run at the same time.
Something like this:
StartServers 2
MinSpareServers 2
MaxSpareServers 8
ServerLimit 8
MaxClients 8
KeepAlive off
I had the same problem. I send requests from 3 browser tabs from Chrome to one local script with sleep(4)
and responses was waiting each other. But I inspected what if I sent one from Chrome and second from Firefox this situation not reproduce
It looks like you stumble upon a browser feature: Background tabs are only loaded when you switch to that tab; it is the current default to many browsers (check your settings or use two different browsers to check). Regards :-)
精彩评论