Home > Backend Development > PHP Tutorial > 自定义session存储机制避免会话保持问题_PHP

自定义session存储机制避免会话保持问题_PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-31 19:29:22
Original
1118 people have browsed it

PHP服务端session以文件的方式存储,当用户访问量过大时,session文件会非常多,而且当横向增加服务器后,session文件并不能同步,面临会话保持的问题。

有以下两种解决方案:

1. 拿出单独的一台服务器使用NFS或Samba文件共享方式,共享session文件,可以解决负载均衡时会话不同步的问题。(但无法解决效率的问题,上万个session文件,查找会较慢)

2. session存数据库,其他服务器可以通过共享数据库服务器,解决会话问题,同时数据库也解决了文件的效率问题。数据库可以通过横向扩展,速度和量的问题都可以解决。

Related labels:
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
Latest Issues
Session
From 1970-01-01 08:00:00
0
0
0
session
From 1970-01-01 08:00:00
0
0
0
session login information
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template