In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the Redis partition example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Redis is single-threaded, how to improve the utilization of multicore CPU?
You can deploy multiple Redis instances on the same server and use them as different servers. At some point, one server is not enough anyway, so if you want to use multiple CPU, you can consider shard. [related recommendation: Redis video tutorial]
Why do you want to do Redis partition?
Partitioning will allow Redis to manage more memory, and Redis will be able to use the memory of all machines. If there is no partition, you can only use the memory of one machine at most. Partition increases the computing power of Redis by simply increasing the number of computers, and the network bandwidth of Redis increases exponentially with the increase of computers and network cards.
What are the Redis partitioning implementations?
1. Client partition means that the client has decided which redis node the data will be stored in or which redis node to read from. Most clients have implemented client partitioning.
2. Agent partitioning means that the client sends the request to the agent, and then the agent decides which node to write or read the data. The agent decides which Redis instances to request according to the partition rules, and then returns it to the client based on the response result of the Redis. One proxy implementation of redis and memcached is Twemproxy.
3. Query routing (Query routing) means that the client randomly requests any redis instance, and then the Redis forwards the request to the correct Redis node. Redis Cluster implements a hybrid form of query routing, but instead of forwarding requests directly from one redis node to another redis node, it directly redirected to the correct redis node with the help of the client.
What are the disadvantages of Redis partitioning?
1. Operations involving multiple key are usually not supported. For example, you can't intersect two sets because they may be stored in different Redis instances (in fact, there is a way, but you can't use the intersection instruction directly).
2. If you operate multiple key at the same time, you cannot use Redis transactions.
3. The granularity used by partitions is key, so you cannot use a very long sorted key to store a dataset (The partitioning granularity is the key, so it is not possible to shard a dataset with a single huge key like a very big sorted set).
4. When using partitions, data processing can be very complex, for example, in order to back up, you have to collect RDB / AOF files from different Redis instances and hosts at the same time.
5. Dynamic capacity expansion or reduction during partition may be very complex. Redis cluster can rebalance data transparently to users by adding or deleting Redis nodes at run time, but some other client or agent partitioning methods do not support this feature. However, there is a pre-slicing technology that can also solve this problem.
Thank you for reading this article carefully. I hope the article "sample Analysis of Redis Partition" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.