分布式系统开发注意点_分布式系统注意事项

分布式系统开发注意点

by Shubheksha

通过Shubheksha

分布式计算概述:分布式系统如何工作 (Distributed Computing in a nutshell: How distributed systems work)

This post distills the material presented in the paper titled “A Note on Distributed Systems” published in 1994 by Jim Waldo and others.

这篇文章摘录了Jim Waldo等人于1994年发表的题为“ 有关分布式系统的说明 ”的论文中介绍的材料。

The paper presents the differences between local and distributed computing in the context of Object Oriented Programming. It explains why treating them the same is incorrect and leads to applications that aren’t robust or reliable.

本文介绍了在面向对象编程的情况下本地计算和分布式计算之间的差异。 它解释了为什么对它们进行相同的处理是不正确的,并导致应用程序不可靠或不可靠。

介绍 (Introduction)

The paper kicks off by stating that the current work in distributed systems is modeled around objects — more specifically, a unified view of objects. Objects are defined by their supported interfaces and the operations they support.

本文首先指出,分布式系统中的当前工作是围绕对象建模的-更具体地说,是对象统一视图。 对象由其支持的接口及其支持的操作定义。

Naturally, this can be extended to imply that objects in the same address space, or in a different address space on the same machine, or on a different machine, all behave in a similar manner. Their location is an implementation detail.

自然地,这可以扩展为暗示相同地址空间中,同一机器上或不同机器上不同地址空间中的对象的行为均相似。 它们的位置是一个实现细节。

Let’s define the most common terms in this paper:

让我们定义本文中最常见的术语:

本地计算 (Local Computing)

It deals with programs that are confined to a single address space only.

它处理的程序仅限于单个地址空间。

分布式计算 (Distributed Computing)

It deals with programs that can make calls to objects in different address spaces either on the same machine or on a different machine.

它处理的程序可以在同一台机器或不同机器上的不同地址空间中调用对象。

统一对象的愿景 (The Vision of Unified Objects)

Implicit in this vision is that the system will be “objects all the way down.” This means that all current invocations, or calls for system services, will eventually be converted into calls that might be made to an object residing on some other machine. There is a single paradigm of object use and communication used no matter what the location of the object might be.

这种愿景的隐含含义是该系统将是“一直向下的对象”。 这意味着所有当前的调用或对系统服务的调用最终都将转换为可能对驻留在其他计算机上的对象进行的调用。 无论对象位于何处,都只有一个对象使用和通信范式。

This refers to the assumption that all objects are defined only in terms of their interfaces. Their implementation also includes location of the object, and is independent of their interfaces and hidden from the programmer.

这是指所有对象仅根据其接口定义的假设。 它们的实现还包括对象的位置,并且与它们的接口无关并且对程序员而言是隐藏的。

As far the programmer is concerned, they write the same type of call for every object, whether local or remote. The system takes care of sending the message by figuring out the underlying mechanisms not visible to the programmer who is writing the application.

就程序员而言,他们为本地或远程的每个对象编写相同类型的调用。 系统通过找出对编写应用程序的程序员不可见的底层机制来处理消息。

The hard problems in distributed computing are not the problems of how to get things on and off the wire.

分布式计算中的难题不是如何使事情在线上或离线的问题。

The paper goes on to define the toughest challenges of building a distributed system:

本文继续定义构建分布式系统的最艰巨挑战:

  1. Latency

    潜伏
  2. Memory Access

    记忆体存取
  3. Partial failure and concurrency

    部分失败和并发

Ensuring a reasonable performance while dealing with all the above doesn’t make the life of the a distributed systems engineer any easier. And the lack of any central resource or state manager adds to the various challenges. Let’s observe each of these one by one.

在处理上述所有问题的同时确保合理的性能不会使分布式系统工程师的工作变得更加轻松。 而且缺少任何中央资源或状态管理器会增加各种挑战。 让我们一一观察。

潜伏 (Latency)

This is the fundamental difference between local and distributed object invocation.

这是本地对象调用和分布式对象调用之间的根本区别。

The paper claims that a remote call is four to five times slower than a local call. If the design of a system fails to recognize this fundamental difference, it is bound to suffer from serious performance problems. Especially if it relies on remote communication.

该论文声称,远程呼叫比本地呼叫慢四到五倍。 如果系统的设计未能认识到这一根本差异,则势必会遭受严重的性能问题。 特别是如果它依赖于远程通信。

You need to have a thorough understanding of the application being designed so you can decide which objects should be kept together and which can be placed remotely.

您需要对正在设计的应用程序有透彻的了解,以便可以决定哪些对象应该放在一起,哪些可以远程放置。

If the goal is to unify the difference in latency, then we’ve two options:

如果目标是统一延迟差异,那么我们有两个选择:

  • Rely on the hardware to get faster with time to eliminate the difference in efficiency

    依靠硬件来获得更快的速度以消除效率差异
  • Develop tools which allow us to visualize communication patterns between different objects and move them around as required. Since location is an implementation detail, this shouldn’t be too hard to achieve

    开发工具,使我们可以可视化不同对象之间的通信模式,并根据需要移动它们。 由于位置是实现细节,因此实现起来应该不难

记忆 (Memory)

Another difference that’s very relevant to the design of distributed systems is the pattern of memory access between local and remote objects. A pointer in the local address space isn’t valid in a remote address space.

与分布式系统的设计非常相关的另一个区别是本地对象与远程对象之间的内存访问模式。 本地地址空间中的指针在远程地址空间中无效。

We’re left with two choices:

我们有两个选择:

  • The developer must be made aware of the difference between the access patterns

    必须使开发人员了解访问模式之间的差异
  • To unify the differences in access between local and remote access, we need to let the system handle all aspects of access to memory.

    为了统一本地访问和远程访问之间的访问差异,我们需要让系统处理对内存访问的所有方面。

There are several way to do that:

有几种方法可以做到这一点:

  • Distributed shared memory

    分布式共享内存
  • Using the OOP (Object-oriented programming) paradigm, compose a system entirely of objects — one that deals only with object references.

    使用OOP (面向对象编程)范式,可以完全由一个对象组成一个系统-一个仅处理对象引用的系统。

    The transfer of data between address spaces can be dealt with by marshalling and unmarshalling the data by the layer underneath. This approach, however, makes the use of address-space-relative pointers obsolete.

    地址空间之间的数据传输可以通过下面的层对数据进行编组和解组来处理。 但是,这种方法使相对于地址空间的指针的使用变得过时了。

The danger lies in promoting the myth that “remote access and local access are exactly the same.” We should not reinforce this myth. An underlying mechanism that does not unify all memory accesses while still promoting this myth is both misleading and prone to error.

危险在于宣传“远程访问和本地访问完全相同”的神话。 我们不应该加强这个神话。 不能统一所有内存访问而又仍在提倡这一神话的基本机制既容易引起误解,也容易出错。

It’s important for programmers to be made aware of the various differences between accessing local and remote objects. We don’t want them to get bitten by not knowing what’s happening under the covers.

对于程序员来说,重要的是要意识到访问本地对象和远程对象之间的各种差异。 我们不希望他们不知道幕后发生的事情而被他们咬住。

部分失败与并发 (Partial failure & concurrency)

Partial failure is a central reality of distributed computing.

部分故障是分布式计算的中心现实。

The paper argues that both local and distributed systems are subject to failure. But it’s harder to discover what went wrong in the case of distributed systems.

该论文认为,本地系统和分布式系统都容易出现故障。 但是,很难发现在分布式系统中出了什么问题。

For a local system, either everything is shut down or there is some central authority which can detect what went wrong (the OS, for example).

对于本地系统,要么一切都已关闭,要么有一些中央机构可以检测出哪里出了问题(例如OS)。

Yet, in the case of a distributed system, there is no global state or resource manager available to keep track of everything happening in and across the system. So there is no way to inform other components which may be functioning correctly which ones have failed. Components in a distributed system fail independently.

但是,在分布式系统的情况下,没有可用的全局状态或资源管理器来跟踪系统中和整个系统中发生的一切。 因此,无法通知可能正在正常运行的其他组件,哪些已发生故障。 分布式系统中的组件会独立发生故障。

A central problem in distributed computing is insuring that the state of the whole system is consistent after such a failure. This is a problem that simply does not occur in local computing.

分布式计算中的一个中心问题是确保发生此类故障后,整个系统的状态保持一致。 这是在本地计算中根本不会发生的问题。

For a system to withstand partial failure, it’s important that it deals with indeterminacy, and that the objects react to it in a consistent manner. The interfaces must be able to state the cause of failure, if possible. And then allow the reconstruction of a “reasonable state” in case the cause can’t be determined.

对于承受部分故障的系统,重要的是要处理不确定性,并且对象以一致的方式对其做出React。 如果可能的话,接口必须能够说明故障原因。 然后,在无法确定原因的情况下,允许重构“合理状态”。

The question is not “can you make remote method invocation look like local method invocation,” but rather “what is the price of making remote method invocation identical to local method invocation?”

问题不是“您能否使远程方法调用看起来像本地方法调用”,而是“使远程方法调用与本地方法调用相同的价格是多少?”

Two approaches come to mind:

我想到两种方法:

  1. Treat all interfaces and objects as local. The problem with this approach is that it doesn’t take into account the failure models associated with distributed systems. Therefore, it’s indeterministic by nature.

    将所有接口和对象都视为本地。 这种方法的问题在于它没有考虑与分布式系统相关的故障模型。 因此,它本质上是不确定的。
  2. Treat all interfaces and objects as remote. The flaw with this approach is that it over-complicates local computing. It adds on a ton of work for objects that are never accessed remotely.

    将所有接口和对象都视为远程对象。 这种方法的缺陷在于它使本地计算过于复杂。 它为永不远程访问的对象增加了很多工作。

A better approach is to accept that there are irreconcilable differences between local and distributed computing, and to be conscious of those differences at all stages of the design and implementation of distributed applications.

更好的方法是接受本地计算和分布式计算之间的不可调和的差异,并在分布式应用程序的设计和实现的所有阶段意识到这些差异。

P.S. — If you made it this far and would like to receive a mail whenever I publish one of these posts, sign up here.

PS —如果您到现在为止,并且希望在我发布这些帖子之一时收到邮件,请在此处注册。

翻译自: https://www.freecodecamp.org/news/a-note-on-distributed-systems-3c796f1eb0a0/

分布式系统开发注意点

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/395224.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

前端if else_应该记录的一些项目代码(前端)

1.共享登录(单点登录)主要是前端部分主要是根据是否有cookie来判断是否已经登录主系统,然后再根据是否有当前系统的登录信息来(这块主要是sessionStorage做的)判断是否要再登录当前系统。设置、读取和设置cookie的方法…

Mac端解决(含修改8.0.13版的密码):Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)...

1. 安装mysql但是从来没启动过,今天一启动就报错: Cant connect to local MySQL server through socket /tmp/mysql.sock (2) 其实是mysql服务没起来。。。 localhost:~ miaoying$ mysql.server start Starting MySQL ... SUCCESS! 然后再去sudo mysql就…

塔塔建网站服务器,塔塔帝国忘记哪个区怎么办

7条解答1.在哪个区玩战舰帝国忘记了怎么办?忘了的话可以去官网登陆看看自己的 充值 或者礼包记录 有没有对应的区服 或者电话联系问问客服 通过账号 角色名字来查询2.我忘记在哪个区怎么找如果你有游戏人生资格的话,就很容易找了,在游戏人生的个人主页里…

Ixia推出首款太比特级网络安全测试平台

2016年11月18日,Ixia宣布推出全新CloudStorm平台。作为首款太比特级网络安全测试平台,该平台拥有前所未有的非凡性能,可用于测试及验证超大规模云数据中心不断扩大的容量、效率以及弹性。 ▲Ixia CloudStorm安全测试平台 CloudStorm的正式面市…

[转]oracle分析函数Rank, Dense_rank, row_number

oracle分析函数Rank, Dense_rank, row_number 分析函数2(Rank, Dense_rank, row_number) 目录1.使用rownum为记录排名2.使用分析函数来为记录排名3.使用分析函数为记录进行分组排名一、使用rownum为记录排名: 在前面一篇《Oracle开发专题之:分析函数》&a…

Bali BaloCSS天才

Today Bali Balo, a French designer and developer, published a new piece: a cube suspended in darkness that rotates on its own. As it does, it reveals different sides, each offering a glimpse into a different world:今天,法国设计师兼开发商Bali Bal…

luogu P2470 [SCOI2007]压缩

传送门 dalao们怎么状态都设的两维以上啊?qwq 完全可以一维状态的说 设\(f[i]\)为前缀i的答案,转移就枚举从前面哪里转移过来\(f[i]min(f[j-1]w(j,i))(j\in [1,i])\) 现在要知道\(w(i,j)\)怎么写,也就是区间\([i,j]\)的最小长度(要求区间最多只能在开头有一个W),首先不压缩的长…

服务器选择重装系统,云服务器重装系统选择

云服务器重装系统选择 内容精选换一换将外部镜像文件注册成云平台的私有镜像后,您可以使用该镜像创建新的云服务器,或对已有云服务器的系统进行重装和更换。本节介绍使用镜像创建云服务器的操作。您可以按照通过镜像创建云服务器中的操作指导创建弹性云服…

T-Mobile美国加速开展5G实验:28GHz频段成为新宠

据日经社报道,T-Mobile美国公司正在加速开展5G相关工作,在过去的一个月中动作频频。 T-Mobile美国与三星电子美国公司上月初共同宣布,将在今年下半年使用28GHz频段和配备三星的波束成形技术的5G验证实验系统,开展室外5G移动通信的…

软件项目可行性分析定义_如何定义最低可行产品

软件项目可行性分析定义by George Krasadakis通过乔治克拉萨达基斯(George Krasadakis) 如何定义最低可行产品 (How to define a Minimum Viable Product) 从概念转变为正确定义的MVP (Moving from a concept to a properly defined MVP) The Minimum Viable Product, althoug…

JavaSE第十五天20160823

线程 一、JAVA中创建线程的两种方法: 1.继承java.lang.Thread类。 2.实现java.lang.Runnable接口。 3.在JAVA中Thread类实现了Runnable接口,并且Thread类中定义了许多与线程相关的属性与方法。 二、run():线程体,线程将要执行的代码。 三、线…

dao层mysql复合语句_在业务中是使用多个Dao组合好,还是一个链接查询好?

问题描述假如目前有一个查询用户详情的接口用户基础表关联了很多用户其他信息的表,现在要把所有查询出来,是使用多个dao在service中组合,还是直接链接查询好示例代码用户表(user_base)用户信息表1(user_info_1)用户信息表2(user_info_2)用户信…

九阴真经战无不胜服务器位置,九阴真经各门派武功风水宝地分类及坐标大全

寻得一处风水宝地可以养神还可以修炼武功,九阴真经中的各大门派和全部武功适合修炼的宝地都在哪里呢?都分为哪几类,具体坐标是什么?1、风水宝地作用:九阴真经风水宝地共分山、水、洞、林、雪、市六种,分别对…

Gartner Q2服务器市场报告5大要点

服务器场景调查 根据市场研究公司Gartner的调查报告,第二季度Dell的服务器市场取得了丰富的成果,HPE的市场份额比去年同期略有下降,但仍保留了其全球服务器市场第一的位置。 Gartner表示,全球服务器销售收入在第二季度与去年同期相…

MySQL实战面试题_Mysql实战面试题

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼一、索引B Tree 原理1. 数据结构B Tree 指的是 Balance Tree,也就是平衡树。平衡树是一颗查找树,并且所有叶子节点位于同一层。B Tree 是基于 B Tree 和叶子节点顺序访问指针进行实现,它具有 B T…

Redux有何优点?

by Justin Falcone贾斯汀法尔科内(Justin Falcone) Redux有何优点? (What’s So Great About Redux?) Redux elegantly handles complex state interactions that are hard to express with React’s component state. It is essentially a message-passing syste…

python基础——使用模块

python基础——使用模块 Python本身就内置了很多非常有用的模块,只要安装完毕,这些模块就可以立刻使用。 我们以内建的sys模块为例,编写一个hello的模块: #!/usr/bin/env python3 # -*- coding: utf-8 -*- a test module __author…

力扣——键盘行

给定一个单词列表,只返回可以使用在键盘同一行的字母打印出来的单词。键盘如下图所示。 示例: 输入: ["Hello", "Alaska", "Dad", "Peace"] 输出: ["Alaska", "Dad"]注意: 你可…

网络空间技术实验室:打造信息安全技术培育平台

从PC互联网到移动互联网,音视频、图片越来越成为大众关注的热点。过去,人们习惯于在网络浏览文字新闻;今天,人们对于视频新闻、图片新闻的接受度更高。 网络的发展无疑给人们带来了便利。但同时,一个不可否认的事实是&…

如何对mysql做物理备份_如何创建物理MySQL备份

前提条件在开始之前,确保你有一个有sudo权限的用户和一个MySQL数据库服务器。查找数据目录使用root密码登录到MySQL服务器。$ sudo mysql -u root -p下面的SQL显示MySQL实例的数据目录。mysql> select datadir;输出类似于-----------------| datadir |----------…