Installation and management of memcached

Source: Internet
Author: User
Tags memcached

A memcache overview

Memcached is a distributed cache system developed by LiveJournal's Brad Fitzpatrick, but is currently used by many Web sites. This is a set of open source code, released with BSD license authorization. Software is a high-performance distributed memory object caching system. By maintaining a huge hash table in memory for dynamic Web applications to ease the load on the database. 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.

Second, memcache working principle

Memcached is run as a daemon on one or more servers, receiving client connections and operations at any time.

Clients use various languages to write Php/java/c/c++/perl/python/ruby, etc.

1 Client issue request (1).

2 web/php responds to the client and checks whether the data requested by the user exists in the cache, and if so, simply returns the requested data (2,3,7) without requesting the database.

3 If the requested data is not found in the cache, then query the database. When the request data is returned, the data is stored in a cache (4,5,6,7).

Third, there are memcache and memcached differences:

In fact, Memcache is the name of this project, and Memcached is the main program file name on its server side.

Iv. Install the Memcache server (installed separately on Linux and Windows)

1. Download the memcached and libevent separately and put them in the/tmp directory:

# cd/tmp

# wget http://www.danga.com/memcached/dist/memcached-1.2.0.tar.gz

# wget http://www.monkey.org/~provos/libevent-1.2.tar.gz

2. Install Libevent First:

# tar ZXVF libevent-1.2.tar.gz

# CD libevent-1.2

#./configure--PREFIX=/USR

# make

# make Install

3. Test whether the Libevent is installed successfully:

# Ls-al/usr/lib | grep libevent

lrwxrwxrwx 1 root root 21 11?? 17:38 libevent-1.2.so.1-> libevent-1.2.so.1.0.3

-rwxr-xr-x 1 root root 263546 11?? 17:38 libevent-1.2.so.1.0.3

-rw-r--r--1 root root 454156 11?? 17:38 LIBEVENT.A

-rwxr-xr-x 1 root root 811 11?? 17:38 libevent.la

lrwxrwxrwx 1 root root 21 11?? 17:38 libevent.so-> libevent-1.2.so.1.0.3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.