memcached

Has anyone tried to use memcached with CS-Cart?

[url]http://www.memcached.org/[/url]



Can anyone give me an idea as to what would be required to integrate its usage?



This could really speedup/optimize the system I think.

Checkout: [url]http://forum.cs-cart.com/showthread.php?t=14032&highlight=smartoptimizer[/url]

I have setup the smartoptimizer as suggesting in the link… it has done a great done of speeding pages via caching, however I am interested in memcache since my understanding is that it takes caching a little further by caching data requests.

I know many major sites are using this as their solution.

Would it be difficult to implement into CS-Cart?

The holiday weekend made our sites really busy and the slow site became unusable for our customers. I found a PHP/Mysql expert who fixed the problem for me. I wanted to share his final fix. This is the best preformance enhancer for cs-cart I have ever found!



We have 49,000+ products and good traffic to the site. It seems the session data has a tendency to lock up the database because it was over 500,000 rows. We moved the session data to memchache and my load average went from 5.0 to 10.0 down to .50 .


  1. install memcache

    yum install memcached


  2. when it done. checking version and working.

    memcached -h


  3. Starting it.

    /etc/init.d/memcached restart


  4. edit memcache settings.

    vi /etc/sysconfig/memcached


  5. Allow to use 1Gb of ram for caching.

    CACHESIZE=“1024”


  6. add memcached to server startup

    /sbin/chkconfig memcached on


  7. installing pecl php extenision for memcached.

    wget [url=“http://pecl.php.net/get/memcache-3.0.6.tgz”]http://pecl.php.net/...cache-3.0.6.tgz[/url]

    tar -xzf memcache-3.0.6.tgz

    cd memcache-3.0.6

    phpize

    ./configure

    make

    make install

    vi /etc/php.d/memcache.ini

    write there (extension=/usr/lib64/php/modules/memcache.so)

    check it working with command (php -i | grep mem) you will see output about installed extension.

    And restart apache with “/etc/init.d/httpd restart”


  8. Go to php code of site.



    find file core/class.session.php

    there find function set_params()



    and there rows like:


ini_set('session.cookie_path', ((!empty($current_path))? $current_path : '/'));
ini_set('session.gc_divisor', 10); // probability is 10% that garbage collector starts




add after it:


ini_set('session.save_handler','memcache');
ini_set('session.save_path','127.0.0.1:11211');




after it sfind function init()



there comment Session::set_handlers(); must look like



Session::set_params();
//Session::set_handlers();
Session::start();

Where does, 127.0.0.1:11211 come

From? I'm by sure what is at port 11211.



Also how much of a load difference did it make for you?



What version of cscart are you using?

At this point I get errors on the homepage.



and there rows like:

ini_set('session.cookie_path', ((!empty($current_path))? $current_path : '/'));

ini_set('session.gc_divisor', 10); // probability is 10% that garbage collector starts



add after it:

ini_set('session.save_handler','memcache');

ini_set('session.save_path','127.0.0.1:11211');



after it sfind function init()



there comment Session::set_handlers(); must look like



Session::set_params();

//Session::set_handlers();

Session::start();

I guess you can't act on behalf of user with this configuration.

[quote name='Offline' timestamp='1333931902' post='134508']

The holiday weekend made our sites really busy and the slow site became unusable for our customers. I found a PHP/Mysql expert who fixed the problem for me. I wanted to share his final fix. This is the best preformance enhancer for cs-cart I have ever found!



We have 49,000+ products and good traffic to the site. It seems the session data has a tendency to lock up the database because it was over 500,000 rows. We moved the session data to memchache and my load average went from 5.0 to 10.0 down to .50 .


  1. install memcache

    yum install memcached


  2. when it done. checking version and working.

    memcached -h


  3. Starting it.

    /etc/init.d/memcached restart


  4. edit memcache settings.

    vi /etc/sysconfig/memcached


  5. Allow to use 1Gb of ram for caching.

    CACHESIZE=“1024”


  6. add memcached to server startup

    /sbin/chkconfig memcached on


  7. installing pecl php extenision for memcached.

    wget [url=“http://pecl.php.net/get/memcache-3.0.6.tgz”]http://pecl.php.net/...cache-3.0.6.tgz[/url]

    tar -xzf memcache-3.0.6.tgz

    cd memcache-3.0.6

    phpize

    ./configure

    make

    make install

    vi /etc/php.d/memcache.ini

    write there (extension=/usr/lib64/php/modules/memcache.so)

    check it working with command (php -i | grep mem) you will see output about installed extension.

    And restart apache with “/etc/init.d/httpd restart”


  8. Go to php code of site.



    find file core/class.session.php

    there find function set_params()



    and there rows like:


ini_set('session.cookie_path', ((!empty($current_path))? $current_path : '/'));
ini_set('session.gc_divisor', 10); // probability is 10% that garbage collector starts




add after it:


ini_set('session.save_handler','memcache');
ini_set('session.save_path','127.0.0.1:11211');




after it sfind function init()



there comment Session::set_handlers(); must look like



Session::set_params();
//Session::set_handlers();
Session::start();


[/quote]



Hello Chris,

Could you provide the PHP/Mysql expert who fixed the problem for you contact info?

I'm very interested in getting this fix



Thanks