The Architecture of Middleware for Real-time Sensor Data Sharing
DEStech Transactions on Computer Science and Engineering
With the development of Internet of Things technology, the era of the Internet of Everything is getting closer and closer to us. People use a variety of applications combined with sensors to greatly improve social productivity. There is almost no interaction between these sensor applications and the utilization of sensor information is not maximized. Due to the massive, real-time, and heterogeneous nature of sensor information, these tasks are difficult to develop. This paper builds a
... builds a middleware based on Netty to realize real-time sharing of sensor information and analyze its performance through comparative experiments. Global Directory Service. Global Directory Service provides registration services for sensors accessing middleware. Establish a global directory service based on the unique description of the metadata level for each sensor through functions, work areas, job locations, and other elements. Through the global directory service, the user can quickly locate the sensor according to his own needs and then obtain the corresponding sensor metadata information. When the user establishes a connection with the message push service, the obtained sensor information is sent to the message push service. The message push service adds user to the corresponding subscription group based on the information and complete the subscription of sensor. Data Communication Service. Sensor information is real-time and massive. In order to obtain sensor messages in real time, the data communication service needs to establish a long connection with the sensor. And in the case of such a large number of sensors, the load of a single data communication server should be increased as much as possible. The traditional model is a connection to create a Socket thread. When the thread reaches a certain amount, the server can't bear a lot of thread load pressure and it is easy to crash. Netty is an efficient client/server communication framework based on the NIO model, using the reactor design pattern. A Reactor aggregates a selector. Thousands or even more clients can be connected, listened, polled by server with very few threads. Greatly reduce the performance loss caused by server creation threads and thread context switching. Therefore, this paper uses Netty as the basic framework of data communication service, which can solve the real-time acquisition of sensor data and the stress caused by multithreading. At the same time, Netty supports multi-protocol parsing and customization, so it can solve the heterogeneity of sensor information very well. This article implements Netty's data communication service through a custom protocol. The protocol structure is as shown in Table 1 : Where the frame header and the end of the frame are used to detect data validity and integrity; The frame length indicates the message type and the length of the message data; There are three types of messages. 0 is the heartbeat message, 1 is the sensor's own status message, and 2 is the collection message. Message data represents a specific message.