This is the 26th day of my participation in the August More Text Challenge
One, foreword
Layered architecture, what are the issues to consider?
- Reliability: for
IM
System, key message reliable delivery, message is not lost. (Timeout, retransmission, confirmation) - Availability: Availability
7 * 24
Hour service? - Consistency: Data redundancy inevitably causes consistency problems. How to solve them?
- Scalability: Does adding machines increase storage and throughput?
- Balance: Is the load balanced among nodes in a cluster?
The architecture is layered as follows:
- Application layer:
IM
The system can support a lot of business, customer service system, sales system, similar to nail nail enterprise internalIM
application API
Layer:Android/iOS SDK
,H5 WebSocket
- Access layer: connection establishment, request receiving, response and other processes
- Functional layers:
IM
The system provides a lot of functions: receive messages, push messages, group chat, red envelope, offline messages, security authentication and so on - Storage layer: Two types of message stores: instant messages and offline messages
Access layer
Why are TCP access systems and WebSocket access systems developed and deployed separately?
TCP
Access system: Mainly to connect with a large number of C-end users, such as e-commerceAPP
Millions of users will be active every day, and hundreds of thousands of users will follow you every dayTCP
Connect to the system and communicate with customer service.
TCP access system faces millions or even tens of millions of C-end users, the load is very high, so the deployment of a large number of machines
WebSocket
Access system is mainly connected with dozens or hundreds of customer service in the company, mainly customer service will open a web page through the browser, the web page throughHTML5
的WebSocket API
And with youWebSocket
Access System establishes a connection.
The WebSocket access system may only have a few hundred internal customer service, so the load is low, so there may not be a need to deploy a large number of machines
The protocols and technologies used are not quite the same, and the machine requirements deployed are not quite the same, so development needs to be developed separately.