Boolean Education Yan 18 Memcached video data sharing
Memcached is a high-performance distributed memory object caching system used in dynamic web applications to reduce database load. It improves the speed of dynamic, database-driven websites by caching data and objects in memory to reduce the number of database reads. Memcached is based on a hashmap that stores key/value pairs. Its daemon is written in C, but the client can be written in any language and communicates with the daemon through the memcached protocol.
Memcached is a high-performance distributed memory object caching system for dynamic web applications to reduce database load. It improves the speed of dynamic, database-driven websites by caching data and objects in memory to reduce the number of database reads. We have collected the "Boolean Education Yan 18 Memcached Video Tutorial", hoping to help everyone better learn Memcached distributed clusters.
Video playback address: http://www.php.cn/course/314.html
1. memcached Basic settings
1) Start the server side of Memcache
# /usr/local/bin/memcached -d -m 10 -u root -l 192.168.0.200 -p 12000 -c 256 -P /tmp/memcached. The pid
-d option is to start a daemon process,
-m is the amount of memory allocated to Memcache, in MB, here it is 10MB,
-u is the user running Memcache, I am root here,
-l is the IP address of the listening server, if there are multiple addresses, I have specified the IP address of the server 192.168.0.200,
-p is the port where Memcache is set to listen, here I am 12000 is set, preferably a port above 1024. The
-c option is the maximum number of concurrent connections. The default is 1024. I set 256 here. Set it according to the load of your server.
- P is the pid file that is set to save Memcache. I save it in /tmp/memcached.pid.
2) If you want to end the Memcache process, execute:
# kill `cat /tmp/ memcached.pid`
The hash algorithm maps a binary value of any length into a smaller binary value of a fixed length. This small binary value is called a hash value. A hash value is a unique and extremely compact numerical representation of a piece of data. If you hash a piece of plaintext and change even one letter of the
paragraph, subsequent hashes will produce different values. It is computationally impossible to find two different inputs that hash to the same value.
2. The purpose of the consistent Hash algorithm is twofold: first, after the node changes, other nodes are affected as little as possible; second, after the node changes, the data redistribution is as balanced as possible.
3. Why run memcached?
If the website has high traffic and most visits will cause a high load on the database, using memcached can reduce the pressure on the database.
4. What business scenarios are memcached suitable for?
1) If the website contains dynamic web pages with high traffic, the load on the database will be very high. Since most database requests are read operations, memcached can significantly reduce database load.
2) If the load of the database server is relatively low but the CPU usage is high, the calculated results (computed objects) and rendered web page templates (rendered templates) can be cached.
3) Memcached can be used to cache session data and temporary data to reduce database write operations for them.
4) Cache some small but frequently accessed files.
5) Caching the results of Web 'services' (not Web Services promoted by IBM, translator's note) or RSS feeds.
5. Business scenarios where memcached is not applicable?
1) The size of the cache object is greater than 1MB
Memcached itself is not designed to handle large multimedia (large media) and huge binary blocks (streaming huge blobs).
2) The key length is greater than 250 characters
3) The virtual host does not allow memcached service to be run
If the application itself is hosted on a low-end virtual private server, like vmware , virtualization technologies such as xen are not suitable for running memcached. Memcached needs to take over and control large blocks of memory. If the memory managed by memcached is swapped out by the OS or hypervisor, the performance of memcached will be greatly reduced.
4) The application runs in an unsafe environment
Memcached can provide no security policy, and you can access memcached only through telnet. If the application is running on a shared system, security issues need to be considered.
5) The business itself needs persistent data or a database
6. Can all items in memcached be traversed?
No, this operation is relatively slow and blocks other operations (the slowness here is compared to other memcached commands). All non-debug commands of memcached, such as add, set, get, fulsh, etc., no matter how much data is stored in
memcached, their execution only consumes constant time. The time taken to execute any command that traverses all items will increase as the amount of data in memcached increases. When other commands are waiting (traversing all
The command with item has been executed) but cannot be executed, so blocking will occur.
The above is the detailed content of Boolean Education Yan 18 Memcached video data sharing. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Memcached is a commonly used caching technology that can greatly improve the performance of web applications. In PHP, the commonly used Session processing method is to store the Session file on the server's hard disk. However, this method is not optimal because the server's hard disk will become one of the performance bottlenecks. The use of Memcached caching technology can optimize Session processing in PHP and improve the performance of Web applications. Session in PHP

Caching library in PHP8.0: Memcached With the rapid development of the Internet, modern applications require efficient and reliable caching technology to improve performance and handle large amounts of data. Due to PHP's popularity and open source nature, the PHP caching library has become an essential tool in the web development community. Memcached is a widely used open source high-speed memory caching system that can handle millions of simultaneous connected cache requests and can be used in many different types of applications, such as social networks, online

With the development of the Internet, PHP applications have become more and more common in the field of Internet applications. However, high concurrent access by PHP applications can lead to high CPU usage on the server, thus affecting the performance of the application. In order to optimize the performance of PHP applications, Memcached caching technology has become a good choice. This article will introduce how to use Memcached caching technology to optimize the CPU usage of PHP applications. Introduction to Memcached caching technology Memcached is a

With the rapid development of the Internet, large-scale MySQL database backup and recovery has become one of the essential skills for major enterprises and websites. With the widespread application of Memcached, how to back up and restore Memcached has also become an important issue. As one of the main languages for web development, PHP has unique advantages and skills in handling backup and recovery of MySQL and Memcached. This article will introduce in detail the implementation method of PHP processing MySQL and Memcached backup and recovery.

With the continuous increase of network applications and the continuous expansion of data volume, data reading and writing efficiency has become one of the important factors affecting application performance. The application of caching technology can solve this problem well. In PHP applications, Memcached is the most commonly used cache server. Memcached is a high-performance distributed memory object caching system that can store commonly used data in memory and improve the efficiency of data retrieval. This article will introduce how to use PHP and Memcached for cache management, and how to optimize

With the rapid development of modern Internet applications, user experience is crucial to the success of an application. How to ensure high performance and high availability of applications has become one of the important issues that developers need to solve. As one of the widely used programming languages, PHP's performance monitoring and optimization are also very important. Memcached is a high-performance, distributed memory object caching system that can help applications improve performance and scalability. This article will introduce how to use PHP and Memcached to implement performance monitoring.

With the continuous development of Internet technology, audio and video resources have become a very important form of content on the Internet, and PHP, as one of the most widely used languages in network development, is also constantly used in the field of video and audio playback. However, with the increasing number of users of audio and video websites, many websites have discovered a problem: under high concurrency conditions, PHP's processing speed of audio and video slows down significantly, resulting in problems such as inability to play in time or stuck playback. To solve this problem, Memcached caching technology should

With the rapid growth of modern applications, caching has become a vital part of many developers. Caching can greatly improve application performance and reduce server load. In CakePHP, one way to implement caching is to use Memcached. Memcached is a memory-based distributed caching system. It stores data in memory and can read and write data quickly. In a multi-server environment, Memcached can store data in a distributed manner and share it over the network. not only can
