特征阻抗输入阻抗输出阻抗

by Milan Mimica

米兰·米米卡(Milan Mimica)

软件阻抗说明 (Software impedance explained)

数据处理组件之间的阻抗不匹配 (The impedance mismatch between data processing components)

It all starts with the simplest signal-processing diagram ever:

一切始于有史以来最简单的信号处理图:

Component A is passing the signal to component B. Let’s switch to software engineering jargon immediately: A producer is invoking a method of a consumer. Invoking a method takes a finite time. We call this response time or latency. The producer can pass an arbitrary (but limited) amount of data to each method invocation. We call this batch size. Concurrency level is another variable we can play with. The producer can control the number of concurrent invocations by limiting the window size of pending responses. Invoking the method concurrently indeed multiplies the throughput. Throughput (T) is a function of window size (W), batch size (B) and latency (t).

组件A将信号传递给组件B。让我们立即切换到软件工程术语:生产者正在调用使用者的方法。 调用方法需要有限的时间。 我们称此为响应时间或等待时间 。 生产者可以将任意数量(但数量有限)的数据传递给每个方法调用。 我们称此为批量大小 。 并发级别是我们可以使用的另一个变量。 生产者可以通过限制未决响应的窗口大小来控制并发调用的数量。 并发调用该方法确实使吞吐量成倍增长。 吞吐量(T)是窗口大小(W),批处理大小(B)和等待时间(t)的函数。

We aim for maximum throughput, so increase the concurrency and use higher batch sizes. If only! Response time depends on batch size and window size. To put it more formally, response time if a function of both window size and batch size.

我们的目标是最大吞吐量,因此增加并发性并使用更大的批处理大小。 要是! 响应时间取决于批处理大小和窗口大小。 更正式地说,响应时间是窗口大小和批处理大小的函数。

To achieve maximum throughput we must find the highest W and B that produce the lowest t. Non-ideal W and B will induce a higher “resistance” in the component, or call it back-pressure if you will.

为了获得最大的吞吐量,我们必须找到产生最低t的最高WB。 非理想的WB会在组件中引起更高的“阻力”,或者如果您愿意,可以将其称为背压

Whether it produces the data or just passing it through, a producer must adapt window size and batch size to best suit the consumer. Otherwise we have what I call software impedance mismatch.

无论是产生数据还是仅传递数据,生产者都必须调整窗口大小和批处理大小以最适合消费者。 否则,我们称之为软件阻抗不匹配。

There is no generic expression for f(W, B) as it depends on the component’s implementation. Theory is of no help here. You have to probe the consumer with different batch and window sizes to spot the ideal values that will maximize the throughput.

f(W,B)没有通用表达式,因为它取决于组件的实现。 理论在这里没有帮助。 您必须用不同的批次和窗口大小来探测使用者,以找出理想的值,这将使吞吐量最大化。

Once you find the ideal batch size you must build an “impedance adapter”. Here is a suggested java implementation that accumulates the items and batches them before sending them to the next component (lots of boilerplate code omitted for brevity).

一旦找到理想的批量大小,就必须构建一个“阻抗适配器”。 这是一个建议的Java实现,该实现在将项目发送给下一个组件之前将其累积并进行批处理(为简便起见,省略了许多样板代码)。

Note that invoking the consumer with smaller than maximum (ideal) batch size is still allowed. This assures no additional latency is added. If the selected batch size is optimal, assuming steady item feed, invoking the consumer will take exactly the time it takes to fill maxBatchSize items in the queue.

请注意,仍然允许使用小于最大(理想)批次大小的使用者。 这样可以确保不增加额外的延迟。 如果选定的批次大小是最佳的,则假定稳定的项目进给,调用消费者将花费完全的时间来填充队列中的maxBatchSize项目。

Likewise, the number of concurrent method invocations towards some consumer instance can be controlled using a semaphore.

同样,可以使用信号量来控制对某个消费者实例的并发方法调用的次数。

推与拉模式 (Push vs. Pull mode)

The above scenario depicts “push” mode, in which the producing component controls the invocation, its timing, and the mentioned key parameters. A more modern approach of dealing with back-pressure is to put the consuming component in charge of the invocation. This puts the system designer in a slightly better position, as engineers of the consuming component don’t need to communicate batch and window size to producers. Nevertheless, a similar impedance adapter is needed.

上面的场景描述了“推送”模式,在该模式下,生产组件控制调用,其时间安排以及提到的关键参数。 处理背压的一种更现代的方法是由消耗组件负责调用。 这使系统设计人员处在更好的位置,因为消耗组件的工程师不需要将批量和窗口大小传达给生产者。 然而,需要类似的阻抗适配器。

结论 (Conclusion)

Impedance adapters are stateful components, consisting of queues, threads, callback maps, etc., which adds complexity, but matching impedance is essential in inter-component communication.

阻抗适配器是有状态的组件,由队列,线程,回调映射等组成,这增加了复杂性,但是匹配阻抗对于组件间的通信至关重要。

I argue that each component should specify its impedance parameters: optimal batch size and concurrency level. That way producer components can adapt to minimize the back-pressure.

我认为每个组件都应指定其阻抗参数:最佳批大小和并发级别。 这样生产者的组件可以适应以最小化背压。

Unlike the electrical impedance, the impedance in software is not limited to two dimensions. Here I show only two parameters, but often the response time depends on other variables too.

与电阻抗不同,软件中的阻抗不限于二维。 在这里,我仅显示两个参数,但是响应时间通常也取决于其他变量。

Impedance is a very dynamic property. It may depend on the data being sent, overall workload, sometimes even on variables not controlled by the caller. If needed, the consumer’s API should be designed in a way that allows the component to publish its latest impedance parameters via API. That way the producers could dynamically adapt.

阻抗是非常动态的属性。 它可能取决于发送的数据,总体工作量,有时甚至取决于调用者无法控制的变量。 如果需要,消费者的API的设计方式应允许组件通过API发布其最新的阻抗参数。 这样生产者就可以动态地适应。

翻译自: https://www.freecodecamp.org/news/software-impedance-6796cc65758b/

特征阻抗输入阻抗输出阻抗

特征阻抗输入阻抗输出阻抗_软件阻抗说明相关推荐

  1. pdn阻抗测试_毫欧级电源分配网络PDN的输出阻抗和传输阻抗测量

    对于高速数字电路和系统,信号完整性仿真.设计和测试是关键点之一:电源完整性仿真.设计和测试是另一个关键点,而且相比信号完整性来说,更复杂,难度更大.快速而准确的仿真电源完整性至今仍然是一个待突破的课题 ...

  2. 领域驱动设计_软件核心复杂性应对之道

    领域驱动设计_软件核心复杂性应对之道 转载于:https://www.cnblogs.com/MarvinGeng/archive/2013/02/21/2920968.html

  3. 时间管理专题_软件篇03

    本文属非商业用途,文中借鉴他人处均已注明出处,若侵犯原作权益,请联系删除,谢谢 接上一篇 时间管理专题_软件篇02 标题:一年多的GTD和自我管理之路(上) 作者:褪墨・时间管理 地址:http:// ...

  4. 软开关设计漫谈_软件篇

    //========================================================================   //TITLE:   //    软开关设计漫 ...

  5. 时间管理专题_软件篇02

    本文属非商业用途,文中借鉴他人处均已注明出处,若侵犯原作权益,请联系删除,谢谢 接上一篇 时间管理专题_软件篇01 #NOTE要点:神文,从目标管理到时间统计完整流程,作者亲历 要点:此文过猛, 引用 ...

  6. unity怎么导入系统的树_Unity5.0_树_软件教程_资源库

    摘要:Unity5.0_树_软件教程_资源库 树 Unity 的地形引擎 (Terrain Engine) 为树 (Trees) 提供 特殊支持.您可以在地形 (Terrain) 上放置上千棵树,然后 ...

  7. unity 加载关卡_Unity5.0_Application.isLoadingLevel 正在加载关卡_软件教程_资源库

    摘要:Unity5.0_Application.isLoadingLevel 正在加载关卡_软件教程_资源库 Application.isLoadingLevel 正在加载关卡? static var ...

  8. 极客时间_软件设计之美 笔记

    极客时间_软件设计之美 笔记 1.软件设计是什么 写代码前应该有模型设计 比如mvc结构就是一种模型 代码应该有规范, 产品内部原则 避免每个开发按自己的想法实现,有人写rest 有人写mvc 代码模 ...

  9. Arduino开发(一)_软件开发IDE工具的安装

    Arduino开发(一)_软件开发IDE工具的安装 学习Arduino开发首先需要安装软件开发工具,下面给大家做详细的演示, Arduino官方网站网址如下: https://www.arduino. ...

最新文章

  1. 单目和多目视觉统一标定
  2. python代码案例详解-Python综合应用名片管理系统案例详解
  3. “智慧”校园为何难落地?北京理工大学有什么秘密“利器”?
  4. oracle 压缩导出 导入,EXP直接导出压缩问津,IMP直接导入压缩文件的方法
  5. ext 浅谈类的实例
  6. python 查看变量_剖析python运算符is和==的区别
  7. MinIO Docker 快速入门 ​​​​​​​
  8. 北京/西安内推 | 中国移动研究院NLP组招收自然语言处理算法实习生
  9. 桌面的快捷方式图标异常
  10. RabbitMQ在Docker中安装以及Management API returned status code 500错误
  11. 图片色值提取工具-Color Hunter
  12. Java如何进行文件上传与下载
  13. Tomcat 优化
  14. linux使用教程 (转载)
  15. python算法详解脚本之家_Python算法应用实战之栈详解
  16. python练习题(基础篇2)
  17. 2018中国财经峰会闭幕 共议高质量发展
  18. python turtle库一些基本函数
  19. csr8670--sink工程的大致工作流程分析(以speaker为例)二
  20. 微商如何打造个人形象

热门文章

  1. Java集合(四):Map映射
  2. 疯狂涨知识!「高并发秒杀」微信抢红包实战案例帮你突破瓶颈
  3. Qt样式表之一:Qt样式表和盒子模型介绍
  4. 浏览器兼容CSS渐进增强 VS 优雅降级如何选择
  5. 微信小程序 设置背景占满整个页面
  6. AndroidStudio怎样导入library项目开源库 - 转
  7. Linux 内存管理与系统架构设计
  8. win10下markdownpad2显示问题
  9. mac 下终端 操作svn命令 以及出现证书错误的处理方法
  10. [Android]AndroidBucket增加碎片SubLayout功能及AISubLayout的注解支持