1. Memcached Concept
The official explanations are as follows:
What is Memcached?
Free & Open Source, High-performance, distributed memory object caching system, generic in nature, and intended for us E in speeding to dynamic Web applications by alleviating database load.
Memcached is a in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database C Alls, API calls, or page rendering.
Memcached is simple yet powerful. Its promotes quick deployment, ease of development, and solves many problems facing large data caches. Its APIs are available for most popular
Languages.
Memcached is an open source, high performance, distributed memory object caching system.
What's the difference between Memcache and memcached?
Memcache is a danga.com project, the first to serve LiveJournal, many people around the world use this cache project to build their own heavy load of the site, to share the pressure of the database.
Memcached is an open source, high performance, distributed memory object caching system
Memcache is the name of this project, and memcached is its server-side main program file name
2. Memcached effect
Memcached is a daemon that runs on one or more servers and accepts client connection operations at any time. The client first establishes a connection with the Memcached service and then accesses the object. The objects that are saved in Memcached are placed in memory, not on the hard disk.
After the Memcached process runs, it will pre-request a larger memory space, manage it yourself, use it and then apply it, not every time you need to go to the operating system to apply. Memcached saves objects in a huge hash table, and it uses the Newhash algorithm to manage the hash table for further performance gains. So when the memory allocated to memcached is large enough, the memcached time consumption is basically just a network socket connection.
In summary, memcached is used for dynamic Web applications to mitigate database load. It improves the speed of dynamic, database-driven Web sites by caching data and objects in memory to reduce the number of times a database is read.
3, Memcached operation principle
Memcached processes atoms are each (key,value) pair (hereinafter referred to as KV pair), key will be converted to Hash-key by a hash algorithm, easy to find, compare and do as much as possible hash. At the same time, Memcached uses a two-level hash, which is maintained by a large hash table.
Memcached has two core components: server and client, in a memcached query, the client first determines the Server location of the kv pair by calculating the hash value of the key. When the server is determined, the client sends a query request to the corresponding server, allowing it to find the exact data. Because there is no interaction and multicast protocol, the impact of memcached interaction on the network is minimized.
4. Memcached characteristics
1. Open source
Open Source Address: Https://github.com/memcached/memcached/wiki
2. High performance
No matter what kind of database (oracle,mssql,mysql,db2 ...), how to optimize, and finally can not open and slow hard disk for data exchange, but often once involved in the hard disk IO operation, access performance will drop sharply. The whole operation of memcached is in memory all the while, so it is very efficient to access data.
Of course, large Web sites are optimized for database operations (read-write separation, according to the business sub-database table).
3. Distributed
Distributed system on-line comparative professional explanation is: a kind of computer hardware configuration and the corresponding function configuration method. It is a multiprocessor computer system in which each processor forms a unified system through an interconnected network. The system adopts distributed computing structure, that is, the task of processing the CPU in the original system is distributed to the corresponding processor, and the various processors of different functions are coordinated with each other, and the peripherals and software of the system are shared. This accelerates the processing speed of the system and simplifies the logical structure of the host.
The distributed features of the memcache are: the memcached server can be installed on any number of servers, providing parallel storage and computing capabilities, memcached client and server side can be installed on any separate server.
5
Memcached deficiencies
1, the data is stored in memory, once the service process restarts, the data will be lost all
Countermeasure: Can take change memcached source code, increase the function that write to hard disk regularly
2, memcached run with root privileges, and memcached itself does not have any rights management and authentication functions, security is insufficient
Countermeasures: The memcached service can be bound to the intranet IP, through the firewall to protect
Welcome to my public number (Sync update article):donet technology sharing platform
Read the original
The basic carding of memcached