In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
What does Memcache mean? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Memcache is a free, open source, high-performance, distributed in-memory object caching system, which can improve the access speed of websites, especially for some large-scale websites that need to visit databases frequently.
Why use Memcache?
It is mainly used for dynamic Web applications to reduce the load of the database.
It reduces the number of times to read the database by caching data and objects in memory
So as to improve the speed of visiting the website.
The realization principle of Memcache
The atom handled by memcache is that each key and val,key will be converted into hash key through a hash table, making it easy to find and compare and hash as much as possible. At the same time, mem uses a secondary hash, which is maintained by an hash table.
Memcache has two core components: server and client
In a memcache component query, client first uses the hash value of key to determine the location of kv on the service side, and when the server side is determined, the client will send a request to the server side. Let it find out the exact data, because there is no interaction and multicast protocol, so mem has the least impact on the network.
Memcache features and limitations
There is no limit to the amount of item data that can be saved in Memcached, as long as there is enough memory.
The maximum memory used by a single process in Memcached is 2 GB in 32-bit systems, but there is no limit in 64-bit systems. This is because 32-bit systems limit that a single process can use up to 2 GB of memory. To use more memory, you can open multiple Memcached processes in multiple ports.
The maximum data expiration time of 30 days, if set to permanent, will also expire at this time. Constant REALTIME_MAXDELTA
60,60,24,30 control
The maximum key length is 250byte, which cannot be stored if it is larger than this length. It is controlled by constant KEY_MAX_LENGTH 250th.
The most big data of a single item is 1MB. Data beyond 1MB is not stored, and is controlled by constant POWER_BLOCK 1048576.
It is the default slab size
The maximum number of simultaneous connections is 200. it is controlled by freetotal in conn_init (), and the maximum number of soft connections is 1024.
Control by settings.maxconns=1024
Parameters related to space occupancy: settings.factor=1.25, settings.chunk_size=48, which affect the data occupancy and stepping mode of slab
Memcached is a non-blocking socket communication service, based on libevent library, because of non-blocking communication, the speed of reading and writing to memory is very fast.
Memcached is divided into server-side and client-side, and multiple server-side and client-side can be configured. It is widely used in distributed services.
Memcached is very effective as a small-scale data distributed platform.
Memcached is an one-to-one correspondence between keys and values. By default, key cannot exceed 128bytes. The default size of value is 1m, that is, a slabs. If you want to save a value of 2m (continuous), you cannot use two slabs, because the two slabs are not contiguous and cannot be stored in memory, so you need to modify the size of the slabs. When multiple key and value are stored, even if the slabs is not used up, other data will not be stored.
Memcached has been able to support language clients such as CAccord +, Perl, PHP, Python, Ruby, Java, C #, Postgres, Chicken Scheme, Lua, MySQL and Protocol.
After reading the above, have you mastered the method of what Memcache means? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.