问题
I have issue with same browser client try to open multiple tabs with it. but my server is wait for first request to finished.
for example
Open first browser tab that take more time like 30sec.
Now, next tab open with the help of CTR + Mouse click open new tab in bowser that is just static page 1 sec wait; but stil i have to wait for first request to finished.
Note : I have website in not in live but i am using following technology PHP 5.4, Mysql, Zend Framework 2.1, Xampp 1.8
Please guide in above issue if an confution you can comment on it. I am happy to do chat also.
回答1:
I guess you have session_start()
on every page.
Default PHP session is based on files. Hence whenever the session_start()
is called the file lock will occur on the server. Until complete the process the file lock won't be released.
To resolve this problem use session_write_close()
on your page. Use this session write close efficiently. Once you written everything into the session then close it.
session_write_close() will release the lock. After session_write_close()
you can read the data from session but you can't write it. If you want to write it then you need to restart the session again using session_start()
.
Session data is usually stored after your script terminated without the need to call session_write_close(), but as session data is locked to prevent concurrent writes only one script may operate on a session at any time. When using framesets together with sessions you will experience the frames loading one by one due to this locking. You can reduce the time needed to load all the frames by ending the session as soon as all changes to session variables are done.
Ref:
http://www.php.net//manual/en/function.session-write-close.php http://www.php.net/manual/en/function.session-start.php
来源:https://stackoverflow.com/questions/24324994/zend-framework-same-browser-open-multiple-tabs-but-wait-for-first-request-to-f