Memcached-PHP is inexplicably lost when using Memcache for session_handler in Windows

Source: Internet
Author: User
The symptoms are set_session.php and read_session.php. Access set_session.php and input session data. Access read_session.php and check that the session data is read normally. No matter if you refresh read_sesion.php in 5 minutes or access another file, it will be normal... Symptom

There are two files: set_session.php and read_session.php. Access set_session.php and input session data. Access read_session.php and check that the session data is read normally. Refresh read_sesion.php in five minutes or access other files.
However, if I press and hold the f5 key (note that it is), it will be released after about 5 seconds (that is, the browser refreshes dozens or hundreds of times in a short time ), the session reported by read_session.php is empty. At this time, I took session_id to memcache and found that the key exists, but the value is empty.

Environment

The Server is Windows Server 2003 32bit. XAMPP3.1.0 is used, and the PHP version is 5.4. The PHP configuration is as follows:

session.save_handler = memcachesession.save_path = "127.0.0.1:22003"session.auto_start = 1

MC version is 1.4.4, downloaded from http://downloads.northscale.com/memca..., DLL is http://windows.php.net/downloads/pecl...

What's strange

I'm sure the memory is not full, no one else can access this server, and no other application is running on it.
CompleteFor the same xampp/php/mc configuration, there is no problem in my local Windows 7 (64bit. If I replace session_handler on the server with files, there is no problem. Finally, we suspected it was a problem with the number of connections or win03. We found that win03 had no limits on tcp connections. If it was a problem with the win03 kernel, I had a solution .. Partition (partition _ partition) Partition

This problem took a whole day, and finally decided to discard the memcache storage. After switching to linux and then using mc storage, there was no high load. However, we can use mc to store other data, such as commodities, categories, or smarty caches, but sessions cannot be installed.

Reply content: Symptom

There are two files: set_session.php and read_session.php. Access set_session.php and input session data. Access read_session.php and check that the session data is read normally. Refresh read_sesion.php in five minutes or access other files.
However, if I press and hold the f5 key (note that it is), it will be released after about 5 seconds (that is, the browser refreshes dozens or hundreds of times in a short time ), the session reported by read_session.php is empty. At this time, I took session_id to memcache and found that the key exists, but the value is empty.

Environment

The Server is Windows Server 2003 32bit. XAMPP3.1.0 is used, and the PHP version is 5.4. The PHP configuration is as follows:

session.save_handler = memcachesession.save_path = "127.0.0.1:22003"session.auto_start = 1

MC version is 1.4.4, downloaded from http://downloads.northscale.com/memca..., DLL is http://windows.php.net/downloads/pecl...

What's strange

I'm sure the memory is not full, no one else can access this server, and no other application is running on it.
CompleteFor the same xampp/php/mc configuration, there is no problem in my local Windows 7 (64bit. If I replace session_handler on the server with files, there is no problem. Finally, we suspected it was a problem with the number of connections or win03. We found that win03 had no limits on tcp connections. If it was a problem with the win03 kernel, I had a solution .. Partition (partition _ partition) Partition

This problem took a whole day, and finally decided to discard the memcache storage. After switching to linux and then using mc storage, there was no high load. However, we can use mc to store other data, such as commodities, categories, or smarty caches, but sessions cannot be installed.

Memcached is not suitable for session storage when the number of sessions exceeds a certain value.

Memcache uses slab Memory pre-allocated, and the number of keys with a fixed length is limited. If the number is full, the key is deleted based on LRU, resulting in loss.

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.