In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Many novices are not very clear about the comparison of several session synchronization solutions in the cluster. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
Session security and synchronization is the biggest problem in the cluster. Here are several session synchronization schemes I have collected, hoping to find out their adaptive scenarios by analyzing their respective advantages and disadvantages.
1. Client cookie encryption
This is the way I used to use, simple and efficient. A better way is to use the cookie mechanism to implement a session, and use this session in the application.
Problem: there can't be too much data in session, and it's best to have only one user id.
2. Session replication of application server
It is possible that most application servers provide session replication to implement clustering, and tomcat,jboss,was provides this feature.
Question:
Performance declines sharply as servers increase, and it is easy to cause broadcast storms
Session data needs to be serialized, affecting performance.
3. Use a database to save session
Use a database to save session, even if the server is down, session is still there.
Question:
The program needs to be customized
It is expensive to read and write to the database for each request (using an in-memory database can improve performance, and data will be lost due to downtime. Available in-memory databases with BerkeleyDB,Mysql memory tables)
Database is a single point, of course, you can do database ha to solve this problem.
4. Use shared storage to save session
Similar to the database, even if the server is down, session is still there. Use either nfs or windows file sharing, or a dedicated shared storage device.
Question:
The program needs to be customized
Frequent serialization and deserialization of data, whether there is an impact on performance
Shared storage is a single point, which can be solved through raid.
5. Use memcached to save session
This approach is similar to a database, but because it is accessed in memory, the performance is naturally much better than the database.
Question:
The program needs to be customized, which increases the workload.
The data stored in memcached needs to be serialized, so it is inefficient.
As soon as the memcached server dies, all session is lost. Can memchached be a HA? I don't know. It's not on the website.
6. Use terracotta to save session
Similar to memcached, but the data does not need to be serialized, and it is Find-Grained Changes, so the performance is better. The configuration is completely transparent to the original application, and the original program hardly needs to be modified. And terracotta itself supports HA.
Question: what is the performance of terracotta's HA for data replication?
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.