Method for realizing shared subscription based on MQTT server cluster

A server cluster and server technology, applied in the direction of digital transmission systems, electrical components, transmission systems, etc., can solve huge and cumbersome problems, achieve load balancing, less resources, and reduce the amount of data transmission

Active Publication Date: 2019-10-15
SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF8 Cites 29 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

But scaling to millions of client connections is definitely a challenge
Because in such a magnitude situation, the processing of message routing between MQTT cluster nodes is very cumbersome and huge; especially in data collection / centralized processing applications, there are far more data producers than data consumers, and the messages only need to be arbitrarily Even if the client processes once, a large amount of repeated and useless data will still be transmitted between nodes, so there is an urgent need for an implementation method that can reduce data transmission between nodes

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for realizing shared subscription based on MQTT server cluster
  • Method for realizing shared subscription based on MQTT server cluster
  • Method for realizing shared subscription based on MQTT server cluster

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0045] Such as figure 1 As shown, a method of sharing subscription based on MQTT server cluster is designed. In the MQTT message server cluster, an intelligent routing system based on event-driven architecture, mnesia distributed database, ets routing table and map packet mapping is designed, and on this basis Added shared subscription processing flow.

[0046] Such as figure 2 and image 3 As shown, two kinds of subscription topic prefix queue shared subscription prefix $queue and group shared subscription prefix $share / are set .

[0047] Queue shared subscription refers to a topic starting with $queue / , such as $queue / topic1. If multiple clients subscribe at the same time, the MQTT message server cluster will distribute the messages sent to topic1 to a client in a load-balanced manner.

[0048] Group sharing subscription is a more flexible way, and the implementation method is for all $share / Topics starting with / will be grouped into groups for load balancing di...

Embodiment 2

[0075] First, the MQTT server cluster is established through the mnesia distributed database to synchronize data between nodes.

[0076] 1. Start a node 'mqtt@hostname1', execute mnesia:create_schema([node()]).mnesia:start(). on this node (the data must be started, otherwise other nodes cannot join the cluster) to create a database.

[0077] 2. Start the second node 'mqtt@hostname2', ping 'mqtt@hostname1', and execute mnesia:start(). (Mnesia must be started, otherwise the following steps cannot be performed).

[0078] 3. Execute mnesia:change_config(extra_db_node,['mqtt@hostname']) on the second node 'mqtt@hostname2'.

[0079] 4. Execute mnesia:change_table_copy_type(schema,node(),disc_copies) on the second node 'mqtt@hostname2'. (copy the schema to the disk directory of the node database).

[0080] 5. You can execute the following code to copy the database table.

[0081] 6. lists: foreach(fun(Table)->

[0082] Type=call(Node, mnesia, table_info, [Table, st...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a method for realizing shared subscription based on an MQTT server cluster, and the method comprises the following steps: setting a shared subscription theme: setting shared subscription prefixes before standard theme definition, wherein the shared subscription prefixes comprise a queue shared subscription prefix and a packet shared subscription prefix; establishing an MQTTserver cluster based on an Erlang mnesia cluster technology, wherein the MQTT server cluster comprises an intelligent routing system based on an event-driven architecture, an mnesia distributed database, an ts routing table and map packet mapping; optimizing the structure of the MQTT server cluster based on the hierarchical architecture design; entering a shared subscription processing flow; andentering a message publishing process. According to the invention, through shared subscription, the same message cannot be sent to a plurality of subscribers, so that load balance among a plurality ofnodes of the subscription end is realized.

Description

technical field [0001] The invention relates to the technical field of MQTT transmission protocol, in particular to a method for realizing shared subscription based on an MQTT server cluster. Background technique [0002] MQTT (Message Queuing Telemetry Transport) is a lightweight instant messaging protocol developed by IBM. Different from the HTTP protocol, MQTT adopts the publish / subscribe mode instead of the traditional request / response mode. This more lightweight mode makes MQTT more suitable for low-power and limited network bandwidth Internet of Things equipment. At the same time, MQTT also has the characteristics of streamlining, supporting continuous session control, providing different quality of service for transmission, and strong customizability. Its value is fully reflected in today's hot Internet of Things. As an important transport protocol for the Internet of Things, MQTT supports almost all platforms. [0003] In the publish and subscribe mode, the publis...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): H04L12/58H04L29/08
CPCH04L51/04H04L67/1001
Inventor 余龙海
Owner SICHUAN CHANGHONG ELECTRIC CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products