2

我知道最好的存储方式PHP SESSION是 PHP 集群中的“在 memcached 中处理”。

但是,我想知道是否有人将 PHP SESSION 文件存储在NFS(网络文件系统)、GFSHDFS中?

我想知道它是否有风险?还是性能不好?

我认为它可以提供 SSO。

4

2 回答 2

4

The short answer is that you shouldn't use something like NFS for session management because it doesn't handle locking correctly on the distributed session files that could be accessed by any of the client servers. Plus, a lot of solutions don't correctly handle asynchronous reads.

Plus, if your networked file system "goes away", you will be in a real mess, because you get into a situation where you need to start detecting the bad mount in your PHP application.

That said, you could roll out NFS for session management if you expect low throughput, but to be honest, there are better solutions out there.

If I had to rank... I'd say any of the in memory stores are best. Memcache/Redis. I like using Redis with 5 minute writes to disk.

于 2012-09-23T14:09:43.020 回答
1

It can technically be done but the performance would be subpar. The fastest medium to store data is always the memory, which is why in-memory solutions like memcached are recommended for session data storage. There is overhead in writing the data back to disk, and even a bigger overhead in connecting to a networked hd, and then perform the write on that disk.

于 2012-09-23T14:08:33.447 回答