PHP Session Lock

Source: Internet
Author: User

Description: in PHP, when the same client executes two pages containing session_start (), the session file will be blocked if execution takes a long time to execute first. The specific performance is: A PHP page execution time is relatively long, and as long as the page is not completed, the other page access is a long time loading state, only the page execution is complete, the rest of the page to open. Reason: PHP By default is stored in a file format session, for each request to execute a page containing session_start (), the default is to create a file containing session_id, and the file will be locked, If the user in this client and access to a page containing session_start (), as session_id, this page will also read the user stored session file, if the first page is not completed, the file has been locked, The second page cannot be obtained and can only be in a waiting state. Possible consequences: If the site has a large number of user access, so that the session read file has been blocked waiting, the user browser has been maintained and the server connection, which will consume a lot of server resources. Also, as the number of active connections to the Web server increases, the connection resources may be exhausted, resulting in a denial of service behavior. Workaround: I recommend using the Redis storage session compared to using the database storage session. Read and write speeds can be significantly improved compared to files and databases, and multi-server sharing is possible.

PHP Session Lock

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.