Over the past few days, we have been working on performance improvement. We have been dealing with servers for a long time. Today we are mainly working on installing memcache, which is mainly used for database caching. If I have introduced something wrong, please give me more advice. After all, I am also exploring and studying this aspect.
All operations are performed under SSH and logged on with the root account.
My version is centos release 5.3 (final)
Use this command to know your Linux version
CAT/etc/RedHat-release
First install the libevent library.
CD/usr/local/src
Curl-O http://monkey.org /~ Provos/libevent-1.4.10-stable.tar.gz
Tar xzvf libevent-1.4.10-stable.tar.gz
CD libevent-1.4.10-stable
./Configure -- prefix =/usr/local
Make
Make install
Next, install memcached.
CD/usr/local/src
Curl-O http://www.danga.com/memcached/dist/memcached-1.2.8.tar.gz
Tar xzvf memcached-1.2.8.tar.gz
CD memcached-1.2.8
Ldflags = '-wl, -- rpath/usr/local/lib'./configure -- prefix =/usr/local
Make
Make install
After the installation is complete, run the following command as the user root to run memcache:
Memcached-u root-D-M 64-l 192.168.0.101-P 11211
Root is the executed user
64 is the cache size 64 m
192.168.0.101 is the IP address of the server
11211 is the port
Disable memcache
Pkill memcached
Next, install PHP-PECL-memcache.
A command.
Yum install PHP-PECL-memcache
If you still need PHP extension, use the following command:
PECL install memcache
Restart Apache and use phpinfo () to view the memcache part. If not, check the settings here:
/Etc/PHP. ini added extension = memcache. So
Of course, check whether memcache. So exists and whether it is under/usr/lib/PHP/modules/. If not, locate it and use the complete path.
You can use memcache. php to view the running status of memcache.
Memcache can be used only when web application support is required. For example, if phpBB 3 is used, memcache can be used. For details, refer to here.
It seems that the hit rate is still very high.