Magento Monthly Sessions

I am currently trying to set up a production environment for Magento with the following setup:

2x web server, 1x DB server, load balancer.

Thus, the load balancer will distribute the traffic between the web servers, but will not use sticky sessions.

To solve the problem of sharing sessions between servers, I decided to use Memcached. I have a Memcached server running on each web server, and then listed the memcached servers in the local.xml file on each web server.

The cache works, as I definitely notice an increase in speed, and I see that sessions are shared between web servers. The problem is that the cache is working too well. Dynamic parts of the page (such as cart and messages) are fully cached for each page.

I noticed that getChildHtml (), which you call to place the cart on the page, has an optional parameter called useCache, which I explicitly pass to false, but that does nothing. Here is my definition of local.xml just in case I did something wrong (confidential information was left):

<config> <global> <install> <date></date> </install> <crypt> <key></key> </crypt> <disable_local_modules>false</disable_local_modules> <resources> <db> <table_prefix></table_prefix> </db> <default_setup> <connection> </connection> </default_setup> </resources> <session_save><![CDATA[memcache]]></session_save> <!-- db / memcache / empty=files --> <session_save_path><![CDATA[tcp://XXXX:11211?persistent=1&weight=2&timeout=10&retry_interval=10]]></session_save_path><!-- eg for memcache session save handler tcp://10.0.0.1:11211?persistent=1&weight=2&timeout=10&retry_interval=10 --> <session_cache_limiter><![CDATA[private]]></session_cache_limiter><!-- see http://php.net/manual/en/function.session-cache-limiter.php#82174 for possible values --> <cache> <backend>memcached</backend><!-- apc / memcached / xcache / empty=file --> <slow_backend>database</slow_backend> <!-- database / file (default) - used for 2 levels cache setup, necessary for all shared memory storages --> <slow_backend_store_data></slow_backend_store_data> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether store data in db slow cache backend --> <auto_refresh_fast_cache>1</auto_refresh_fast_cache> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether refresh data in fast cache backend --> <memcached><!-- memcached cache backend related config --> <servers><!-- any number of server nodes can be included --> <server> <host><![CDATA[XXXX]]></host> <port><![CDATA[11211]]></port> <persistent><![CDATA[1]]></persistent> </server> <server> <host><![CDATA[XXXX]]></host> <port><![CDATA[11211]]></port> <persistent><![CDATA[1]]></persistent> </server> </servers> </memcached> </cache> </global> <admin> <routers> <adminhtml> <args> <frontName><![CDATA[admin]]></frontName> </args> </adminhtml> </routers> </admin> 

I also noticed other strange behavior, such as clearing the cache in the cache control window in the admin panel. This is normal when using memcached in Magento and how can I solve the problem of caching the entire page?

+4
source share
2 answers

For those who have a problem with a similar problem, I managed to solve my problem. The main problem I had here was that I was using a different memcached server in every node web browser, which was incorrect as it uses your session as a key to search for cached data. In addition, you need to make sure that you set the constant element in the server tag to 0 instead of 1. With these settings in place, the site now works fine.

+4
source
 tcp://XXXX:11211?persistent=0 

Like this?

Or more than that:

 <server> <host><![CDATA[xx.xx.x.xx]]></host> <port><![CDATA[11211]]></port> <persistent><![CDATA[0]]></persistent> <weight><![CDATA[2]]></weight> <timeout><![CDATA[10]]></timeout> <retry_interval><![CDATA[10]]></retry_interval> <status><![CDATA[]]></status> </server> 
+1
source

All Articles