小程序
传感搜
传感圈

Efficiency Comparison: OPC-UA, Modbus, MQTT, Sparkplug, HTTP

2023-09-07 07:05:51
关注

Illustration: © IoT For All

OPC-UA, HTTP, Modbus, MQTT, and Sparkplug are common and popular technologies used in industrial communication, each designed for specific levels and purposes of communication.

OPC-UA is often used in floor plant environments, HTTP is commonly used for internet communication, MQTT is suitable for on-premises or cloud platform communication, and Modbus is prevalent in device-level communication.

While these technologies have different design purposes, it is possible to do a comparison of them in terms of communication efficiency. In this blog, we will make an efficiency comparison between these protocols regarding four communication criteria that affect transmission bandwidth:

  • Connection Overhead
  • Connection Persistence
  • Data on Change
  • Data Compression

The figures and findings in this blog are based on Johnathan Hottell’s experiment in 2019.

Connection Overhead

When two devices communicate over a network, they typically establish a connection to exchange data. This process involves several steps that contribute to connection overhead, including:

  • Handshaking: Before data transfer can begin, the devices need to establish a connection by exchanging a series of messages, known as a handshake. The handshake verifies the identity of the devices, negotiates communication parameters, and ensures that both parties are ready to transmit and receive data. This initial negotiation and verification process incurs time and network resources overhead.

  • Protocol Overhead: Network protocols, such as TCP/IP, introduce additional overhead to ensure reliable and orderly data transmission. These protocols add control information, error-checking mechanisms, sequencing, and acknowledgment mechanisms to ensure data integrity and delivery. While these features enhance the reliability of network communication, they also introduce overhead in terms of processing and network resources.

OPC-UA: OPC-UA introduces additional overhead due to its complex architecture and extensive set of functionalities. Establishing an OPC-UA connection involves multiple steps, including handshakes, security negotiations, and session establishment, which result in higher connection overhead.

Modbus: Modbus has low connection overhead since the protocol does not require extensive handshaking or complex session management. Modbus primarily focuses on direct access to data points, and the connection establishment involves minimal overhead, typically limited to establishing a network connection and addressing the slave device.

HTTP: HTTP introduces higher connection overhead compared to the other mentioned protocols. Each HTTP request-response cycle typically involves establishing a new connection, which incurs additional overhead in terms of handshakes, header exchanges, and session management.

MQTT: MQTT is designed to be lightweight and efficient, resulting in low connection overhead. It uses a simple binary protocol with minimal header size, reducing the amount of data needed for establishing and maintaining a connection.

Sparkplug: The additional overhead introduced by Sparkplug is minimal compared to MQTT, as it primarily focuses on defining a payload format and data representation rather than altering the connection behavior.

EMQ Technologies

In short, this efficiency comparison shows that OPC-UA, being a more robust and feature-rich protocol, may have a higher connection overhead than other technologies. MQTT, as a simpler and lightweight protocol, generally has lower connection overhead.

HTTP and Modbus have a request and response model, and they also have fair connection overhead. Sparkplug has a bit more data on connection because of the “Birth” message. The experiment results shown in the figure are quite consistent with our knowledge.

Connection Persistence

Once a connection is established, some level of overhead is incurred to maintain it. This includes periodically exchanging keep-alive messages to ensure the connection remains active and managing connection state information at both ends.

Additionally, connection-oriented protocols may need to reestablish the connection if interrupted or lost, further contributing to overhead. Therefore, keeping connections open for multiple requests can impact efficiency by reducing the overhead associated with establishing new connections. Let’s look at the efficiency comparison for connection:

OPC-UA: OPC-UA is a client-server model. The connection between the client and the server can be either persistent or non-persistent, depending on the requirements and characteristics of the application or protocol being used. But we assume the persistent connection is used in this case.

Modbus: Modbus is also a client-server model. Modbus does not inherently require a persistent connection between the client and server. Instead, a connection is established for each request, and once the response is received, the connection is closed.

HTTP: HTTP is a stateless protocol primarily used for web communication. Each HTTP request-response cycle is independent, and connections are not kept alive between requests by default.

MQTT: MQTT employs a persistent connection model. Once a client establishes a connection with an MQTT broker, the connection remains open until explicitly closed by either the client or the broker. It also provides features like a keep-alive mechanism and automatic reconnection to ensure connection reliability in case of network disruptions.

Sparkplug: Sparkplug, built on MQTT, inherits the connection maintenance characteristics of MQTT. It utilizes the persistent connection model, enabling long-lived connections between clients and the MQTT broker. We assume that Sparkplug has similar results as MQTT.

EMQ Technologies

OPC-UA and MQTT are designed to support connection persistence, allowing multiple requests to be handled over a single connection, thus reducing the overhead of connection establishment. HTTP and Modbus, in their standard configurations, typically use short-lived connections, which may result in higher connection overhead for each request.

Data on Change

“Report on change” is a mechanism commonly used in industrial automation and communication protocols to transmit data only when there is a change or update in the values of monitored variables or parameters. Instead of continuously transmitting data at fixed intervals, the report-on-change approach optimizes network bandwidth by sending data updates only when necessary.

In systems where large amounts of data are monitored or controlled, transmitting all the data at regular intervals can lead to inefficient use of network resources. Report on change minimizes unnecessary network traffic and reduces data transmission overhead by selectively sending data updates when there is a significant change in the values of monitored variables. The efficiency comparison shows:

OPC-UA: OPC-UA supports the “report on change” mechanism through its subscription model. OPC-UA clients can establish subscriptions to monitor specific variables or nodes in the server. The server then sends data updates to the client only when there is a change in the subscribed data.

Modbus: As a simple and traditional protocol, Modbus does not have inherent support for the “report on change” mechanism. It primarily focuses on providing direct access to data points without built-in mechanisms for reporting changes.

HTTP: HTTP does not have the “report on change” functionality, but it can be implemented at the application layer using long-polling or server-sent events (SSE) techniques. These techniques enable the server to push data updates to clients when changes occur.

MQTT: MQTT does not inherently support the “report on change” mechanism as part of its standard specification. However, MQTT can be combined with other protocols or application logic to implement a report-on-change functionality.

Sparkplug: Sparkplug provides native support for the “report on change” mechanism. It defines a standard payload format that includes metadata and data values. The subscribing clients receive updates only when there is a change in the data value.

EMQ Technologies

OPC-UA pub/sub model and MQTT support a data-on-change mechanism, where data is sent only when it has changed, reducing unnecessary network traffic and improving efficiency.

OPC read/write model, HTTP, and Modbus, on the other hand, often rely on periodic or polling-based data retrieval, which may result in higher network traffic and less efficient bandwidth utilization. The Johnathan experiment reflects the fact that the “report on change” mechanism can significantly reduce network traffic.

Data Compression

Data compression in communication refers to the process of reducing the size of data for efficient transmission over communication networks or channels. It involves applying compression techniques to the data before sending it and then decompressing it at the receiving end to restore the original data.

It’s important to note that both the sender and the receiver in a communication system must support the same compression algorithm to ensure successful compression and decompression. Let’s take a look at an efficiency comparison for the various protocols:

OPC-UA: OPC-UA uses UA-XML, UA-JSON, or UA-binary to transport the data. These data formats do not support data compression. OPC-UA uses base64 to encode data, which does not have compression capability. OPC-UA binary was shown transport compression could not yield bandwidth improvements unless data is compressed as a service.

Modbus: Modbus does not include native data compression capabilities. It primarily focuses on transmitting data straightforwardly and efficiently without additional overhead.

HTTP: HTTP itself does not provide native data compression; it supports features like content encoding, where data compression can be applied to the payload being transmitted.

MQTT: MQTT itself does not have built-in data compression as part of its core specification. However, MQTT can be used in conjunction with other compression techniques or libraries to compress the payload data before transmission.

Sparkplug: Sparkplug is a messaging protocol specifically designed for industrial IoT applications, built on top of MQTT. Sparkplug has defined the Google Protobuf payload data format for the standard. Protobuf is somehow a compressed data format. Sparkplug can be considered the protocol with data compression.

EMQ Technologies

OPC-UA provides built-in support for data compression, but the data compression rate is not high and is not helpful for the efficient transfer of compressed data. HTTP and MQTT may support data compression, but it is not a standard feature and would require additional configuration or implementation at the application level.

Modbus doesn’t support any data compression. Sparkplug has defined its payload as Google Protobuf, which is somehow compressed data in transmission.

Head-to-Head Comparison Chart

ProtocolConnection OverheadConnection PersistenceData on ChangeData Compression
OPC-UAPoorPoorNot SupportModerate
ModbusExcellentModerateNot SupportPoor
HTTPExcellentPoorUser DefinedUser Defined
MQTTExcellentGoodUser DefinedUser Defined
SparkplugGoodGoodSupportExcellent

Sparkplug is the Most Effective

From the efficiency comparison above, we can conclude that the Sparkplug protocol is the most efficient protocol for industrial usage. It provides native support for the “report on change” mechanism, making it well-suited for efficient transmission of data updates.

It also has low connection overhead due to its lightweight protocols and persistent connection models, ensuring continuous communication and efficient message delivery.

Tweet

Share

Share

Email

  • Connectivity
  • Data Analytics
  • MQTT
  • Network and Protocols

  • Connectivity
  • Data Analytics
  • MQTT
  • Network and Protocols

参考译文
效率对比:OPC-UA、Modbus、MQTT、Sparkplug、HTTP
插图:© IoT For All --> OPC-UA、HTTP、Modbus、MQTT 和 Sparkplug 是工业通信中常见且流行的技术,每种技术都适用于特定的通信层级和目的。OPC-UA 通常用于车间环境中,HTTP 常用于互联网通信,MQTT 适用于本地或云平台通信,而 Modbus 在设备级别的通信中应用广泛。虽然这些技术的设计目的不同,但我们可以从通信效率方面进行比较。在本文中,我们将从影响传输带宽的四个通信标准出发,对这些协议进行效率比较:连接开销、连接持久性、基于变化的数据传输、数据压缩。本文中的图表和发现基于 Jonathan Hottell 在 2019 年进行的实验。**连接开销**当两个设备通过网络进行通信时,它们通常会建立连接以交换数据。这一过程包括多个步骤,从而产生连接开销,主要包括:- **握手过程**:在数据传输开始前,设备需要通过交换一系列信息(称为握手)来建立连接。握手验证设备的身份,协商通信参数,并确保双方准备好发送和接收数据。这种初始的协商和验证过程会消耗时间和网络资源。- **协议开销**:网络协议(如 TCP/IP)引入了额外的开销,以确保可靠有序的数据传输。这些协议添加了控制信息、错误检查机制、排序和确认机制,以确保数据的完整性和送达。尽管这些功能增强了网络通信的可靠性,但也引入了处理和网络资源的开销。**OPC-UA**:OPC-UA 由于其复杂架构和广泛的功能集,会引入额外的开销。建立 OPC-UA 连接涉及多个步骤,包括握手、安全协商和会话建立,这导致较高的连接开销。**Modbus**:Modbus 的连接开销较低,因为该协议不需要复杂的握手或会话管理。Modbus 主要专注于对数据点的直接访问,连接建立的开销通常只限于建立网络连接和定位从设备。**HTTP**:与上述其他协议相比,HTTP 会引入较高的连接开销。每个 HTTP 请求-响应周期通常涉及建立新的连接,这在握手、头部交换和会话管理方面会增加额外的开销。**MQTT**:MQTT 被设计为轻量且高效,因此连接开销较低。它使用简单的二进制协议和最小的头部大小,减少了建立和维护连接所需的数据量。**Sparkplug**:Sparkplug 引入的额外开销相对 MQTT 很小,因为它主要专注于定义负载格式和数据表示,而不是改变连接行为。**EMQ 技术**简而言之,这项效率比较表明,作为更强大且功能丰富的协议,OPC-UA 可能比其他技术具有更高的连接开销。MQTT 作为更简单和轻量的协议,通常连接开销较低。HTTP 和 Modbus 采用请求-响应模型,它们也有相对合理的连接开销。Sparkplug 因为“出生”消息的引入,连接时会稍微多一些数据。图中显示的实验结果与我们已有的知识非常一致。**连接持久性**一旦连接建立,就需要一定的开销来维护连接。这包括定期交换“保活”消息,以确保连接保持活跃,并在连接的两端管理连接状态信息。此外,面向连接的协议在连接中断或丢失时可能需要重新建立连接,从而进一步增加开销。因此,保持连接在多个请求中打开可以减少建立新连接所带来的开销,从而提高效率。让我们看看连接的效率比较:**OPC-UA**:OPC-UA 是客户机-服务器模型。客户机和服务器之间的连接可以是持久的,也可以是非持久的,具体取决于应用程序或协议的需求和特性。但在此情况下,我们假设使用的是持久连接。**Modbus**:Modbus 同样是客户机-服务器模型。Modbus 本身并不强制要求客户机和服务器之间保持持久连接。而是为每个请求建立连接,响应接收后连接就关闭。**HTTP**:HTTP 是一种主要用于网络通信的无状态协议。每个 HTTP 请求-响应周期都是独立的,默认情况下请求之间不会保持连接。**MQTT**:MQTT 采用的是持久连接模型。一旦客户机与 MQTT 代理建立连接,连接会保持打开,直到由客户机或代理明确关闭。它还提供了诸如保活机制和自动重新连接等功能,以确保在网络中断的情况下连接的可靠性。**Sparkplug**:Sparkplug 基于 MQTT,继承了 MQTT 的连接维护特性。它采用持久连接模型,允许客户机和 MQTT 代理之间建立长连接。我们假设 Sparkplug 的结果与 MQTT 类似。**EMQ 技术**OPC-UA 和 MQTT 被设计为支持连接持久性,可以在单个连接上处理多个请求,从而减少连接建立的开销。HTTP 和 Modbus 在标准配置中通常使用短连接,这可能导致每次请求的连接开销更高。**基于变化的数据传输**“基于变化的报告”机制常用于工业自动化和通信协议中,用于仅在监控变量或参数的值发生变化或更新时才传输数据。与定期传输数据相比,该机制通过仅在必要时发送数据更新来优化网络带宽的使用。在需要监控或控制大量数据的系统中,定期传输所有数据可能会导致网络资源的低效使用。“基于变化的报告”机制通过选择性地在监控变量值发生显著变化时发送数据更新,从而减少不必要的网络流量和数据传输开销。效率比较如下:**OPC-UA**:OPC-UA 通过其订阅模型支持“基于变化的报告”机制。OPC-UA 客户端可以订阅服务器中的特定变量或节点。服务器仅在订阅数据发生变化时才向客户端发送更新。**Modbus**:作为一种简单而传统的协议,Modbus 本身不支持“基于变化的报告”机制。它主要关注对数据点的直接访问,而不具备报告变化的内置机制。**HTTP**:HTTP 本身没有“基于变化的报告”功能,但可以在应用层通过长轮询或服务器发送事件(SSE)技术实现。这些技术允许服务器在发生更改时将数据更新推送到客户端。**MQTT**:MQTT 本身的标准规范中并不包含“基于变化的报告”机制。然而,可以通过将 MQTT 与其他协议或应用程序逻辑结合来实现该功能。**Sparkplug**:Sparkplug 为“基于变化的报告”机制提供原生支持。它定义了包含元数据和数据值的标准负载格式。订阅客户端仅在数据值发生变化时才会接收到更新。**EMQ 技术**OPC-UA 的发布/订阅模型和 MQTT 支持基于变化的数据传输机制,即仅在数据发生变化时发送数据,从而减少不必要的网络流量并提高效率。相比之下,OPC 读写模型、HTTP 和 Modbus 通常依赖于周期性或轮询式的获取数据方式,这可能导致较高的网络流量和较低的带宽效率。Johnathan 的实验反映了“基于变化的报告”机制可以显著减少网络流量。**数据压缩**通信中的数据压缩是指通过减少数据的大小,以便在网络或通道上传输更高效的过程。它包括在发送前对数据进行压缩,并在接收端解压缩以恢复原始数据。需要注意的是,通信系统中的发送方和接收方必须支持相同的压缩算法,以确保压缩和解压成功。让我们看看不同协议的数据压缩效率比较:**OPC-UA**:OPC-UA 使用 UA-XML、UA-JSON 或 UA-binary 来传输数据。这些数据格式本身不支持数据压缩。OPC-UA 使用 base64 编码数据,这并不具备压缩能力。除非将数据作为服务进行压缩,否则 OPC-UA 的二进制传输压缩无法提高带宽效率。**Modbus**:Modbus 不支持任何数据压缩。**HTTP**:HTTP 可能支持数据压缩,但不是标准功能,需要在应用层进行额外配置或实现。**MQTT**:MQTT 可能支持数据压缩,但不是标准功能,需要在应用层进行额外配置或实现。**Sparkplug**:Sparkplug 将其负载定义为 Google Protobuf,而 Protobuf 本质上是一种压缩数据格式。因此,Sparkplug 可以被视为具有数据压缩功能的协议。**EMQ 技术**OPC-UA 提供了数据压缩的内置支持,但压缩率不高,对于高效传输压缩数据帮助不大。HTTP 和 MQTT 可能支持数据压缩,但这不是标准功能,需在应用层面进行额外配置或实现。Modbus 不支持任何数据压缩。Sparkplug 定义了其负载为 Google Protobuf,这在传输中某种程度上是压缩的数据。**正面对比图表**| 协议 | 连接开销 | 连接持久性 | 基于变化的数据传输 | 数据压缩 ||------------|----------|--------------|------------------|------------|| OPC-UA | 差 | 差 | 不支持 | 中等 || Modbus | 优秀 | 中等 | 不支持 | 差 || HTTP | 优秀 | 差 | 用户定义 | 用户定义 || MQTT | 优秀 | 良好 | 用户定义 | 用户定义 || Sparkplug | 良好 | 良好 | 支持 | 优秀 |**Sparkplug 是最有效的协议**从上述效率比较可以看出,Sparkplug 协议是工业应用中最有效的协议。它对“基于变化的报告”机制提供了原生支持,使其非常适合数据更新的高效传输。此外,由于其轻量级协议和持久连接模型,它具有较低的连接开销,确保了连续通信和高效的消息传递。TweetShareShareEmail 连接性 数据分析 MQTT 网络与协议
您觉得本篇内容如何
评分

评论

您需要登录才可以回复|注册

提交评论

广告

iotforall

这家伙很懒,什么描述也没留下

关注

点击进入下一篇

如何实现一种工业领域RS485收发器电路设计

提取码
复制提取码
点击跳转至百度网盘