There are two main methods to improve the concurrency capability of the Internet distributed architecture design : vertical expansion ( Scale Up ) and horizontal expansion ( Scale Out ) .
1. Vertical expansion :
Improve single-machine processing capability.
There are two ways to scale vertically:
( 1 ) Enhance the hardware performance of a single machine, for example: increase the number of CPU cores such as 32 cores, upgrade a better network card such as 10 Gigabit, upgrade a better hard disk such as SSD , expand the hard disk capacity such as 2T , and expand the system memory such as 128G ;
( 2 ) Improve the performance of the stand-alone architecture, for example: use Cache to reduce the number of IOs , use asynchrony to increase the throughput of a single service, and use a lock-free data structure to reduce the response time;
2. Horizontal expansion :
As long as the number of servers is increased, the system performance can be scaled linearly.
Common Internet distributed architecture and expansion methods:
( 1 ) Client layer : The typical caller is a browser browser or a mobile application APP
( 2 ) Reverse proxy layer : system entry, reverse proxy -> DNS polling, adding multiple ngnix.
( 3 ) Site application layer : implement core application logic, return html or json --> ngnix load balancing, and add multiple background servers.
( 4 ) Service layer : If the service is realized, there is this layer -> service connection pool, increase server data, and establish multiple connection pools.
( 5 ) Data - cache layer : cache accelerates access to storage -> database sub-database and sub-table, which is divided into horizontal split and vertical split . In addition, it can also be made into a cluster, master-slave architecture, read-write separation, etc.
( 6 ) Data - database layer : database solidified data storage -> cache fragmentation, master-slave architecture, read-write separation, etc.