基于MQTT协议的物联网服务器设计与架构分析

2020-06-21 15:16:16万洪莉李雨晨
软件工程 2020年6期

万洪莉 李雨晨

摘  要:基于MQTT协议,进行物联网工程项目服务器端的架构和开发,并针对服务器应用架构进行性能分析。采用MVC设计模式进行服务器端架构设计,采用JSP技术进行开发。服务器和硬件、移动端的通信协议采用MQTT协议,搭建Apollo服务器实现对该协议的支持。经分析,可提高物联网服务器与感知层、应用层的通信性能。

关键词:物联网通信协议;服务器;MQTT

Abstract: Based on MQTT (Message Queuing Telemetry Transport) protocol, the study conducts architecture construction and development of the Internet of Things (IoT) project server, and carries out performance analysis of the server application architecture. Model-View-Controller (MVC) mode is used to design the server architecture, and JSP technology is used to develop the server. MQTT is adopted as the communication protocol among the server, hardware and mobile terminal, and Apollo server is built to support the protocol. The analysis proves that the proposed method effectively improves the IoT server communication performance at perception layer and application layer.

Keywords: IoT communication protocol; server; MQTT

1   引言(Introduction)

1.1   现有物联网项目架构

HTTP是Web服务器开发中广泛使用的协议。但当研究物联网服务器的系统架构时,响应时间,吞吐量,更低的电池和带宽使用率成为衡量系统的主要性能指标,MQTT协议在这类问题的解决中更具优势[1-3]。在文献[4]中,基于物联网体系架构,以智能超市为业务背景,建设了物联网实训教学体系。服务器架构基于HTTP协议,采用硬件感知端、服务器端、移动端和数据流、控制流的“三端两流”架构。如图1所示。

在图1所示的架构中,数据流由硬件感知端起始。硬件感知端将采集的数据发送至服务器端,移动端通过轮询从服务器端获得数据流,刷新UI界面进行远程监测。架构的控制指令流由移动端起始。移动端发起控制指令,服务器端修改指令的相应数据库字段。硬件感知端发起轮询操作,查询服务器端控制指令的相应状态,根据控制指令控制执行部件的动作。

物联网的感知层研究与设计也依赖于项目所采用的物联网应用系统的典型模型。面向软件测试的物联网节点模拟单元开发[5]所做工作主要集中在节点单元的开发和测试,物联网服务器端与感知层、应用层的通信协议也采用HTTP协议。……

登录APP查看全文