Let's talk about the evolution of diagrammatic distributed architecture

There are many applications of MySQL in e-commerce and Internet companies. One is because of its free and open source, and the other is because of the horizontal scalability of distributed systems. With the explosion of mobile Internet users, Internet companies, such as Taobao, E-commerce companies such as Tmall and Vipshop have adopted distributed systems to deal with the high concurrency of users and the storage of large amounts of data.


1. What is a distributed architecture


A distributed system is a software system built on a network.


Cohesion: It means that each database distribution node is highly autonomous and has a local database management system.


Transparency: It means that each database distribution node is transparent to the user's application, and it cannot be seen whether it is local or remote.


In a distributed data system, the user feels that the data is distributed, that is, the user does not need to know whether the relationship is split, whether there is a replica, which site the data exists in, and which site the thing is executed on.


Simply put: In a distributed system, a set of independent computers presents a unified whole to the user, as if it were a system.


640?wx_fmt=jpeg&wxfrom=5&wx_lazy=1&retryload=1


640?wx_fmt=jpeg


The distributed system provides services to users as a whole, and the internal cooperation of the entire system is transparent to users, just like using a mysql.


Such as: distributed mysql middleware mycat, to deal with the structure of large concurrent and large data volume.


Second, the application of distributed architecture


1. Distributed file system

For example: the famous HDFS of Hadoop, GFS of google, TFS of Taobao, etc.


2. Distributed cache system

For example: memcache, hbase, mongdb, etc.


3. Distributed database

For example: mysql, mariadb, postgreSql, etc.


4. Distributed webService


5. Distributed Computing


Example


Take the distributed mysql database middleware mycat as an example


There are many applications of MySQL in e-commerce and Internet companies. One is because of its free and open source, and the other is because of the horizontal scalability of distributed systems. With the explosion of mobile Internet users, Internet companies, such as Taobao, E-commerce companies such as Tmall and Vipshop have adopted distributed systems to deal with the high concurrency of users and the storage of large amounts of data. In Mycat's business case, in the bill settlement project for China Mobile, the application processes 200 million data volumes per day during peak periods, and in the IoT project, it processes up to 2.6 billion data volumes and provides real-time data processing. Query interface.


通过对MyCat的学习,加深分布式系统架构的理解,以及分布式相关的技术,分布式一致性ZooKeeper服务, 高可用HAProxy/keepalived等相关应用。


1> 集群 与 分布式

2> 负载均衡

3> 分布式相关的高可用、容灾等名词解释

4> Mycat 中间件学习


三、分布式架构的演进


(1)初始阶段架构

640?wx_fmt=jpeg

特征:应用程序,数据库,文件等所有资源都放在一台服务器上。


(2)应用服务 和 数据服务 以及 文件服务 分离

640?wx_fmt=jpeg

说明:好景不长,发现随着系统访问量的再度增加,webserver机器的压力在高峰期会上升到比较高,这个时候开始考虑增加一台webserver。


特征:应用程序、数据库、文件分别部署在独立的资源上。


(3)使用缓存改善性能


640?wx_fmt=jpeg


说明:系统访问特点遵循二八定律,即80%的业务访问集中在20%的数据上。


缓存分为 本地缓存 和 远程分布式缓存,本地缓存访问速度更快但缓存数据量有限,同时存在与应用程序争用内存的情况。


特征:数据库中访问较集中的一小部分数据存储在缓存服务器中,减少数据库的访问次数,降低数据库的访问压力。


(4)使用“应用服务器”集群

640?wx_fmt=jpeg

说明:在做完分库分表这些工作后,数据库上的压力已经降到比较低了,又开始过着每天看着访问量暴增的幸福生活了。


突然有一天,发现系统的访问又开始有变慢的趋势了,这个时候首先查看数据库,压力一切正常,之后查看webserver,发现apache阻塞了很多的请求,而应用服务器对每个请求也是比较快的,看来是请求数太高导致需要排队等待,响应速度变慢。


特征:多台服务器通过负载均衡同时向外部提供服务,解决单台服务器处理能力和存储空间上限的问题。


描述:使用集群是系统解决高并发、海量数据问题的常用手段。通过向集群中追加资源,提升系统的并发处理能力,使得服务器的负载压力不再成为整个系统的瓶颈。


(5)数据库读写分离

640?wx_fmt=jpeg

说明:享受了一段时间的系统访问量高速增长的幸福后,发现系统又开始变慢了,这次又是什么状况呢,经过查找,发现数据库写入、更新的这些操作的部分数据库连接的资源竞争非常激烈,导致了系统变慢。


特征:多台服务器通过负载均衡同时向外部提供服务,解决单台服务器处理能力和存储空间上限的问题。


描述:使用集群是系统解决高并发、海量数据问题的常用手段。通过向集群中追加资源,使得服务器的负载压力不在成为整个系统的瓶颈。


(6)反向代理和CDN加速


640?wx_fmt=jpeg

特征:采用CDN和反向代理加快系统的访问速度。


描述:为了应付复杂的网络环境和不同地区用户的访问,通过CDN和反向代理加快用户访问的速度,同时减轻后端服务器的负载压力。CDN与反向代理的基本原理都是缓存。


(7)“分布式文件”系统 和 “分布式数据库”


640?wx_fmt=jpeg

说明:随着系统的不断运行,数据量开始大幅度增长,这个时候发现分库后查询仍然会有些慢,于是按照分库的思想开始做分表的工作


特征:数据库采用分布式数据库,文件系统采用分布式文件系统。


描述:任何强大的单一服务器都满足不了大型系统持续增长的业务需求,数据库读写分离随着业务的发展最终也将无法满足需求,需要使用分布式数据库及分布式文件系统来支撑。


分布式数据库是系统数据库拆分的最后方法,只有在单表数据规模非常庞大的时候才使用,更常用的数据库拆分手段是业务分库,将不同的业务数据库部署在不同的物理服务器上。


(8)使用NoSQL和搜索引擎


640?wx_fmt=jpeg

特征:系统引入NoSQL数据库及搜索引擎。


描述:随着业务越来越复杂,对数据存储和检索的需求也越来越复杂,系统需要采用一些非关系型数据库如NoSQL和分数据库查询技术如搜索引擎。


应用服务器通过统一数据访问模块访问各种数据,减轻应用程序管理诸多数据源的麻烦。


(9)业务拆分


640?wx_fmt=jpeg


特征:系统上按照业务进行拆分改造,应用服务器按照业务区分进行分别部署。


描述:为了应对日益复杂的业务场景,通常使用分而治之的手段将整个系统业务分成不同的产品线,应用之间通过超链接建立关系,也可以通过消息队列进行数据分发,当然更多的还是通过访问同一个数据存储系统来构成一个关联的完整系统。


纵向拆分:将一个大应用拆分为多个小应用,如果新业务较为独立,那么就直接将其设计部署为一个独立的Web应用系统 纵向拆分相对较为简单,通过梳理业务,将较少相关的业务剥离即可。


横向拆分:将复用的业务拆分出来,独立部署为分布式服务,新增业务只需要调用这些分布式服务 横向拆分需要识别可复用的业务,设计服务接口,规范服务依赖关系。


(10)分布式服务

640?wx_fmt=jpeg


特征:公共的应用模块被提取出来,部署在分布式服务器上供应用服务器调用。


描述:随着业务越拆越小,应用系统整体复杂程度呈指数级上升,由于所有应用要和所有数据库系统连接,最终导致数据库连接资源不足,拒绝服务。


四、分布式服务应用会面临哪些问题?


(1) When there are more and more services, service URL configuration management becomes very difficult, and the single point pressure of F5 hardware load balancer is also increasing.


(2) With further development, the dependencies between services become complicated and misunderstood, and it is not even clear which application should be started before which application, and architects cannot fully describe the architectural relationship of the application.


(3) Then, the call volume of the service is increasing, and the capacity problem of the service is exposed. How many machines does this service need? When should the machine be added?


(4) With more services, communication costs have begun to rise. Who should be contacted if a service fails to be adjusted? What are the conventions for the parameters of the service?


(5) A service has multiple business consumers, how to ensure service quality?


(6) With the continuous upgrade of services, some unexpected things always happen, such as memory overflow caused by wrong cache writing, failure is inevitable, every time the core service hangs, affecting a large area, people panic, how to control the failure influence? Can the service be functionally downgraded? Or resource degradation?


Source: http://stor.51cto.com/art/201804/569635.htm


Copyright statement: The content comes from the Internet, and the copyright belongs to the original creator. Unless we cannot confirm, we will indicate the author and source. If there is any infringement, please let us know, we will delete it immediately and apologize. thanks.


640?wx_fmt=png

Architecture Digest

ID:ArchDigest

Internet Application Architecture丨Architecture Technology丨Large Websites丨Big Data丨Machine Learning

640?wx_fmt=jpeg

For more exciting articles, please click below: Read the original text

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325982365&siteId=291194637