分布式系统(cnscc311)之CAP,实例

本文概述了分布式系统的定义,阐述了其需要的原因,包括扩展规模、提高可靠性、性能优化等。重点介绍了分布式的主要特征如资源共享、开放性、并发性等,并讲解了CAP理论。实例涵盖了金融交易、Web搜索和在线游戏,展示了在实际应用中的选择挑战。
摘要由CSDN通过智能技术生成

#最近正值分布式系统期末考试,来浅浅记录一下分布式PPT里的内容#这次是关于分布式定义,一些概念和CAP

一.分布式的定义

言简意赅:A Distributed System is “a collection of independent computers that appear to its users as one computer” ——By Andrew Tanenbaum (leading scholar in DS area)

分布式系统是由多台计算机组成的系统,其目标是实现更高的性能,或者提供在单台计算机上很难或不可行的服务。

我们为什么需要分布式系统呢?

1.Scale up: 一台电脑动力和规模有限,分布式系统允许我们来扩大规模。

2.More reliable:数据和软件被存储并复制在不同的电脑端,所以当系统中少数电脑出现故障时,整个系统仍然可以正常运行。

3.Uptime requirements:用户希望系统持续运转,在单一电脑上很难实现。

4.Better performance:由于有多个服务端,用户可以使用离他本身更近的服务端,有效地提升性能

5.Server-based system(more people use your system)可以让更多的人使用你的系统,如果单机情况下,你就只能把电脑借给别人了【这可不太好!】

二.分布式的主要特征

分布式具有以下六个特征:

1.Resource sharing资源共享

  • resource includes: hardware(硬件)----硬盘,服务器,打印机; software(软件)---文件,OS(操作系统)
  • 目的:减少开销,进行信息交换,有助于协同工作

2.Openness(根据一致的语法标准提供服务)

  • 开放分布式系统根据特定的标准,语法,词法来提供服务(类似于C语言代码书写规则),使用IDL(interface definition language)
  • eg:1.Internet——Internet protocol一系列的互联网协议;2.SOAP——WSDL(Web Service Description language)
  • 好处:ineroperability(互用性,不同语言写出的软件或者部署在不同电脑上的软件可以一起协作)Portability(轻便)Extensibility(可延展性)——新的服务可以以这种标准轻松添加

3.Concurrency(并发性)

  • multi-programming:同时多个程序运行
  • multi-processing:一个电脑上多个cpu
  • 并行执行,多个用户使用相同的资源和应用/多个服务器响应客户端请求

4.Scalability(可伸展性)

  • 分为两种拓展:size&Geographical
  • Size scalability – increase number of users and resources用户和资源的增长
  • Geographical Scalability – increase service nodes in wider areas 在更远的地区增加服务节点

5.Fault tolerance(容错机制)

  • When a DS encounters a fault, it continues to function as usual.
  • 容错过程中两个核心模型:1.Normal functioning——当系统遇到故障时,仍然不影响它的运行; 2.Graceful Degradation——当发生故障时,只是性能降级,小错误只会影响性能,不会导致系统的崩溃

6.Transparency(透明性----不可见性,用户和各部分开发者不可见,使系统被视为一个整体)

  • Access transparency – local and remote resources are accessed using identical operations.(使用相同的操作访问本地和远程资源)
  • Location transparency – recourses are accessed without knowledge of their physical or network location.(在不了解物理或网络位置的情况下访问资源)
  • Failure transparency – hardware and software faults are concealed to allow users and application developers to complete their tasks despite the failure(硬件和软件故障隐藏,允许用户和应用程序开发人员在失败的情况下完成任务)
  • Concurrency transparency – several processes operate concurrently using shared resources without interference between them.(多个流程运行,同时使用共享资源而不会相互干扰)

三.CAP理论(A distributed system can only have 2 of Consistency, Availability and Partition Tolerance

  • Availability: A distributed system remains operational (accessible to users) all the time.(对访问本系统的客户的另一种承诺:我一定会给您返回数据,不会给你返回错误,但不保证数据最新,强调的是不出错
  • Consistency: All nodes or components of a distributed system access the same data at the same time.(对于客户端的读操作,要么读最新的数据,要么读取失败,强调数据正确
  • Partition tolerance: Even if connection between some components is lost by failure,the whole system should continue to operate.(访问本系统的客户端的再一种承诺:我会一直运行,不管我的内部出现何种数据同步问题,强调的是不挂掉
  • 如果满足两项,那么另一项就不能满足(CA【实际无法实现】,PA,CP)

四.分布式实例

Financial trading

支持金融交易系统,主要是事件的传播和处理

web search

现代Web引擎每月需要处理100亿次以上的查询,这是分布式系统的主要挑战

massive multi-player online games(大型多人在线游戏)

需要低延迟(low latencies)来支持游戏玩家

根据系统的不同需求选择是CA(其实是无法实现的),CP还是PA!

  • 9
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值