Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the performance, advantages and limitations of Memcached

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the performance, advantages and limitations of Memcached related knowledge, the content is detailed and easy to understand, simple and fast operation, with a certain reference value, I believe you will gain after reading this article on the performance, advantages and limitations of Memcached, let's take a look at it.

Memcached is a high-performance, distributed in-memory object caching system, which is universal in nature, but its purpose is to speed up dynamic network applications by reducing database load.

1. The node balanced network (JBoss Tree Cache) uses JGroup's multicast communication mechanism to synchronize data.

2.Master-Slaves mode (distributed file system), Slave is managed by Master, how to choose Slave and how to migrate data are all done by Master, but Master itself has a single point of problem.

Features, benefits, and limitations Memory:

Memory storage, high speed, high requirements for memory, the content of the cache is not persistent. The requirement for CPU is very low, so it is often used to deploy the Memcached server with some CPU high-consumption Memory and low-consumption applications. (otherwise resources will be squeezed out of each other)

Centralized Cache:

It avoids the propagation problem of distributed Cache, but needs not a single point to ensure its reliability, which requires the work of cluster, multiple Memcached can be regarded as a virtual cluster, and there is no difference in read-write performance between cluster and ordinary memcached.

Distributed extension:

One of the outstanding advantages of Memcached is that it adopts the mode of distributed extensibility. Multiple Memcached servers deployed on one machine or Memcached servers deployed on multiple machines can be formed into a virtual server, which is completely shielded and transparent to the caller. Improved memory utilization of a single machine.

Socket Communications:

Note the size of the transmitted content and serialization. Although Memcached is usually placed on the private network as a Cache, the transfer rate of Socket should be relatively high (Tcp and udp are currently supported, and you can choose to use nio synchronous or asynchronous invocation methods depending on the client), but serialization cost and bandwidth cost still need to be noted. Here also mention serialization, for the performance of object serialization is often a headache, but for the same kind of Class object serialization transfer, the first serialization time is relatively long, and then will be optimized, in fact, the biggest consumption of serialization is not object serialization, but class serialization. If it's just a string, it's best to skip the serialization operation, so smaller things tend to be saved in Memcached.

Special memory allocation mechanism:

The first thing to note is that the largest storage object supported by Memcached is 1m (page). Its memory allocation is special, but this allocation is also for performance considerations, and a simple allocation mechanism can make it easier to recycle and reallocate, saving the use of CPU (described in the previous article).

The Cache mechanism is simple:

First of all, it doesn't have any synchronization, message distribution, two-phase commit, etc. It's just a very simple Cache. Put something in, and then you can take it out. If you find that the provided Key does not hit, then it will tell you bluntly that your key does not have anything corresponding to it in the cache. Go to the database or other places to get it. When you get it from an external data source, you can directly put the content into the Cache. So we can hit it next time. Here we will talk about how to synchronize this data. One way is to update the Cache content as soon as you modify it, which will take effect immediately. The other is to say that there is an expiration time, when it comes to the expiration time, the content will be deleted naturally, and the content will not be hit when you go again, and then put the content into Cache again to update the content. The latter is used in some cases where the requirement of timeliness is not high and the writing is not frequent.

Importance of the client:

Reasonable client design is very important, but also provides users with a lot of space to expand and design the client to meet the needs of a variety of scenarios, including fault tolerance, weight, efficiency, special functional requirements, embedded framework and so on.

Several application points:

Cache of small objects (user's token, permission information, resource information). Small static resource cache. Caching of Sql results (this part is used well, and the performance is greatly improved.)

This is the end of the article on "what are the performance, advantages, and limitations of Memcached?" Thank you for reading! I believe you all have a certain understanding of "what are the performance, advantages and limitations of Memcached". If you want to learn more, you are welcome to follow the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report