In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to deal with high concurrency". The content of the explanation is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to deal with high concurrency".
# High concurrency solution architecture
Stratification
The layering of the system architecture is divided into presentation layer, business layer, service layer, data layer, etc., which can make the division of labor clear, decoupling and easy to manage.
Hierarchical according to the type of business, you can achieve service-oriented, decoupling.
Distributed (that is, module service)
Different functional modules are provided on different servers in the form of services, which can decompose the burden of a single server.
Cluster
On the basis of distribution, the modules with high access frequency are deployed in clusters, and the service is provided through load balancing, which can decompose the pressure of high concurrency modules on the server.
Front end
DNS
The same domain name is forwarded to different IP for load balancing.
CDN
If you visit nearby, users will access the nearest server where hot and static resources are stored.
Reverse proxy (caches static resources without back-end service support)
Application layer
Application caching
That is, the application server locally caches hot resources (in the form of objects) to reduce the number of visits to the database
Distributed cache
Data characteristics: hot data, read more than write, will not immediately fail), such as terracotta bigmemory
Async
On the one hand, it can be used in single machine multi-thread to put the business thread into the queue. On the other hand, it can be used in distributed system to realize the corresponding asynchronous service request through distributed message.
Asynchronism can speed up the response speed of the website and effectively achieve high concurrency.
Database
Read-write separation (master-slave database)
Database split (vertical / horizontal)
Required database (disaster recovery)
Framework caching (for example, primary and secondary caching of Hibernate)
# problems caused by high concurrency and solution transaction problems (consistency)
Container transaction management
Locking mechanism
Isolation mechanism
Status problem (session)
Record sesion with cooke
The disadvantage is that there is a size limit, in addition, it is unstable, and the client may close the browser, resulting in data loss and insecurity.
Session replication
That is, all the servers in the cluster hold a copy of sesion, which needs to be synchronized to other servers every time the data changes, which is suitable for small-scale websites.
Session binding
The load balancer server binds the customer's IP/cookie to session to achieve session stickiness.
However, this solution lacks high availability because the customer's closing the browser may change the cookie, the client-side IP may also change, and the server-side downtime may lead to the loss of session.
Session server
It contains two levels.
One is to use distributed cache to maintain sessions, which is suitable for general cluster needs.
The other is a stand-alone session server, suitable for more demanding requirements, such as single sign-on (SSO)
Thank you for your reading, the above is the content of "how to deal with high concurrency". After the study of this article, I believe you have a deeper understanding of how to deal with the problem of high concurrency, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.