Are you taking advantage of memcache?
Dynamic websites like joomla and wordpress sometimes feels sluggish after installing a number of plugins or modules due to the number of database SQL queries generated by those plugins, so how do we fix that?
The answer is using some sort of caching system like memcache or redis and since Memcached seems to work well, widely supported and very easy to work with we're going with memcache.
memcache consist of 2 main components, memcached deamon and memcache{d} PHP modules:
Here's how to install memcache on your cPanel server:
First we're installing memcache deamon as root user and since we're mainly a CentOS shop i will use yum (this setup was tested on CentOS 5 & 6):
Install EPEL repo by following instructions at https://fedoraproject.org/wiki/EPEL
# yum install memcached
Start the daemon:
# /etc/init.d/memcached start
Dedicated Server Hosting - Managed Dedicated Servers - BuyHTTP
Make sure the deamon starts automatically after reboot:
# chkconfig memcached on
You can change memcached configuratoin like maximum connectoins and memory size by editing this file:
# vi /etc/sysconfig/memcached
Now we need to install the PHP module that will talk to memcached deamon, there are 2 PHP modules you can install memcache & memcached (yes, the second module was named as the deamon name)
To install memcache php module using PECL:
pecl install memcache
Or from WHM: Go to Software -> Module Installers -> PHP Pecl
Search for memcache and install memcache
This should be enough to start using memcache in your PHP script but what if you have a script that uses memcached PHP module? here's how to install memcached PHP module:
Install libmemcached & libmemcached-devel and cyrus-sasl-devel packages:
yum install libmemcached
yum install libmemcached-devel
yum install cyrus-sasl-devel
You can also install memcached by compiling from source:
cd
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar -zxvf libmemcached-1.0.4.tar.gz
cd libmemcached-1.0.4
./configure
make && make install
pecl install memcached
Finally to test memcahce and see live stats:
memcached-tool localhost:11211 display
To take advantage of memcahce you have to enable memcahce caching in Joomla or in your Wordpress caching plugin.
Buyhttp offers dedicated servers with cPanel and memcache preinstalled, check out our current line up.
https://www.buyhttp.com/dedicated_servers.html
- 1 Users Found This Useful