CN109462652B - Terminal gateway load distribution method based on Hash algorithm in intelligent home system - Google Patents

Terminal gateway load distribution method based on Hash algorithm in intelligent home system Download PDF

Info

Publication number
CN109462652B
CN109462652B CN201811388232.3A CN201811388232A CN109462652B CN 109462652 B CN109462652 B CN 109462652B CN 201811388232 A CN201811388232 A CN 201811388232A CN 109462652 B CN109462652 B CN 109462652B
Authority
CN
China
Prior art keywords
gateway
terminal
calculation
data
terminal gateway
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811388232.3A
Other languages
Chinese (zh)
Other versions
CN109462652A (en
Inventor
戴国骏
赵骏
史建凯
张桦
吴以凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Dianzi University
Original Assignee
Hangzhou Dianzi University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Dianzi University filed Critical Hangzhou Dianzi University
Priority to CN201811388232.3A priority Critical patent/CN109462652B/en
Publication of CN109462652A publication Critical patent/CN109462652A/en
Application granted granted Critical
Publication of CN109462652B publication Critical patent/CN109462652B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/2803Home automation networks
    • H04L12/2816Controlling appliance services of a home automation network by calling their functionalities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/7453Address table lookup; Address filtering using hashing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1023Server selection for load balancing based on a hash applied to IP addresses or costs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/2803Home automation networks
    • H04L2012/284Home automation networks characterised by the type of medium used
    • H04L2012/2841Wireless

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Automation & Control Theory (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a terminal gateway load distribution method based on a Hash algorithm in an intelligent home system. In the load distribution of the invention, in a network consisting of a plurality of terminal gateways and a local server, the terminal gateways receive sensor data sent from Zigbee sub-equipment by utilizing a Zigbee coordinator and store the sensor data on the server; the main control gateway divides the data into a plurality of small intervals and maps the small intervals to a Hash ring, the virtual nodes are used for replacing the positions of the terminal gateways on the Hash ring, the calculation power of the terminal gateways is expressed by the number of the virtual nodes, namely when the terminal gateways join an edge computing network, the main control gateway distributes a corresponding number of virtual nodes to the terminal gateways according to the calculation power of the terminal gateways, the virtual nodes are mapped to the Hash ring by a Hash function, the virtual nodes capture the data nearest to the virtual nodes in the fixed direction, and a gateway system which enters an edge computing state can still realize the capacity of distributing loads according to calculation power values while dynamically joining and exiting the edge computing network.

Description

Terminal gateway load distribution method based on Hash algorithm in intelligent home system
Technical Field
The invention discloses a terminal gateway load distribution method based on a Hash algorithm in an intelligent home system.
Background
The intelligent home is embodied in an internet of things manner under the influence of the internet. The intelligent home connects various devices (such as audio and video devices, lighting systems, curtain control, air conditioner control, security systems, digital cinema systems, audio and video servers, video cabinet systems, network home appliances and the like) in the home together through the Internet of things technology, and provides multiple functions and means such as home appliance control, lighting control, telephone remote control, indoor and outdoor remote control, anti-theft alarm, environment monitoring, heating and ventilation control, infrared forwarding, programmable timing control and the like. Compared with the common home, the intelligent home has the traditional living function, integrates the functions of building, network communication, information household appliance and equipment automation, provides an all-around information interaction function, and even saves funds for various energy expenses.
In this case, the terminal gateway is especially important as a sink node for forwarding, exchanging and circulating data. With the development of the hardware industry, the performance and the number of mobile terminals and equipment terminals are increased with explosive release, and it is expected that more than 500 hundred million terminals and equipment are networked in 2020, and more than 100 hundred million internet of things connections are generated in China. The development of the internet of things enables electronic devices in the families of ordinary people to become lively, and it is not enough to connect the electronic devices to the network, so that data generated by the electronic components need to be better utilized, and the data are better utilized to serve the current family. In the field of intelligent home application, in consideration of network bandwidth and data privacy protection, the data are preferably circulated locally and directly processed locally, and the server is used as an operation center of an intelligent home system and bears the burden of operation tasks. The gateway is required to be used as an edge node, so that the gateway can consume data generated in a home and provide auxiliary computing capability for the intelligent home system by utilizing increasingly strong edge computing capability of the gateway.
The priority task of the terminal gateway is to receive and forward user data, and when the terminal gateway is in an idle state, the server can perform service distribution on data needing to be calculated at the cloud end, and transmits the data back to the terminal gateway to perform non-emergency calculation tasks such as user behavior recommendation, data format arrangement and conversion. The service scene has wide application in the common intelligent home field. The traditional cloud computing solution may have excessive computing performance at the initial stage of application, which causes too high cost; in the middle and later periods of application, as the number of terminal gateways increases, the amount of user data increases, the situation of insufficient calculation performance occurs, and the investment on cloud resources needs to be increased. Therefore, the problem can be well solved by the application of the edge calculation, the local server divides the task to be calculated into a plurality of blocks, sends the blocks to the terminal gateway, performs the edge calculation when the gateway is idle, and uploads the blocks to the local server after the edge calculation is completed. In the initial application stage, under the condition that the cloud computing power is not high, the auxiliary computing is carried out. In the later application stage, due to the improvement of the number of the terminal gateways, the performance of edge calculation is improved, and the resource investment of the cloud server can be saved.
The terminal gateway needs to respond to the data forwarding task preferentially, so that the terminal gateway can dynamically join and quit the edge computing network, and therefore, how to reasonably divide the computing task and distribute the computing task to the terminal equipment according to the computing capability of the terminal gateway is particularly important for the terminal equipment to reasonably load the computing task.
Disclosure of Invention
The invention aims to provide a terminal gateway load distribution method based on a Hash algorithm in an intelligent home system.
The system applied by the invention comprises a gateway control system, a local server, a sensor control system and mobile terminal equipment.
The gateway control system comprises a master control gateway and a terminal gateway, wherein the master control gateway and the terminal gateway are directly connected by an RPC protocol, and the terminal gateway is connected with a Zigbee coordinator by various embedded Linux control panels; the sensor control system consists of a Zigbee sub-device consisting of an intelligent socket, lighting equipment, an audible and visual alarm, an intelligent lock, a fresh air system, air conditioning equipment and an electric curtain connecting Zigbee module; the local server is placed in a house or a machine room for community property management according to the requirement; the mobile terminal equipment comprises a mobile phone or a tablet and the like which are used daily.
The control panel of the main control gateway and the terminal gateway adopts a Tiny4412 control panel, is based on a samsung Exynos 4412 four-core processor, has a main frequency of 1.5GHz, carries a 1G DDR3RAM and a 4G eMMC cache, and has good power consumption control.
The terminal gateway system is used for receiving data generated on the Zigbee sub-equipment and forwarding the data to the server for storage, and on the other hand, forwarding a control instruction issued by the mobile terminal equipment directly controlled by the user. And adding the edge computing network to perform computing tasks distributed by the server.
The Zigbee coordinator and the Zigbee sub-equipment adopt a CC2530 development kit, carry 8KB RAM and 256KB flash memory, can support large-scale networking of the coordinator and the 254 sub-equipment, and have very low power consumption.
The sensing control system is used for uploading various sensor data to the master control gateway system, and is used for receiving various control instructions issued by the master control gateway system and controlling corresponding intelligent equipment.
And the local server is used for receiving and storing the data uploaded by the master control gateway system. And controlling edge calculation, including the segmentation and issuing of edge calculation tasks, the result processing after data processing, and the control and scheduling of the master control gateway which joins and withdraws from the edge calculation network.
The mobile terminal device is a mobile phone or a tablet computer used by a user daily.
The technical solution of the invention is as follows:
in the load distribution of the invention, in a network consisting of a plurality of terminal gateways and a local server, the terminal gateways receive sensor data sent from Zigbee sub-equipment by utilizing a Zigbee coordinator and store the sensor data on the server. The main control gateway divides the data into a plurality of small intervals and maps the small intervals to a Hash ring, the virtual nodes are used for replacing the positions of the terminal gateways on the Hash ring, the calculation power of the terminal gateways is expressed by the number of the virtual nodes, namely when the terminal gateways join an edge computing network, the main control gateway distributes a corresponding number of virtual nodes to the terminal gateways according to the calculation power of the terminal gateways, the virtual nodes are mapped to the Hash ring by a Hash function, the virtual nodes capture the data nearest to the virtual nodes in the fixed direction, and a gateway system which enters an edge computing state can still realize the capacity of distributing loads according to calculation power values while dynamically joining and exiting the edge computing network.
The technical scheme adopted for solving the technical problems comprises the following specific steps:
step 1, when a system is initialized, storing a calculation power table in a main control gateway, inquiring whether all terminal gateways added into the intelligent home system record calculation power in the calculation power table or not by taking a network card MAC value of the terminal gateway as a main key value, and entering step 1 if the calculation power is recorded; otherwise, calculating the calculation power of the current terminal gateway, recording the MAC value of the current terminal gateway and the corresponding calculation power in the calculation power table, and then entering the step 2 until the calculation powers of all the terminal gateways are recorded in the calculation power table.
Step 2, judging the current data accumulation amount and the system operation time, and if the data amount on the current server is accumulated to C and the system time is operated to T, initiating an edge calculation request to the server and the terminal gateway by the main control gateway; otherwise, entering the normal use state of the gateway.
Step 3, after receiving the edge calculation request sent by the master control gateway, the terminal gateway judges whether the terminal gateway is in an idle state at present, if so, the terminal gateway enters an edge calculation network, and the terminal gateway enters step 4; otherwise, the edge computing network is not added.
Step 4, the master control gateway inquires the calculation force values of all terminal gateways in the edge calculation network in the current calculation force table, calculates the ratio beta of the calculation force values, distributes N virtual nodes for each terminal gateway by taking K as a unit, and marks the virtual node of each terminal gateway as: a node (N) { Mn-1, Mn-2., Mn-N | N ∈ 1 to M, and N ═ K β (N) }, which are all mapped onto the hash ring by the hash function.
And step 5, when the total amount of data needing edge calculation is QGB, the main control gateway divides the data into samples with the size of P MB after obtaining the samples from the server, obtains Q/P data blocks, marks the divided data blocks as 1-Q/P in sequence, and maps the data blocks onto a hash ring by using a hash function.
And 6, on the Hash ring, finding a virtual node closest to the data block according to the clockwise direction by the data block marked as x, finding a terminal gateway to which the virtual node belongs, distributing the data block to the terminal gateway to which the virtual node belongs to perform edge calculation, recording the distributed path on a routing table, storing the path on a server and transmitting the path to each terminal gateway, and then sequentially transmitting the data blocks to the corresponding terminal gateways according to the sequence marked in the step 5.
And 7, comparing the data blocks taken by each terminal gateway with the data paths in the routing table, if the data paths of the data blocks taken by the current terminal gateway in the routing table point to the terminal gateway, performing edge calculation, and otherwise, not performing calculation.
And 8, when a new terminal gateway is accessed into the intelligent home system, the initialization process in the step (1) is also required. And when a new terminal gateway enters an edge calculation state, searching a calculation force value corresponding to the new terminal gateway in the calculation force table by taking the MAC value as an index in the same way. After the calculation force value is obtained, calculating calculation force ratio values beta (y) of a new terminal gateway and other terminal gateways in the edge calculation network, allocating new N virtual nodes to the new terminal gateway, wherein the N virtual nodes are marked as node (y) ({ My-1, My-2.,. so, My-N | N ═ K β (y) }), mapping all the new virtual nodes to a hash ring according to the calculation of a hash function, rotating the positions of data blocks on the hash ring clockwise to find the nearest terminal gateway, capturing the data blocks by the newly allocated virtual nodes, updating new allocation paths in a routing table, sending the routing table to all the gateways again, and sending the block data by the server according to the new paths.
And 9, when the terminal gateway is switched from the idle state to the non-idle state, the edge computing network needs to exit, at this time, all the virtual nodes corresponding to the terminal gateway exit the hash ring, and the distribution path is updated in the routing table in the same way.
And step 10, after the calculation of each data block is completed, the terminal gateway transmits the calculation result back to the server, and after all the edge calculation tasks are completed, the server summarizes the calculation result and carries out corresponding subsequent processing and storage.
Further, the calculation capacity table in step 1 is provided by the equipment manufacturer for the calculation capacity of the terminal gateway processor, and may also be calculated by software when performing the calculation of the calculation capacity evaluation of the processor in step 1.
Further, the data amount on the current server in step 2 is accumulated to C and the system time runs T, and the specific process and necessity are as follows:
(1) the process is as follows: when the data volume accumulation reaches C and the system operation time does not reach T, not starting to carry out edge calculation; similarly, when the running time of the system reaches T and the data volume is not accumulated to C, the edge calculation is not started; only when the data accumulation amount reaches C and the system operation time reaches T, the edge calculation is started.
(2) The necessity: the edge calculation is driven by data, and many calculation applications depend on a large amount of data, so that the data amount is insufficient, and meaningless calculation is increased; when the system running time is too short, the collected data can be a large amount of redundant data, the sample collection is lack of diversity, and the significance for the edge calculation is not large.
Further, in the idle state in step 3, whether the current gateway is in the idle state is determined according to the CPU utilization rate of the current terminal gateway, and when the CPU utilization rate is less than or equal to T1(T1 can be customized) and exceeds U time, the current gateway belongs to the idle state and joins in the edge computing network according to the load of the gateway; if the CPU utilization rate is greater than T1, the state is not idle, and the edge computing network is not added or exited.
Further, step 4 is to calculate a calculation power value of each terminating gateway and calculate a ratio β thereof, and the necessity of allocating N virtual nodes to each terminating gateway is as follows, taking K as a unit:
in practical situations, it is obviously not reasonable to equally divide the data into blocks at the end of each edge calculation, since the processing performance of each terminal gateway device coupled to the edge calculation network is different, resulting in different computational power. Therefore, it is necessary to allocate the number of virtual nodes to the device at the end of each edge calculation by using the processor computation force ratio as a measure.
Further, the specific process and necessity for blocking and sending the data blocks to the corresponding terminal device according to the sequence marked in step 5 are as follows:
(1) the process is as follows: and (4) after the routing table is determined, the server sends the data blocks to the corresponding terminal gateways in a blocking mode according to the information in the routing table and the data blocks marked in the step (4) in the mode of 1,2,3. And after the first data block is sent, the rest data blocks are continuously sent.
(2) The necessity: the method avoids the defect of unreasonable load caused by the way that all data blocks belonging to a certain terminal gateway are sent in a blocking mode and then the data blocks of the next terminal gateway are sent.
Further, in steps 8 and 9, the newly allocated virtual node captures a data block, the virtual node exits from the hash ring to release the data block, and updates the routing table, and the specific process and necessity of the server sending the block data according to the new path are as follows:
(1) the process is as follows: when a new virtual node enters a hash ring, the data blocks which are captured before are necessarily distributed to the new virtual node again; similarly, when the virtual node exits the hash ring, the data blocks that have been captured before are released again, and are captured by the virtual node currently on the hash ring, so that the routing table on the server needs to be updated, and the server compares the old routing table with the new routing table to mark the data blocks in three states: transmitted data chunks, unsent data chunks, failed data chunks. The invalid data blocks are different data blocks of the paths in the new routing table and the old routing table. The server continues to send unsent data chunks and stale data chunks to the gateway.
(2) The necessity: firstly, when a new virtual node enters a ring or an old virtual node exits, the number and the proportion of the virtual nodes representing each terminal gateway originally on the ring cannot be changed under the condition of not changing a unit K because the proportion is fixed. Secondly, as can be seen from the hash consistency, the position of the original virtual node on the hash ring remains unchanged, and after a new virtual node enters the hash ring or a part of the virtual nodes recedes from the hash ring, only part of the paths of the data blocks are changed according to the principle of capturing the data blocks clockwise. Finally, the router issues the data blocks according to the new routing table without adopting cross-gateway data migration, thereby reducing the pressure of network transmission and the load forwarded by the server and being beneficial to realizing the rapid migration of the data block paths.
The invention has the beneficial effects that:
(1) with the present invention, the probability that each data block is assigned to each terminating gateway is proportional to the computational effort. Therefore, the calculation amount allocated to each terminal gateway can be guaranteed to be reasonable after a large number of data blocks are transmitted. The terminal gateway is allowed to dynamically join and withdraw from the edge computing network, daily task requirements of the terminal gateway are not influenced, idle time computing power of the terminal gateway can be utilized, and computing pressure and investment cost of the server are saved.
(2) When any one or more terminal gateways join or quit the edge computing network, the state of distributing load according to the calculated force ratio of the terminal gateways in the edge computing network cannot be influenced, so when any one or more terminal gateway devices break down, a user actively stops using any one or more terminal gateways, and a newly-added terminal gateway device needs to be connected to the intelligent home system, the system always performs 'distribution according to force and can be used by many people', and the system has very flexible expansibility, tailorability and usability.
(3) By using the invention, when a new terminal gateway joins or exits the edge computing network, only part of data is invalid, thereby reducing the data migration volume; the server sends the operation data again, the method of cross-gateway transmission by the invalid data possessor is replaced, and the network data transmission pressure is reduced.
Drawings
Fig. 1 is a structural diagram of a terminal gateway load distribution method according to the present invention.
Fig. 2 is a flowchart of the terminal gateway load distribution method according to the present invention.
Fig. 3 is a mapping diagram of virtual nodes on a hash ring.
Fig. 4 is a mapping diagram on a hash ring after a virtual node M4 is newly added.
Fig. 5 is a map on the hash ring after virtual node M3 is deleted.
Detailed Description
The following is a further description of the invention with reference to the accompanying drawings.
With reference to fig. 1, the system comprises: the system comprises a gateway control system, a local server, an intelligent device control system and mobile terminal equipment.
The gateway control system comprises a master control gateway and a terminal gateway, wherein the master control gateway and the terminal gateway are connected by an RPC protocol, and the terminal gateway is connected with a Zigbee coordinator by various embedded Linux control panels; the sensor control system consists of a Zigbee sub-device consisting of an intelligent socket, lighting equipment, an audible and visual alarm, an intelligent lock, a fresh air system, air conditioning equipment and an electric curtain connecting Zigbee module; the local server can be placed in a house or a machine room for community property management according to the requirement; the mobile terminal equipment comprises a mobile phone or a tablet and the like which are used daily.
As a specific example: the control panel of the main control gateway and the terminal gateway adopts a Tiny4412 control panel, is based on a samsung Exynos 4412 four-core processor, has a main frequency of 1.5GHz, carries a 1G DDR3RAM and a 4G eMMC cache, and has good power consumption control.
The master control gateway system is used for receiving data generated on the Zigbee sub-equipment and forwarding the data to the server for storage, and on the other hand, forwarding a control instruction issued by the mobile terminal equipment directly controlled by the user. And adding the edge computing network to perform computing tasks distributed by the server.
As a specific example: the Zigbee coordinator and the Zigbee sub-equipment adopt a CC2530 development kit, carry 8KB RAM and 256KB flash memory, can support large-scale networking of the coordinator and the 254 sub-equipment, and have very low power consumption.
The sensing control system is used for uploading various sensor data to the terminal gateway system, and is used for receiving various control instructions issued by the terminal gateway system and controlling corresponding intelligent equipment.
And the local server is used for receiving and storing the data uploaded by the master control gateway system. And controlling edge calculation, including splitting and issuing edge calculation tasks, processing results after data processing, and controlling and scheduling terminal gateways which join and quit the edge calculation network.
The mobile terminal device is a mobile phone or a tablet computer used by a user daily.
With reference to fig. 1 and 2, the method comprises the following specific steps:
(1) when the system is initialized, storing a tension calculation table in the master control gateway, inquiring all terminal gateways added into the system by taking the network card MAC value of the terminal gateway as a primary key value, and judging whether the calculation power is recorded in the calculation table, if so, entering the step (2); otherwise, calculating the calculated force, recording the MAC value and the corresponding calculated force in the calculated force table, and then entering the step (2).
(2) Judging the current data accumulation amount and the system operation time, and if the data amount on the current server is accumulated to C and the system time is operated to T, initiating an edge calculation request by the master control gateway; otherwise, entering the normal use state of the gateway.
(3) The terminal gateway judges whether the terminal gateway is in an idle state at present, if so, the terminal gateway enters an edge computing network and enters the step (4); otherwise, the edge computing network is not added.
(4) The main control gateway inquires the calculation force values of all terminal gateways in the edge calculation network in the current calculation force table, calculates the ratio beta of the calculation force values, distributes N virtual nodes for each terminal gateway by taking K as a unit, and marks the virtual node of each terminal gateway as: a node (N) { Mn-1, Mn-2., Mn-N | N ∈ 1 to M, and N ═ K β (N) }, which are all mapped onto the hash ring by the hash function.
As a specific example: as shown in fig. 3, there are 3 end gateways in the edge computing network, and the computation force table is queried, where β (1) is 1, β (2) is 3, and β (3) is 2, so that the number of virtual nodes allocated to the end gateways is 5, 15, and 10, respectively. The symbols are respectively given as node (1) { M1-1, M1-2,. ·, M1-5}, node (2) { M2-1, M2-2, ·, M2-15}, and node (3) { M3-1, M3-2, ·, M3-10 }. The range of the Hash ring is 0-232-1, mapping all elements in the three sets onto a hash ring using a hash function.
Further, the virtual node is allocated to each gateway in a unit of K-5 only for illustration, and in the implementation process, the more virtual nodes are allocated to each gateway, the closer the data allocation finally allocated to each gateway is to the ratio of the calculated power β.
(5) When the total amount of data needing edge calculation is QGB, the main control gateway divides the data into samples with the size of P MB after obtaining the data from the server, obtains Q/P data blocks, marks the data blocks as 1-Q/P in sequence, and maps the data blocks to a hash ring by using a hash function.
As a specific example: as shown in fig. 3, if the total data amount is 10GB, the master control gateway divides the data into 10 data blocks, the size of each data block is 1GB, and the 10 data blocks are marked as 1-10 and mapped onto the hash ring.
(6) On the hash ring, the data block marked as x finds the nearest virtual node according to the clockwise direction, the found virtual node belongs to which terminal gateway, the data block is distributed to which terminal gateway to perform edge calculation, the distributed path is recorded on the routing table, stored on the server and sent to each terminal gateway, and then the data block is partitioned according to the sequence marked in the step (5) and sent to the corresponding terminal gateway.
As a specific example: as shown in fig. 3, the data block marked 1 searches clockwise for the virtual node closest to the data block 1 as belonging to the terminating gateway 1, so that the routing path of the data block 1 is the terminating gateway 1 and is recorded in the routing table, and the other data blocks are similar. And when the routing information of all the data blocks is recorded, the routing table is issued to each terminal gateway.
(7) And each terminal gateway is compared with the data path in the routing table after taking the data blocks, if the data path of the current gateway in the routing table for taking the data points to the gateway, edge calculation is carried out, and otherwise, calculation is not carried out.
As a specific example: and when the terminal gateway 1 takes the data block 1 and inquires the routing information without errors, performing edge calculation on the data block 1.
Further, when the terminating gateway performs edge calculation, the server still continues to send the unsent data blocks and the invalidated data blocks.
(8) When a new terminal gateway is accessed into the intelligent home system, the initialization process in the step (1) is also needed. And when a new terminal gateway enters an edge calculation state, searching a calculation force value corresponding to the new terminal gateway in the calculation force table by taking the MAC value as an index in the same way. After the calculation force value is obtained, calculating calculation force ratio values beta (y) of a new terminal gateway and other terminal gateways in the edge calculation network, allocating new N virtual nodes to the new terminal gateway, wherein the N virtual nodes are marked as node (y) ({ My-1, My-2.,. rightwards, and My-N | N ═ K β (y) }), mapping all the new virtual nodes to a hash ring according to the calculation of a hash function, rotating the position of a data block on the hash ring clockwise to find the nearest terminal gateway, capturing the data block by the newly allocated virtual nodes, updating a new allocation path in a routing table, sending the routing table to all the gateways again, and sending block data by the server according to the new path.
As a specific example: as shown in fig. 4, when the terminating gateway 4 enters the edge computing state, the computing force table is queried to obtain the computing force β (4) of the terminating gateway 4 as 2, so that 10 new virtual nodes are allocated to the terminating gateway, and the new virtual nodes are mapped onto the hash ring in the same way, so that the data block originally captured by the terminating virtual node 3 is now captured by the new virtual node, the main control gateway records the routing information of the information, and if the current data block 4 is not sent, the data block 4 is marked as failed, and a new routing table is sent to all the terminating gateways and servers. And the server sends the invalid data blocks 4 to a new terminal gateway 4 again according to the new routing table, and the master control gateway forwards the invalid data blocks 4.
(9) When the terminal gateway is switched from an idle state to a non-idle state, the edge computing network needs to exit, at this time, all virtual nodes corresponding to the terminal gateway exit the hash ring, and the distribution path is updated in the routing table in the same way.
As a specific example: as shown in fig. 5, when the virtual node corresponding to the terminal gateway M3 exits the hash ring, the data chunk 2 originally captured by the virtual node of the terminal gateway M3 is not updated with the state and routing information of the data chunk 2 if the data chunk 2 is sent in the routing table; if the data block 2 is not sent, the data block 2 is recorded in a new routing table to be invalid, the server and the terminal gateway update the routing table, and the server sends the invalid data block again.
(10) And after all the edge calculation tasks are finished, the server collects the calculation results and performs corresponding subsequent processing and storage.

Claims (2)

1. The terminal gateway load distribution method based on the Hash algorithm in the intelligent home system is characterized in that the load distribution of the method is in a network formed by a plurality of terminal gateways and a local server, and the terminal gateways receive sensor data sent from Zigbee sub-equipment by utilizing a Zigbee coordinator and store the sensor data on the server; the main control gateway divides the data into a plurality of small intervals and maps the small intervals to a Hash ring, virtual nodes are used for replacing the positions of the terminal gateways on the Hash ring, and the number of the virtual nodes is used for expressing the computing power of the terminal gateways;
the method comprises the following specific steps:
step 1, when a system is initialized, storing a calculation power table in a main control gateway, inquiring whether all terminal gateways added into the intelligent home system record calculation power in the calculation power table or not by taking a network card MAC value of the terminal gateway as a main key value, and entering step 2 if the calculation power is recorded; otherwise, calculating the calculation power of the current terminal gateway, recording the MAC value of the current terminal gateway and the corresponding calculation power in a calculation power table, and then entering the step 2 until the calculation powers of all the terminal gateways are recorded in the calculation power table;
step 2, judging the current data accumulation amount and the system operation time, and if the data amount on the current server is accumulated to C and the system time is operated to T, initiating an edge calculation request to the server and the terminal gateway by the main control gateway; otherwise, entering a gateway normal use state;
step 3, after receiving the edge calculation request sent by the master control gateway, the terminal gateway judges whether the terminal gateway is in an idle state at present, if so, the terminal gateway enters an edge calculation network, and the terminal gateway enters step 4; otherwise, not adding the edge computing network;
step 4, the master control gateway inquires the calculation force values of all terminal gateways in the edge calculation network in the current calculation force table, calculates the ratio beta of the calculation force values, distributes N virtual nodes for each terminal gateway by taking K as a unit, and marks the virtual node of each terminal gateway as:
a node (N) { Mn-1, Mn-2., Mn-N | N ∈ 1 to M, and N ═ K β (N) }, and all marked virtual nodes are mapped onto a hash ring by a hash function;
step 5, when the total data amount needing edge calculation is QGB, the main control gateway divides the total data amount into samples with the size of P MB after obtaining the total data amount from the server, obtains Q1024/P data blocks, marks the divided data blocks as 1-Q1024/P in sequence, and maps the data blocks to a Hash ring by using a Hash function;
step 6, on the hash ring, the data block marked as x finds the nearest virtual node of the data block according to the clockwise direction, finds the terminal gateway to which the virtual node belongs, and distributes the data block to the terminal gateway to which the virtual node belongs to perform edge calculation, records the distributed path on the routing table, stores the path on the server and sends the path to each terminal gateway, and then sends the data block to the corresponding terminal gateway in sequence according to the sequence marked in the step 5;
step 7, each terminal gateway compares the taken data blocks with the data paths in the routing table, if the data paths of the data blocks taken by the current terminal gateway in the routing table point to the terminal gateway, edge calculation is carried out, otherwise, calculation is not carried out;
step 8, when a new terminal gateway is accessed into the intelligent home system, the initialization process of the step 1 is also needed; when a new terminal gateway enters into the edge calculation state, in the calculation force table, the corresponding calculation force value of the new terminal gateway is searched by taking the MAC value as an index in the same way, after the calculation force value is obtained, computing a computation force ratio beta (y) of the new terminating gateway and other terminating gateways in the edge computing network, and new N virtual nodes are assigned to the new terminating gateway, labeled node (y) { My-1, My-2., My-N | N ═ K β (y) }, according to the calculation of the hash function, all new virtual nodes are mapped to a hash ring, the position of the data block on the hash ring is rotated clockwise, the nearest terminal gateway is found, then the newly distributed virtual nodes capture the data block, updating a new distribution path in the routing table, sending the routing table to all gateways again, and sending the block data by the server according to the new path;
step 9, when the terminal gateway is switched from an idle state to a non-idle state, the terminal gateway needs to quit the edge computing network, at this time, all virtual nodes corresponding to the terminal gateway quit the hash ring, and the distribution path is updated in the routing table in the same way;
and step 10, after the calculation of each data block is completed, the terminal gateway transmits the calculation result back to the server, and after all the edge calculation tasks are completed, the server summarizes the calculation result and carries out corresponding subsequent processing and storage.
2. The intelligent home system terminal gateway load distribution method based on the hash algorithm according to claim 1, wherein in the idle state in step 3, whether the current gateway is in the idle state is judged according to the CPU utilization rate of the current terminal gateway, and when the CPU utilization rate is less than or equal to T1 and exceeds U time according to the load of the gateway, the gateway belongs to the idle state and is added into the edge computing network; if the CPU utilization rate is larger than T1 and the state is not idle, the edge computing network is not added or quitted, and T1 and U are set threshold values.
CN201811388232.3A 2018-11-21 2018-11-21 Terminal gateway load distribution method based on Hash algorithm in intelligent home system Active CN109462652B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811388232.3A CN109462652B (en) 2018-11-21 2018-11-21 Terminal gateway load distribution method based on Hash algorithm in intelligent home system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811388232.3A CN109462652B (en) 2018-11-21 2018-11-21 Terminal gateway load distribution method based on Hash algorithm in intelligent home system

Publications (2)

Publication Number Publication Date
CN109462652A CN109462652A (en) 2019-03-12
CN109462652B true CN109462652B (en) 2021-06-01

Family

ID=65611099

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811388232.3A Active CN109462652B (en) 2018-11-21 2018-11-21 Terminal gateway load distribution method based on Hash algorithm in intelligent home system

Country Status (1)

Country Link
CN (1) CN109462652B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110572356B (en) * 2019-07-24 2021-07-27 南京智能制造研究院有限公司 Computing power migration method and system based on edge gateway data quality evaluation
CN112399388A (en) * 2019-08-13 2021-02-23 中兴通讯股份有限公司 Method, device and system for realizing edge calculation
CN110636007B (en) * 2019-09-11 2021-05-18 北京智芯微电子科技有限公司 Route arranging method, route arranger and system for edge computing network
CN112491716B (en) * 2019-09-12 2023-07-18 华为技术有限公司 Force calculation routing method and device
CN111586091B (en) * 2020-03-25 2021-03-19 光控特斯联(重庆)信息技术有限公司 Edge computing gateway system for realizing computing power assembly
CN112272239B (en) * 2020-10-30 2022-09-02 深圳市雷鸟网络传媒有限公司 Edge calculation method and device, intelligent terminal and computer readable storage medium
CN112929424B (en) * 2021-01-26 2022-11-15 成都佳发安泰教育科技股份有限公司 Gateway load balancing method, device, equipment and storage medium
CN113556380A (en) * 2021-06-07 2021-10-26 广东东华发思特软件有限公司 Edge distributed multi-copy processing method, device and medium of Internet of things equipment
CN115473753A (en) * 2022-07-20 2022-12-13 青岛海尔科技有限公司 Control method and device of gateway equipment, storage medium and electronic device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105791862A (en) * 2016-03-21 2016-07-20 杭州电子科技大学 Three-dimensional video coding depth map internal mode selection method based on edge complexity
CN106507326A (en) * 2015-09-07 2017-03-15 中国移动通信集团公司 A kind of charging method, system and relevant device
CN106792821A (en) * 2016-12-27 2017-05-31 中国移动通信集团江苏有限公司 Connection control method and device based on virtual gateway
CN108111542A (en) * 2018-01-30 2018-06-01 深圳大学 Internet of Things ddos attack defence method, device, equipment and medium based on SDN
US10104039B1 (en) * 2017-09-28 2018-10-16 Cloudflare, Inc. Establishing and using a tunnel from an origin server in a distributed edge compute and routing service

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106507326A (en) * 2015-09-07 2017-03-15 中国移动通信集团公司 A kind of charging method, system and relevant device
CN105791862A (en) * 2016-03-21 2016-07-20 杭州电子科技大学 Three-dimensional video coding depth map internal mode selection method based on edge complexity
CN106792821A (en) * 2016-12-27 2017-05-31 中国移动通信集团江苏有限公司 Connection control method and device based on virtual gateway
US10104039B1 (en) * 2017-09-28 2018-10-16 Cloudflare, Inc. Establishing and using a tunnel from an origin server in a distributed edge compute and routing service
CN108111542A (en) * 2018-01-30 2018-06-01 深圳大学 Internet of Things ddos attack defence method, device, equipment and medium based on SDN

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"面向多处理器资源预留的实时程序划分方法";吴以凡,张桦,戴国骏;《电子学报》;20140430;全文 *

Also Published As

Publication number Publication date
CN109462652A (en) 2019-03-12

Similar Documents

Publication Publication Date Title
CN109462652B (en) Terminal gateway load distribution method based on Hash algorithm in intelligent home system
CN202218258U (en) Intelligent home gateway and system thereof
CN105049502B (en) The method and apparatus that device software updates in a kind of cloud network management system
CN107979534B (en) Method implemented in a device connected to a user premises equipment and corresponding device
CN111586120B (en) Internet of things gateway equipment, data transmission method, storage medium and installation method
KR100912368B1 (en) System setting up configurations of home network automatically and the method thereof
CN103023681A (en) Smart home control device and updating method
JPWO2015093070A1 (en) Gateway, management center, remote access system, and remote access method
CN110557448A (en) Control method and system for smart home
CN103546572A (en) Cloud storage device and multi-cloud storage networking system and method
CN107450434B (en) Building automatic control system and method based on secondary network
CN108234562B (en) Equipment control method, control equipment and controlled equipment
CN101241365A (en) Method and apparatus for automatically recognizing a connection of a device to a building management system
CN111064591B (en) Data aggregation method, device, equipment, storage medium and system
CN104936202B (en) 6LoWPAN wireless sensor network management system based on CoAP agreement
US8438292B2 (en) Network system establishing communication by use of connectionless protocol
CN117278628B (en) Data transmission method, device, system, computer equipment and storage medium
CN100366014C (en) Domestic controlled network system and system chip for domestic appliance control chip
CN103746836A (en) Embedded network management agent system based on ARM
CN112579053A (en) Design architecture of ultra-light embedded internet of things rule engine
CN112333295A (en) Multipath connection method and device, electronic equipment and storage medium
EP4072106A1 (en) Dynamic environment monitoring
WO2012016411A1 (en) Routing method, routing system and service gateway in intelligent home system
CN104579967A (en) Transmission path control equipment
CN112769658A (en) Terminal control system, method, device, gateway device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant