What is memcached?
Emcached is a high-performance distributed memory object caching system for dynamic Web applications to reduce database load. It reduces the number of read databases by caching data and objects in memory, providing the speed of dynamic, database-driven Web sites. Memcached is based on a hashmap that stores key/value pairs. Its daemon (daemon) is written in C, but the client can write in any language and communicate with the daemon through the memcached protocol. However, it does not provide redundancy (for example, copying its hashmap entries), and when a server s stops running or crashes, all key/value pairs placed on s will be lost.
Memcached was developed by Danga Interactive, and its latest version was published in 2010, with the authors Anatoly Vorobey and Brad Fitzpatrick. Used to promote LiveJournal. COM access speed. LJ's dynamic page hits thousands of times per second, user 7 million. Memcached reduces database load significantly, allocates resources better, and accesses more quickly.
How to use the Memcached-server end?
Run on service side:
#./memcached-d-M 2048-l 10.0.0.40-p 11211 This will start a process that consumes 2G of memory and open 11211 ports for receiving requests. Because 32-bit systems can handle only 4G of memory addressing, 2-3 processes can be run on 32-bit servers that use PAE greater than 4G memory and are monitored on different ports.
How to use the Memcached-client end?
After the application contains a class that describes the client, it can be used directly, very simply.
PHP Example: $options ["Servers"] = Array ("192.168.1.41:11211", "192.168.1.42:11212"); $options ["Debug"] = false; $MEMC = new Memcachedclient ($options); $myarr = Array ("One", "two", 3); $MEMC->set ("Key_one", $myarr); $val = $memc->get ("Key_one"); Print $val [0]. " \ n "; Prints ' one ' print $val [1]. " \ n "; Prints ' two ' print $val [2]. " \ n "; Prints 3
A visual memcached management system written in PHP
Memadmin is a visual memcached management and Monitoring tool, using PHP development, small size, easy to operate.
Main functions: Server parameter monitoring: STATS, SETTINGS, ITEMS, slabs, sizes real-time refresh server performance monitoring: Get, DELETE, INCR, DECR, CAs and other commonly used operation hit rate real-time monitoring support data traversal, Facilitates monitoring of stored content
Support conditional query, filter out the key or value array to meet the conditions, JSON and other serialized character reverse sequence display compatible Memcache protocol other services, such as Tokyo Tyrant (except traversal function) to support the server connection pool, multi-server management switch convenient and concise
Http://pecl.php.net/package/memcache
1.[root@localhost html]# cat/etc/yum.repos.d/Local Source Warehouse
Backup/redhat.repo Test.repo
[Root@localhost html]# Cat/etc/yum.repos.d/test.repo
[Test]
Name=test
Baseurl=file:///mnt
Enable=1
Gpgcheck=0
Gpgfile=file:///etc/pki/rpm-gpg/rpm-gpg-key-redhat-release
2.[root@localhost memcache-3.0.6]# mount/dev/cdrom//Mount iso9660 CD image
Mount:block Device/dev/sr0 is write-protected, mounting read-only