In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Introduction to █ Redis
● redis is a key-value storage system. Similar to Memcached, it supports relatively more value types, including string (string), list (linked list), set (collection), zset (sorted set-ordered collection), and hash (hash type). Like memcached, data is cached in memory for efficiency. The difference is that redis will periodically write updated data to disk or modify operations to additional record files, and on this basis to achieve master-slave (master-slave) synchronization.
● redis is a high-performance key-value database. The emergence of redis makes up for the deficiency of key-value storage such as memcached to a great extent, and can play a good complementary role to relational database in some cases. It provides Java,C/C++,C#,PHP. JavaScript,Perl,Object-C,Python,Ruby and other clients, very easy to use.
● simply compares the difference between Redis and Memcached
1. Redis not only supports simple KBH data, but also provides storage of data structures such as list,set,zset,hash.
2. Redis supports data backup, that is, data backup in master-slave mode.
3. Redis supports data persistence. You can keep the data in memory on disk and load it again when you restart it.
● in redis, not all data is stored in memory all the time, which is the biggest difference compared with Memcached. Redis only caches all key information. If Redis finds that the memory usage exceeds a certain threshold, it will trigger the operation of swap. Redis calculates which key corresponding value needs swap to disk based on "swappability = age*log (size_in_memory)", and then persists these key corresponding value to disk and clears them in memory at the same time. This feature allows Redis to maintain more data than other machines' own memory. Of course, the memory of the machine itself should be able to maintain all the key, because the data will not be operated by swap.
● when reading data from Redis, if the value corresponding to the read key is not in memory, then Redis needs to load the corresponding data from the swap file and then return it to the requester
How █ maintains a session session
● at present, in order to facilitate web to adapt to large-scale access, it is necessary to implement the cluster deployment of applications. The most effective solution of the cluster is load balancing, and every request of load balancing users may be assigned to a non-fixed server, so we must first solve the unity of session to ensure the normal use of users no matter which server their requests are forwarded to, that is, we need to implement the sharing mechanism of session.
There are several solutions for ● to unify session in a cluster system:
1. Precise location of requests: sessionsticky, for example, hash policy based on accessing ip, that is, all current user requests are centrally located to one server, so that a single server stores the user's session login information. If there is a downtime, it is tantamount to a single point of failure and will be lost and the session will not be replicated.
2. Session replication sharing: sessionreplication, for example, Tomcat comes with session sharing, which mainly refers to synchronizing session among multiple application servers in a cluster environment to make session consistent and transparent. If one of the servers fails, according to the principle of load balancing, the scheduler will traverse to find available nodes and distribute requests. Because the session has been synchronized, it can ensure that the user's session information will not be lost and session replication.
★ 's inadequacies of the above scheme:
① must be done in the same kind of middleware (e.g. between Tomcat-Tomcat)
The performance loss caused by ② session replication will increase rapidly, especially when large objects are saved in session and the objects change rapidly, the performance degradation is more significant, which will consume system performance. This feature limits the horizontal expansion of web applications.
③ session content is synchronized to members through broadcasting, which can cause network traffic bottlenecks, even intranet bottlenecks. The performance is not good under the big concurrency.
3. Session sharing based on cache DB cache
Even if the session information is accessed by cache DB, the application server accepts the request to save the session information in the cache DB. When the application server fails, the scheduler will traverse to find the available node and distribute the request. When the application server finds that the session is not in the local memory, it looks for it in the cache DB, and if it finds it, it copies it to the local machine, thus realizing session sharing and high availability.
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.