PHP Solution Session Deadlock method _php tips

Source: Internet
Author: User
There is a tricky problem in development today.
Requests that the other controllers do not return information when the asynchronous request handles a large volume of data operation in the background. Originally thought to be the EXT framework set up AJAX synchronization caused.
It was later discovered that session deadlock caused other controllers to wait for session completion before they could operate. (mainly the user login to determine the need to update session)
When PHP is handling large amount of data operation can not be done in a timely manner when there is access to other controllers or
Session deadlock caused by asynchronous request
And colleagues discussed the use of session_write_close () to resolve this issue
Copy Code code as follows:

Description
void Session_write_close (void)
End of the current sessions and store session data.
Session data are usually stored after your script terminated without the need to call Session_write_close (), but as session The data is locked to prevent concurrent writes only one script could operate on a sessions at any time. When using framesets together and sessions you experience the frames loading one through one due to this locking. Can reduce the time needed to load all the frames by ending as soon as all changes to sessions variables AR E done.

Function: To end the current session operation to save sessions data
Very clear, when the script request did not call Session_write_close (); While the session data is stored. But session Date (that is, session file) is a locked state
is to avoid other applications at this time the session of the operation is causing unnecessary consequences when the frame is used, the different files may continue to operate the session in order not to cause other operations to wait for the deadlock of the current session
You can use this function ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.