Multiple servers realize session sharing

巴扎黑
Release: 2016-11-09 11:13:36
Original
1588 people have browsed it

We know that Session is a mechanism proposed to maintain the session connection state between the client and the server in response to the limitations of the HTTP protocol.
Visitors to the website are assigned a unique identifier, a so-called session ID. It is either stored in a client-side cookie or passed via the URL.
The default storage method of Session is to store it in the form of a file in a local hard disk directory, so when there are many Sessions, it will be slower to read files from the disk. Another point is that for large sites, it cannot share multiple server sessions.
One solution is to use a database to access Session, so that session information can be shared between different servers.
Implement code download
The engine MyISAM is best replaced by the MEMORY engine, because MEMORY uses a memory table, all data is stored in the memory, and the operation speed is fast, which is suitable for data in the form of Session.
In websites with large traffic, session storage has problems such as inefficiency and occupying database connection resources. In response to this situation, Key-Value data storage solutions such as Memcached and Redis can be used to achieve high concurrency and large traffic session storage.

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!