Magento Forum

   
Magento memcached backend? 
 
Kammalou
Sr. Member
 
Total Posts:  285
Joined:  2009-01-20
Denmark
 

you var/cache & var/session should als be empty....

 
Magento Community Magento Community
Magento Community
Magento Community
 
michael lehmkuhl
Jr. Member
 
Total Posts:  6
Joined:  2009-01-30
 

I don’t think anyone has mentioned that in order for memcached caching to work, you also need to have the memcached PHP extension installed on your server. Could that be the issue?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kammalou
Sr. Member
 
Total Posts:  285
Joined:  2009-01-20
Denmark
 

it’s not needed for those to be empty… just an indicator of weather it is working or not…

 
Magento Community Magento Community
Magento Community
Magento Community
 
apl
Member
 
Total Posts:  33
Joined:  2008-12-16
 
Euklid - 03 August 2009 08:27 AM

you var/cache & var/session should als be empty....

I thought if I switch from file to memcache(d) in local.xml, Magento would bypassing var/cache var/session. However, I emptied these folders, nothing changes.

michael lehmkuhl - 03 August 2009 08:54 AM

I don’t think anyone has mentioned that in order for memcached caching to work, you also need to have the memcached PHP extension installed on your server. Could that be the issue?

Is memcached something different from memcache? BTW, I had memcache php extension installed. Phpinfo shows

memcache
memcache support    enabled
Version     3.0.4
Revision     $Revision
1.83.2.36 
Directive    Local Value    Master Value
memcache
.allow_failover    1    1
memcache
.chunk_size    32768    32768
memcache
.compress_threshold    20000    20000
memcache
.default_port    11211    11211
memcache
.hash_function    crc32    crc32
memcache
.hash_strategy    consistent    consistent
memcache
.lock_timeout    15    15
memcache
.max_failover_attempts    20    20
memcache
.protocol    ascii    ascii
memcache
.redundancy    1    1
memcache
.session_redundancy    2    2

 
Magento Community Magento Community
Magento Community
Magento Community
 
apl
Member
 
Total Posts:  33
Joined:  2008-12-16
 

Well, I installed memcached php extension (yum install php-pecl-memcached), restart memcached and php fcgi, refresh cache in cache management, visit several webpages (to trigger producing pages in cache, maybe not necessary), and use memcache.php to show the usage.

It is still telling me only 0.5MBytes are used.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Northern Voyageur
Member
 
Avatar
Total Posts:  50
Joined:  2008-06-05
Duluth, MN
 

I have memcache(d) running just fine on my Magento, but my problem is that refreshing the Magento Cache does not seem to refresh the layout after I’ve change some layout XML files.  Sifting through the code, it looks like a default of 7200 seconds is declared as the default lifetime of the cache, but I just confirmed that it’s not expiring even after 24 hours.

To solve this problem I have to restart memcache to refresh my layout cache, but this kicks everyone out and deletes everyone’s shopping cart (mad customers).

Anyone seeing similiar results? Any solution to this ?

Thanks,
Shane

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sonassi
Sr. Member
 
Avatar
Total Posts:  217
Joined:  2009-05-20
Manchester, UK
 
apl - 03 August 2009 10:00 AM

Well, I installed memcached php extension (yum install php-pecl-memcached), restart memcached and php fcgi, refresh cache in cache management, visit several webpages (to trigger producing pages in cache, maybe not necessary), and use memcache.php to show the usage.

It is still telling me only 0.5MBytes are used.

That is correct. Memcache is only caching the outputted html file size, which is around 5-8kb, so 0.5MBytes being used is about 512kb - or around 8-100 cached pages.

Northern Voyageur - 22 October 2009 04:01 AM

I have memcache(d) running just fine on my Magento, but my problem is that refreshing the Magento Cache does not seem to refresh the layout after I’ve change some layout XML files.  Sifting through the code, it looks like a default of 7200 seconds is declared as the default lifetime of the cache, but I just confirmed that it’s not expiring even after 24 hours.

To solve this problem I have to restart memcache to refresh my layout cache, but this kicks everyone out and deletes everyone’s shopping cart (mad customers).

Anyone seeing similiar results? Any solution to this ?

Thanks,
Shane

It would be interesting to see the page headers, if your page expiry is in the future - then it will cause the issues as described above.

The following setting in ./app/etc/local.xml, should be empty - the use of public/private will set far future headers to be sent, meaning hard refreshes are required on every page load.

<session_cache_limiter><![CDATA[]]></session_cache_limiter>

You *should not* need to ever restart Memcached, simply using the cache refresh tool within Magento is sufficient. Also, if you wish to avoid kicking peoples session out, either use file based sessions, database based sessions or create another Memcached thread.

To be honest, unless you are using a cluster, then file based sessions is more than optimal, the OS disk buffer is capable of caching files in memory where necessary anyway - plus for out an out performance, disk is not an issue.

The only concern with file based sessions is that they will spawn uncontrollably and need a level of restriction. We automatically prune the session files themselves after 3 days using this rule in the crontab:

10   7     *    *    *    /usr/bin/find ./var/session -mindepth 1 -maxdepth 1 -ctime +-name "sess*" -print -exec rm {} \; >/dev/null 2>&1;

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dx3webs
Sr. Member
 
Avatar
Total Posts:  178
Joined:  2008-12-16
 

great stuff people…

I have a few questions..

1)
I have 3 sites on one server… i have enabled memcache for 1 site.. which seems to work a treat
so i tried to do the same for the second server… however, it now appeared to look like the 1st shop.. which was quite a shock.  I suppose i should have expected this as I had just told it to effectively use the same cache.. doh.
So what is the correct way of doing this.. i am guessing there might be 2 appraoces
a) run 2 seperate instaces of memcache
b) set somekind of identifier in local.xml
I think I know how to do a) but is this the best way and if I wanted to do b) how would i do this?

2) I followed the suggestion:

session.save_handler memcache
session
.save_path="tcp://127.0.0.1:11211?persistent=1&weight;=1&timeout;=10&retry;_interval=15"
which seems a great idea and indeed it did work with my 3 magento shops.. but killed my numerous wordpress installs (server 500 errors)… doh! any idea why this would happen?

cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sonassi
Sr. Member
 
Avatar
Total Posts:  217
Joined:  2009-05-20
Manchester, UK
 

Running multiple instances is preferred as it allows true separation. In point 2. all you have done is set sessions to be handled by Memcache, rather than in PHP’s default of using files.

It shouldn’t affect any other applications you host, I thought the syntax was incorrect, but upon reflection, it is just this forum escaping the code in a bizarre manner.

Handling sessions via memcached only holds an advantage if you are distributing the site across multiple servers (clustered environment), otherwise, its benefits aren’t really to be seen - you would just swallow a lot of RAM for little gain.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dx3webs
Sr. Member
 
Avatar
Total Posts:  178
Joined:  2008-12-16
 
Northern Voyageur - 22 October 2009 04:01 AM

I have memcache(d) running just fine on my Magento, but my problem is that refreshing the Magento Cache does not seem to refresh the layout after I’ve change some layout XML files.  Sifting through the code, it looks like a default of 7200 seconds is declared as the default lifetime of the cache, but I just confirmed that it’s not expiring even after 24 hours.

To solve this problem I have to restart memcache to refresh my layout cache, but this kicks everyone out and deletes everyone’s shopping cart (mad customers).

Anyone seeing similiar results? Any solution to this ?

Thanks,
Shane

I am having the same problem as above.  I have had to turn the layout cache off till i figure our what is going on here.. can anyone think of any areas to investigate?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sonassi
Sr. Member
 
Avatar
Total Posts:  217
Joined:  2009-05-20
Manchester, UK
 

The solution is to not use Memcache for sessions - unless you are using a load balancer with multiple backends that warrants shared sessions, even then, using the DB will suffice.

Also, make sure your session_save_limiter isn’t set, that way pages will all have an expiry time in the past (which is what you need).

 
Magento Community Magento Community
Magento Community
Magento Community
 
moesian
Jr. Member
 
Total Posts:  18
Joined:  2009-10-05
 

Hi,

I’m using eaccelerator for caching my php scripts, will I benefit further from using memcached for the Magento cache? Also roughly how much memory should be allocated to memcached?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sonassi
Sr. Member
 
Avatar
Total Posts:  217
Joined:  2009-05-20
Manchester, UK
 

Allocate as much memory as you need.

Imagine rendered HTML output will be about 8kb for each page, so then multiply that by the number of pages you have and add a small margin for overhead.

 
Magento Community Magento Community
Magento Community
Magento Community
 
moesian
Jr. Member
 
Total Posts:  18
Joined:  2009-10-05
 

Just seen this extension, http://www.magentocommerce.com/extension/2138/catalog-cache. Does this mean that without this extension product and catalog page html won’t be fully cached in memcached?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Olof
Sr. Member
 
Total Posts:  152
Joined:  2008-10-17
 

Hi guys, when we enable Memcache for session storage it seems to stop outputting popper cache control headers:

Cache-Control max-age=2592000

Because of this interactive stuff like adding products to your card doesn’t appear to work.

We have tried:

<session_cache_limiter><![CDATA[public,must-revalidate]]></session_cache_limiter>
and
<session_cache_limiter><![CDATA[]]></session_cache_limiter>

Who has this working and which what cache limited string?

Rich

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top