Memcached and PHP New client memcached installation (reference)
2010-02-23 11:05web2.0 and web1.0 are different, web1.0 content-centric, so web1.0 do the load just cache the content, using the reverse proxy cache page can solve most problems. and web2.0 encourages user interaction, the content is dynamic, only to do reverse proxy life if the middle rate is low, and the database is frequently written, the pressure on the database. Therefore, web2.0 needs to use a memory cache for web1.0. Memcached high-performance, distributed memory object cache system that reduces database load and improves access speed in dynamic applications. Memcached has been widely used in a variety of software, such as Nginx, MySQL one, server-side installation using Weget download Libevent and memcachedlibevent:http://monkey.org/~provos/ libevent-1.4.9-stable.tar.gzmemcached:http://www.danga.com/memcached/dist/ Memcached-1.2.6.tar.gz1. Install Libeventtar zxvf libevent-1.4.9-stable.tar.gz cd libevent-1.4.9-stable first./configure make Make install tar zxvf libevent-1.4.9-stable.tar.gz CD Libevent-1.4.9-stable./configuremakemake Install2. Installing Memcachedtar zxvf memcached-1.2.6.tar.gz cd memcached-1.2.6./configure--enable-threads make make install Tar zxvf memcached-1.2.6.tar.gzcd memcached-1.2.6./configure--enable-threadsmakemake Install Note: If "memcached" appears at startup: Error while loading shared Libraries:libevent-1.4.so.2:cannot openshared object file:no such file or directory "information that represents Memcached can not find the location of Libevent, first use Whereis libevent to get the location, and then connect to the path memcached looking for [root@localhost tools]# whereis libevent libevent:/usr/local/lib/ libevent.la/usr/local/lib/libevent.so/usr/local/lib/libevent.a [root@localhost tools]# LD_DEBUG=libs memcached-v 2& gt;&1 >/dev/null | Less [root@localhost tools]# ln-s/usr/local/lib/libevent-1.4.so.2/lib64/II, PHP installation support for memcached PHP has two versions of the memcached client 1.memcached This is a new version of the client based libmemcached, so you must install libmemcached first install libmemcached download address: http ://download.tangent.org/libmemcached-0.26.tar.gz[root@localhost tools]# tar zxvf libmemcached-0.26.tar.gz [ Root@localhost tools]# CD libmemcached-0.26 [root@localhost libmemcached-0.26]#./configure--prefix=/usr/local/ libmemcached/--with-libmemcached-dir=/usr/local/libmemcached/[root@localhost libmemcached-0.26]# make [ Root@localhost libmemcached-0.26]# make install [root@localhost tools]# tar zxvf libmemcached-0.26.tar.gz[ Root@localhost tools]# cd libmemcached-0.26[root@localhost libmemcached-0.26]#./configure--prefix=/usr/local/libmemcached/--with-libmemcached-dir=/usr/local/libmemcached/[root@localhost libmemcached-0.26]# make[ Root@localhost libmemcached-0.26]# make install PHP memcached and the latest client download address: http://pecl.php.net/get/memcached[ Root@localhost tools]# tar zxvf memcached-0.1.4.tgz [root@localhost tools]# cd memcached-0.1.4 [root@localhost memcached -0.1.4]#./configure--with-php-config=/usr/local/php/bin/php-config--with-libmemcached-dir=/usr/local/ libmemcached/[root@localhost memcached-0.1.4]# make [root@localhost memcached-0.1.4]# make install [root@localhost too ls]# tar zxvf memcached-0.1.4.tgz[root@localhost tools]# cd memcached-0.1.4[root@localhost memcached-0.1.4]#. Configure--with-php-config=/usr/local/php/bin/php-config--with-libmemcached-dir=/usr/local/libmemcached/[ Root@localhost memcached-0.1.4]# make[root@localhost memcached-0.1.4]# make install modify php.ini add extension = " Memcached.so "It's OK. 1. Checking for libmemcached location ... configure:error:memcached support requires Libmemcached. Use--with-libmemcached-dir=
To specify the prefix where libmemcached headers and library is located checking for libmemcached location ... Configur E:error:memcached support requires libmemcached. Use--with-libmemcached-dir=
To specify the prefix where libmemcached headers and library is located please first locate the path with Whereis libmemcached and then add the option--WITH-LIBMEMC ached-dir=libmemcached path 2.memcache Download address: http://pecl.php.net/get/memcache[root@localhost tools]# tar zxvf memcache-3.0.3.tgz [root@localhost tools]# cd memcache-3.0.3 [root@localhost tools]#/usr/local/php/bin/phpize [ Root@localhost tools]#./configure--with-php-config=/usr/local/php/bin/php-config [root@localhost tools]# make [ Root@localhost tools]# make install [root@localhost tools]# tar zxvf memcache-3.0.3.tgz [root@localhost tools]# CD MEMCAC He-3.0.3[root@localhost tools]#/usr/local/php/bin/phpize[root@localhost tools]#./configure--with-php-config=/usr /local/php/bin/php-config[root@localhost tools]# make[root@localhost tools]# make install modify php.ini add extension = " Memcache.so "It's OK. Tip: If PHP cannot find the so file, set Extension_dir. PS: This article in the draft box to stay for a long time, and finally decided to put a more than one post, so feel much faster. Source: Http://willko.iteye.com/blog/332993NetSeek (2009-9-10 11:16:40) memcached client libmemcached, processing value over8k of data, the speed will be straight down, in Http://lists.tangent.org/piperma ... ovember/000484.html, can find the answer, because libmemcached buf is too small, Locate the source file Memcached_constants.h, modify the # define Memcached_max_buffer 8196, change to the appropriate size, recompile, install, You can. Libmemcached is the interface of the C client library to the memcached server. It is designed for lightweight memory usage, thread-safe, and provides a way to get a full server-side approach. It also employs a variety of command-line tools: Memcat, Memflush, MEMRM, MemStat, and memslap (load generation). The library has been designed to let different hashing methods pair the keys, split the keys, and use a uniform hash distribution. License: BSD License (revision) change: Fixed descending hash key. The corrected assertion is that the host_reset () called by the memset () is not well caught. Fixed an issue where clearing blocked I/O has been stacked. Supplementary MemStat. A new API for flushing water. memcached Simple Tutorial This is a project-based article: memcached is a tool for fast data access, and Wikipedia and Facebook use it to improve speed. The specific situation can be wiki.c/c++ inside use memcached originally is very simple thing, but is no one said, do not want me to read Libmemcache instance code just line, Manpage also didn't say clearly (but also have to see). If you want to use memcached, proceed as follows: 1 install memcached You can go to the official website to download, or sudo apt-get install MEMCACHED2 Test your installation, such as running memcached-d-M 64-l 127. 0.0.1-p 12300-d for background,-m 64 means using 64MB memory,-l 127.0.0.1-p 12300 means listening 127.0.0.1:12300 port no message is running successfully 3 installation libmemcached This is not the AP T, because there is no accurate libmemcached bag, go to the official website to download it. This thing also need to libevent, this can not apt,libevent install the time best loaded into/usr/lib inside, otherwise libmemcached still can't run. 4 Test libmemcached Find a file such as test, and then run MEMCP test--servers=127.0.0.1:12300 to copy the test into the memcached managed memory. Memcat Test--servers=127.0.0.1:12300 See if that file was just.