Design and implementation of interface system with large number of visits (one billion times a day)

Background : Due to business needs, it is necessary to obtain global city information based on the user's source IP. Every time the application is active and active, the interface will be called, and the external access volume exceeds 100 million visits per day. There will also be a lot of internal access requirements.

Distributed : Distributed architecture design conforms to high concurrency, loose coupling, and high scalability

Design and implementation:

The data information of IP information is about 2 G, and the general business is a three-tier structure, application layer, cache layer, and database layer.

And I designed the architecture into two layers, indexed the data files through IP, adjusted the data structure, and generated binary files after compression. Put it in the shared memory, which is convenient for the application to read.

The back-end application searches for the information corresponding to the IP from the shared memory by implementing the binary search algorithm, and then processes the relevant data and returns it to Nginx.

Advantage:

The application directly searches for relevant information through memory, thereby reducing time-consuming network calls and improving concurrency.

The database service is saved, the complexity of the system is reduced, and the cost is reduced.

Stateless services make it easier to deploy and access businesses globally.

distributed:

Load balancing is hashed to different Nginx servers by IP.

Nginx fragments requests to different application services

Increase Nginx Cache, reduce the number of application requests, and improve system concurrency.

High availability:

Load balancing traffic and response time monitoring

Access to the self-developed operation and maintenance monitoring system, the hit rate of Nginx Cache, the response time of the application, the reliability of the application return, etc.

Improve concurrency and availability through automatic scaling (Auto scaling), so as to cope with peak periods, improve business availability, and reasonably reduce costs.

The IP library is updated relatively frequently. When a new service starts, it will automatically pull the latest data files and update them automatically.

Documentation:

With complete system documentation and troubleshooting manuals, even new employees can understand system features, do deployment and maintenance, and troubleshooting.

Follow up:

It is inevitable that the app will have bugs, and continuous requests will be generated in an instant (trust me, this has happened). Even instantaneous large access will not cause system DDOS.

9b3752d964cf950c5c08a23393e9d1c8.jpeg

Guess you like

Origin blog.csdn.net/lxw1844912514/article/details/130998626