Learning Process of memcached

Source: Internet
Author: User

Some time ago, our lab's sister-in-law came to show us all the new technologies in our company --------- memcached. I felt very strong. I had to go through the example of my sister-in-law, as a result, too many chores are delayed. This memcached was also mentioned in the last class by a teacher at Sina Institute, saying that Sina Weibo now uses a large number of memcached caching mechanisms. Therefore, we are determined to try out the power of this memcached.

First, the source code installation package is released on the official website. However, the normal operation of memcached requires libevent to process concurrent network connections. Therefore, you must install both software.

Copy codeThe Code is as follows: root @ zhou:/home/zhouqian/download # tar-zxvf libevent-2.0.16-stable.tar.gz-C/opt/
./Configure -- prefix =/usr/local/libevent
Make
Make install

Root @ zhou:/home/zhouqian/download # tar-zxvf memcached-1.4.10.tar.gz-C/opt/
./Configure -- prefix =/usr/local/memcached
Make
Make install

/Usr/local/memcached/bin/memcached-d-m 64-u root-l 10.5.110.234-p 11212-c 256-P/tmp/memcached. pid

Root @ zhou :~ # Ps aux | grep memcached
Root 14715 0.0 0.0 44404 892? Ssl/usr/local/memcached/bin/memcached-d-m 64-u root-l 10.5.110.234-p 11212-c 256-P/tmp/memcached. pid
Root 14814 0.0 0.0 5892 800 pts/0 S + grep -- color = auto memcached

Root @ zhou :~ # Netstat-ntl
Activate Internet connection (server only)
Proto Recv-Q Send-Q Local Address Foreign Address State
Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN
Tcp 0 0 10.5.110.234: 11212 0.0.0.0: * LISTEN

Here, I directly use the program of Shijie for testing. Note the-l 10.5.110.234-p 11212 here. These two parameters are required at that time.
This is the data I found when I used memcached:
Demonstrate how to access data from the cache

Store Data and retrieve data
Cache successful. database updated: 93
Demonstrate how to access data from the cache
Store Data and retrieve data
Query time: 15
Below is the effect of not using memcached:

Copy codeThe Code is as follows: root @ zhou :~ # Kill-9 14715
Root @ zhou :~ # Ps aux | grep memcached
Root 14816 0.0 0.0 5892 800 pts/0 S + grep -- color = auto memcached

Demonstrate how to access data from the cache
Store Data and retrieve data
Cache successful. database updated: 1193
Demonstrate how to access data from the cache
Store Data and retrieve data
Query time: 906
The effect is quite obvious. However, I am particularly surprised: Why does my storage speed increase !! Go down and analyze.

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.