[Original] memcache introduction and installation manual

Source: Internet
Author: User

[Original] memcache introduction and installation manual
What is memcache??

Free & open source, high-performance, distributed memory Object Caching System, Generic in nature, but intended for use in speeding up dynamic Web applications by alleviating database load.

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database cals, API cals, or page rendering.

Memcache is a high-performance distributed memory object cache system. By maintaining a unified and huge hash table in the memory, memcache can be used to store data in various formats, including image, video, file, and database retrieval results.
Official website of memcache: http://memcached.org /.

Libevent is used for network I/O processing. libevent, as a new non-blocking network I/O method, organizes I/O in an efficient way (epoll/kqueue) and distributes hashed objects to different servers, the query complexity is O (1 ).

It is widely used in Facebook, Wikipedia, SourceForge, and other large websites.

  2. Implementation Mechanism of memcahce In distributed applications, a single node of memcache is independent of each other and does not communicate with each other at the same level. The client connects multiple servers through a connection pool. You can set the weight of the number of connections of each memcached in the connection pool to adjust the weight of the number of connections of each memcached Based on server performance to achieve load balancing. The user does not have to worry about the node on which the data is stored. Algorithm .
The memcache server node stores data in the memory and uses the paging mechanism previously implemented in SunOS for memory allocation and recovery, pre-allocate a large memory (the default value is <= 200 MB), and split the chunks by PAGE: Split the 1 MB memory (slab) into several chunks of different sizes as needed) for use, a total of 80, 100, 128, 160 ,... 1 M memory blocks of dozens of different sizes (you can set the minimum block size). The default value is 125% (you can set the increment ratio ), the storage of each data object is operated in the cut block. No disk I/O operations are involved, and the swap virtual memory is never used. The performance bottleneck is in the network communication part, however, memcache threw this part to an intermediate layer. It can be said that memcached is a single process, single thread, daemon listening to a network port (or non-Daemon), is a lightweight Application Service Process
Data stored in the memory is eliminated through the LRU algorithm, and data stored in the memory can be eliminated by deleting and setting the expiration time.   3. Install memcached Install the software on Windows as follows: 1. download the software at http://jehiah.cz/projects/memcached-win32/on the page: memcached 1.2.1 for Win32 binaries. (December 23,200 6) 2. decompress the package to D: \ memcached3 and switch it to the memcacheddirectory directory. Then, enter the memcached.exe-D install command to complete installation 4. Then, enter memcached.exe-d start in command line mode.

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.