Data Transmission Method, Device, Storage Medium and Electronic Device

By determining the target status in the first gateway and sending data information to the third process in the second gateway, the problem of time-consuming switching of the main gateway to the backup gateway is solved, and the effect of seamless switching of the main gateway to the backup gateway is achieved, and the switching efficiency of the system is improved.

CN119728402BActive Publication Date: 2025-05-27ZHEJIANG DAHUA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510224463.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-05-27
Estimated Expiration
2045-02-27

AI Technical Summary

Technical Problem

In the prior art, switching from the main gateway to the backup gateway takes a long time, resulting in unsmooth system switching.

Method used

Seamless transmission of data is achieved by determining the target state in the first gateway and sending data information to the third process in the second gateway under abnormal circumstances. The method includes determining the target state of the first process in the first gateway, sending data information to the second process, controlling the second process to send the data information to the third process, and then sending the data information to the target platform.

Benefits of technology

The time for switching between the main and backup gateways is reduced, and the effect of seamless switching between the main gateways is achieved, thereby improving the switching efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728402B_ABST
    Figure CN119728402B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention provides a data transmission method, apparatus, storage medium, and electronic device. The method includes: determining a target state of a first process in a first gateway, where the first gateway is connected to a target platform through the first process; when the target state indicates that the first process is in an abnormal state, sending data information of a device connected to the first gateway to a second process in the first gateway; controlling the second process to send the data information to a third process to instruct the third process to send the data information to the target platform, where the third process is a process in a second gateway that allows data transmission with the second process, and the second gateway is connected to the target platform through the third process. Through the present invention, the problem that the main gateway takes a long time to switch to the standby gateway in the related art is solved, and the effect of shortening the switching time between the main and standby gateways so that the main gateway can seamlessly switch to the standby gateway is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of communications, and more particularly, to a method, apparatus, storage medium, and electronic device for data transmission. Background Art

[0002] In the related art, usually two identical gateways are in operation at the same time. One gateway is a normal working gateway that collects and reports data in real time to a controller, and the other gateway is in a standby state and does not participate in data collection. When the working gateway fails, the standby gateway enters the working state to complete the switchover. However, the standby gateway needs to go through processes such as device registration and gateway registration when switching to the normal working state, which takes a long time.

[0003] It can be seen that there is a technical problem in the related art that the switchover from the primary gateway to the standby gateway takes a long time.

[0004] In view of the above problems in the related art, no effective solution has been proposed yet. Summary of the Invention

[0005] Embodiments of the present invention provide a method, apparatus, storage medium, and electronic device for data transmission, so as to at least solve the problem in the related art that the switchover from the primary gateway to the standby gateway takes a long time.

[0006] According to an embodiment of the present invention, there is provided a method for data transmission, including: determining a target state of a first process in a first gateway, where the first gateway is connected to a target platform through the first process; in a case where the target state indicates that the first process is in an abnormal state, sending data information of a device connected to the first gateway to a second process in the first gateway; controlling the second process to send the data information to a third process, so as to instruct the third process to send the data information to the target platform, where the third process is a process in a second gateway that allows data transmission with the second process, and the second gateway is connected to the target platform through the third process.

[0007] In an exemplary embodiment, before controlling the second process to send the data information to the third process, the method further includes: determining a load state of a third gateway that has established a backup candidate relationship with the first gateway; determining a fourth gateway that meets a predetermined condition from the third gateways based on the load state; in a case where the number of the fourth gateways is multiple, sorting the fourth gateways to obtain a target sorting result, and determining the second gateway from the fourth gateways based on the target sorting result.

[0008] In an exemplary embodiment, determining the load status of a third gateway that establishes a backup candidate relationship with the first gateway includes: obtaining target information at a predetermined time period, where the target information includes at least one of the following: the processor utilization rate of the third gateway, the memory usage rate of the third gateway, the number of backup gateways allowed to be the backup gateway of the third gateway, the network signal strength of the third gateway, the number of sub-devices of the third gateway, and the number of historical failures of the third gateway; determining the obtained target information as the load status.

[0009] In an exemplary embodiment, determining a fourth gateway that meets a predetermined condition from the third gateways based on the load status includes: determining the processor utilization rate included in the load status, and determining a fifth gateway as the gateway whose processor utilization rate included in the third gateway is less than a first preset threshold; determining the memory usage rate of the fifth gateway included in the load status, and determining a sixth gateway as the gateway whose memory usage rate is less than a second preset threshold; determining the number of backup gateways allowed to be the backup gateway of the sixth gateway included in the load status, and determining a seventh gateway as the gateway whose number of backup gateways is greater than a third preset threshold; determining the network signal strength of the seventh gateway included in the load status, and determining the fourth gateway as the gateway whose network signal strength is greater than a fourth preset threshold.

[0010] In an exemplary embodiment, sorting the fourth gateway to obtain a target sorting result includes: determining the number of sub-devices of the fourth gateway included in the load status, and sorting the fourth gateway according to the number of sub-devices to obtain an initial sorting; determining the number of historical failures of the fourth gateway included in the load status, and adjusting the initial sorting according to the number of historical failures to obtain the target sorting result.

[0011] In an exemplary embodiment, after controlling the second process to send the data information to the third process, the method further includes: receiving feedback data sent by the second gateway, where the feedback data is data obtained by the target platform processing the data information; storing the feedback data.

[0012] In an exemplary embodiment, after storing the feedback data, the method further includes: when the target state changes from the abnormal state to the normal state, controlling the second process to send the feedback data to the first process.

[0013] According to another embodiment of the present invention, there is provided a data transmission device, including: a determination module, configured to determine a target state of a first process in a first gateway, where the first gateway is connected to a target platform through the first process; a first sending module, configured to, when the target state indicates that the first process is in an abnormal state, send data information of a device connected to the first gateway to a second process in the first gateway; a second sending module, configured to control the second process to send the data information to a third process, so as to instruct the third process to send the data information to the target platform, where the third process is a process in a second gateway that allows data transmission with the second process, and the second gateway is connected to the target platform through the third process.

[0014] According to still another embodiment of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the steps in any one of the above method embodiments when running.

[0015] According to still another embodiment of the present invention, there is also provided an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0016] According to still another embodiment of the present invention, there is also provided a computer program product, including a computer program, where the steps of the methods described in various embodiments of the present application are implemented when the computer program is executed by a processor.

[0017] Through the present invention, the target state of the first process in the first gateway connected to the target platform can be determined. When the target state indicates that the first process is in an abnormal state, the data information of the device connected to the first gateway can be sent to the second process of the first gateway, and the second process can be controlled to send the data information to the third process in the second gateway, instructing the third process to send the data information to the target platform. Since both the first gateway and the second gateway can work normally independently, when the first gateway is in an abnormal state, the second gateway can directly replace the first gateway for data transmission, that is, the data information of the device connected to the first gateway can be sent to the same target platform through the third process in the second gateway that has already established a data transmission relationship with the first gateway, without the device connected to the first gateway needing to re-establish a data transmission relationship, reducing the switching time. Therefore, the problem of long time consumption in switching the main gateway to the standby gateway in the related art can be solved, achieving the effect of shortening the switching time between the main and standby gateways so that the main gateway can seamlessly switch to the standby gateway. Description of the Drawings

[0018] Figure 1 is the hardware structure block diagram of a mobile terminal for a data transmission method according to an embodiment of the present invention;

[0019] Figure 2 is the flowchart of a data transmission method according to an embodiment of the present invention;

[0020] Figure 3 is the schematic diagram of a gateway backup system according to an embodiment of the present invention;

[0021] Figure 4 is the schematic diagram of the data transmission relationship between processes when the main process is abnormal according to an embodiment of the present invention;

[0022] Figure 5 is the schematic diagram of a gateway group according to an embodiment of the present invention;

[0023] Figure 6 is the flowchart of a gateway backup load balancing scheme according to an embodiment of the present invention;

[0024] Figure 7 is the schematic diagram of the data transmission relationship between processes when the main process is normal according to an embodiment of the present invention;

[0025] Figure 8 is the flowchart of a data transmission method according to a specific embodiment of the present invention;

[0026] Figure 9 is the structural block diagram of a data transmission device according to an embodiment of the present invention. Detailed Embodiments

[0027] In the following, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in conjunction with the embodiments.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence.

[0029] The method embodiments provided in the embodiments of the present application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is the hardware structure block diagram of a mobile terminal for a data transmission method according to an embodiment of the present invention. As Figure 1 shown, the mobile terminal may include one or more ( Figure 1Only one processor 102 is shown (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Among them, the above mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those of ordinary skill in the art can understand that Figure 1 The structure shown is only illustrative and does not limit the structure of the above mobile terminal. For example, the mobile terminal may further include more or fewer components than Figure 1 shown therein, or have a different configuration from Figure 1 shown.

[0030] The memory 104 can be used to store computer programs. For example, software programs and modules of application software, such as the computer program corresponding to the data transmission method in the embodiments of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implements the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely disposed relative to the processor 102, and these remote memories can be connected to the mobile terminal through a network. Examples of the above network include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0031] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one instance, the transmission device 106 includes a network adapter (abbreviated as NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0032] In this embodiment, a data transmission method is provided. Figure 2 is a flowchart of the data transmission method according to the embodiments of the present invention, as Figure 2 shown, and the process includes the following steps:

[0033] Step S202, determining the target state of the first process in the first gateway, where the first gateway is connected to the target platform through the first process;

[0034] Step S204, when the target state indicates that the first process is in an abnormal state, send the data information of the device connected to the first gateway to the second process in the first gateway;

[0035] Step S206, control the second process to send the data information to the third process, so as to instruct the third process to send the data information to the target platform, where the third process is a process in the second gateway that allows data transmission with the second process, and the second gateway is connected to the target platform through the third process.

[0036] In the above embodiment, the gateway can be understood as a link connecting the sensing network and the traditional communication network, which can realize protocol conversion between the sensing network and the communication network, different types of sensing networks, and can also realize wide-area interconnection and local-area interconnection. For the specific structures of the first gateway and the second gateway, reference can be made to Figure 3 , Figure 3 which is a schematic diagram of the gateway backup system according to the embodiment of the present invention. As Figure 3 shown, the first gateway can be the main gateway A, and the second gateway can be the standby gateway B. Both the first gateway and the second gateway need to include a daemon process, a main process, a secondary process, and an access process. The access process also needs to perform data transmission with multiple sub-devices and can receive data sent from multiple sub-devices. The first gateway and the second gateway are gateways that can independently complete data transmission with the target platform in the normal working state and both have redundant backup functions. Among them, a process can be understood as the execution process of a program.

[0037] In the related art, each main gateway needs to set a standby gateway, and when the main gateway fails, the standby gateway is enabled. For example, when the number of main gateways is 1000, 1000 standby gateways are required, that is, 2000 gateways need to be set. In this embodiment, however, the first gateway and the second gateway can be parallel gateways. Both the first gateway and the second gateway can be used as independent gateways to connect different sub-devices and send the data of different sub-devices to the target platform. That is, only 1000 gateways need to be set. The gateways included in the 1000 gateways can back up each other, and there is no need to set dedicated standby gateways. By adding a backup function to the gateways in the working state, the number of backup gateways can be reduced by half. There is no need for 1000 additional backup gateways, and only 1000 gateways are required to achieve seamless switching between the main and standby gateways, and the usage cost of the device can be greatly reduced.

[0038] In the above embodiment, the main process can be responsible for most of the tasks in the gateway, such as connecting with the target platform, scheduled tasks, or adding, deleting, modifying, and checking sub-devices with which data transmission relationships are established, but not limited thereto. The auxiliary process can be responsible for connecting with other gateways, and the two gateways that have established connections can serve as backup gateways for each other. When the main process of one of the gateways is abnormal, the service can be quickly sent to the backup gateway. The access process can be responsible for the access of multiple sub-devices, and can establish data transmission relationships with the main process and the auxiliary process in a multi-process manner to transmit messages and data. The daemon process can be responsible for detecting other processes, and can quickly restart the process when other processes are abnormal.

[0039] In the above embodiment, when the first gateway and the second gateway are in normal working state, the main process in the first gateway (i.e., the above-mentioned first process) can be connected to the cloud platform (i.e., the above-mentioned target platform), and the access process can establish a data transmission relationship between multiple processes with the main process and the auxiliary process, and can also establish a data transmission relationship with multiple sub-devices, and can send data information in multiple sub-devices to the first process, so as to send the data information to the target platform through the first process. The auxiliary process in the first gateway (i.e., the above-mentioned second process) can establish a data transmission relationship with the main process in the second gateway (i.e., the above-mentioned third process), that is, establish a backup relationship, and can be connected through transmission links such as wifi, 4G / 5G, etc., to avoid the wired network used by the main process, and can avoid the auxiliary process from being paralyzed at the same time when the main process network fails.

[0040] In the above embodiment, when the daemon process in the first gateway determines that the target state of the first process is abnormal, the first process can be restarted. In addition, when the access process in the first gateway detects that the first process is abnormal, the data transmission relationship between the main process, the auxiliary process and the access process will change. Figure 4 is a schematic diagram of the data transmission relationship between processes when the main process is abnormal according to an embodiment of the present invention, such as Figure 4 As shown, under normal working conditions, the data transmission state of establishing a primary data transmission relationship with the first process and an auxiliary data transmission relationship with the second process will switch to a data transmission state of establishing an auxiliary data transmission relationship with the first process and a primary data transmission relationship with the second process. Among them, the abnormal state can be a freeze, a memory leak, or a failure to connect to the network with the target platform, etc., but is not limited to this. The process whose data transmission state is the primary connection can be understood as a process that receives data information from the connected device (that is, when the first process is in an abnormal state, the second process can receive data information sent by the access process).

[0041] In the above embodiments, the second gateway may proxy the first gateway to forward messages. After receiving the data information, the second process may send the data information to the main process (i.e., the above-mentioned third process) in the second gateway that has established a data transmission relationship with the first gateway. After receiving the data information, the third process may add the identifier of the first gateway to the data message and forward it to the target platform, so as to forward the data information in the first gateway to the same target platform.

[0042] Through the present invention, the target state of the first process in the first gateway connected to the target platform can be determined. When the target state indicates that the first process is in an abnormal state, the data information of the device connected to the first gateway can be sent to the second process in the first gateway, and the second process can be controlled to send the data information to the third process in the second gateway, instructing the third process to send the data information to the target platform. Since both the first gateway and the second gateway can work independently and normally, when the first gateway is in an abnormal state, the second gateway can directly replace the first gateway to perform data transmission, that is, the data information of the device connected to the first gateway can be sent to the same target platform through the third process in the second gateway that has already established a data transmission relationship with the first gateway, without the need for the device connected to the first gateway to re-establish a data transmission relationship, reducing the switching time. Therefore, the problem of long time consumption in switching the main gateway to the standby gateway in the related art can be solved, achieving the effect of shortening the switching time between the main and standby gateways so that the main gateway can seamlessly switch to the standby gateway.

[0043] Optionally, the execution subject of the above steps may be a background processor, a server, or a terminal, but is not limited thereto.

[0044] In an exemplary embodiment, before controlling the second process to send the data information to the third process, the method further includes: determining the load status of the third gateway that has established a backup candidate relationship with the first gateway; determining a fourth gateway that meets a predetermined condition from the third gateways based on the load status; when the number of the fourth gateways is multiple, sorting the fourth gateways to obtain a target sorting result, and determining the second gateway from the fourth gateways based on the target sorting result.

[0045] In the above embodiments, after the system is initialized, the load status of multiple third gateways that are adjacent to the first gateway and establish candidate backup relationships can be obtained through methods such as the gateway search protocol and user specification. The fourth gateway that meets the predetermined conditions among the multiple third gateways can be determined based on the load status of the gateways. The load capabilities of the multiple gateways in the fourth gateway can be sorted in descending order to obtain the target sorting result. The gateway ranked first or the top two in the target sorting result can be determined as the second gateway, that is, the second gateway can be one or multiple, and can be determined according to the actual load status of the gateway. Among them, the predetermined condition can be that the load status is less than 70% or 50% of the maximum load capacity, but is not limited thereto.

[0046] In an exemplary embodiment, determining the load status of the third gateway that establishes a backup candidate relationship with the first gateway includes: obtaining target information according to a predetermined time period, where the target information includes at least one of the following: the processor utilization rate of the third gateway, the memory usage rate of the third gateway, the number of backup gateways allowed to be the backup gateway of the third gateway, the network signal strength of the third gateway, the number of sub-devices of the third gateway, and the historical failure times of the third gateway; determining the obtained target information as the load status.

[0047] In the above embodiments, the gateways can exchange parameters within a predetermined time period. Figure 5 It is a schematic diagram of a gateway group according to an embodiment of the present invention. As Figure 5 shown, the multiple third gateways that are adjacent to the first gateway and establish candidate backup relationships can be gateway B, gateway C, gateway D, and gateway E. The first gateway and the multiple third gateways can regularly communicate the load status of the gateways (that is, exchange target information within the above-mentioned predetermined time period). The target information for interaction can include the number of sub-devices, the gateway processor utilization rate, the gateway memory usage rate, the signal strength of the connection between gateways, the number of backup gateways allowed to be the backup gateway (that is, the number of gateways allowed to receive minus the number of gateways already received), and the historical failure times (for example, the number of times the gateway crashes in the past 24 hours, or the number of times the gateway crashes in the past 48 hours). The load status can be determined by the target information including the processor utilization rate, the memory usage rate, the number of backup gateways allowed to be the backup gateway, the network signal strength, the number of sub-devices, and the historical failure times to determine the second gateway that can establish a backup relationship with the first gateway among the third gateways. Among them, the predetermined time period can be 1 minute or 5 minutes, and the present invention does not limit this.

[0048] In an exemplary embodiment, determining a fourth gateway that meets a predetermined condition from the third gateways based on the load status includes: determining the processor utilization rate included in the load status, and determining a fifth gateway from the third gateways where the processor utilization rate is less than a first preset threshold; determining the memory usage rate of the fifth gateway included in the load status, and determining a sixth gateway where the memory usage rate is less than a second preset threshold; determining the number of backup-capable gateways that are allowed to be the backup gateways of the sixth gateway included in the load status, and determining a seventh gateway where the number of backup-capable gateways is greater than a third preset threshold; determining the network signal strength of the seventh gateway included in the load status, and determining the fourth gateway where the network signal strength is greater than a fourth preset threshold.

[0049] In the above embodiment, the flowchart for determining the backup gateway can be seen in Figure 6 , Figure 6 is the flowchart of the gateway backup load balancing solution according to the embodiment of the present invention. The process includes:

[0050] S602, interacting with gateway backup parameters;

[0051] S604, determining whether the CPU is overloaded. If it exceeds the threshold, execute step S616. If it does not exceed the threshold, execute step S606;

[0052] S606, determining whether there is free memory. If it exceeds the threshold, execute step S616. If it does not exceed the threshold, execute step S608;

[0053] S608, determining the number of backup-capable gateways. If the number of backup-capable gateways is full, execute step S616. If the number of backup-capable gateways is not full, execute step S610;

[0054] S610, determining the network signal strength. If it is lower than the threshold, execute step S616. If it is not lower than the threshold, execute step S612;

[0055] S612, sorting the backup gateways;

[0056] S614, uploading the gateway backup relationship to the cloud platform;

[0057] S616, not including it in the backup gateway list.

[0058] In the above embodiments, it is possible to first determine the gateway CPU load in the third gateway (i.e., the above-mentioned processor utilization rate), determine the gateway with a processor utilization rate less than the first preset threshold as the candidate gateway after the first screening (i.e., the above-mentioned fifth gateway), and do not include the gateway with a processor utilization rate greater than the first preset threshold in the list of backup gateways. Among them, the first preset threshold can be a processor utilization rate of 70%, or a processor utilization rate of 75%, but is not limited thereto. After excluding the gateways with a relatively high processor utilization rate, it is possible to continue to determine the free memory of the gateways in the fifth gateway (i.e., the above-mentioned memory utilization rate), determine the gateway with a memory utilization rate less than the second preset threshold in the fifth gateway as the candidate gateway after the second screening (i.e., the above-mentioned sixth gateway), and do not include the gateway with a memory utilization rate greater than the second preset threshold in the list of backup gateways. Among them, the second preset threshold can be 5M of memory, or 10M of memory, etc. Since the number of sub-devices in the gateway and operations such as regularly turning on and off the sub-devices will affect the memory, the second preset threshold can be determined according to the actual situation, and the present invention does not limit this. It is possible to determine the number of backup gateways that can be used as backup gateways included in the sixth gateway, and determine the gateway with the number of backup gateways greater than 0 (i.e., the above-mentioned third preset threshold) as the candidate gateway after the third screening (i.e., the above-mentioned seventh gateway). If the number of backup gateways is equal to 0, it can be stated that there are other backup gateways, and then this gateway is not included in the list of backup gateways. It is also possible to determine the network signal strength of the gateways included in the seventh gateway, determine the gateway with a network signal strength greater than the fourth preset threshold as the fourth gateway, and do not include the gateway with a network signal strength less than the fourth preset threshold in the list of backup gateways. Among them, the fourth preset threshold can be set according to different networks. For example, when connecting through WIFI, the fourth threshold can be -70dBm, or -65dBm, etc. When connecting through 5G / 4G, the fourth preset threshold can be -60dBm, or -50dBm, etc., and the present invention does not limit this.

[0059] In an exemplary embodiment, sorting the fourth gateway to obtain a target sorting result includes: determining the number of sub-devices of the fourth gateway included in the load status, sorting the fourth gateway according to the number of sub-devices to obtain an initial sorting; determining the historical failure times of the fourth gateway included in the load status, and adjusting the initial sorting according to the historical failure times to obtain the target sorting result.

[0060] In the above embodiments, the number of sub-devices connected to the gateways included in the fourth gateway can be determined, and the gateways corresponding to the number of sub-devices can be sorted in reverse order to obtain an initial sorting, that is, the fewer the number of sub-devices connected to the gateway, the higher the ranking, and the more the number of sub-devices connected to the gateway, the lower the ranking. The initial sorting can also be adjusted by the number of historical failures, that is, for each historical failure that occurs within a preset period for the gateways included in the fourth gateway, the sorting is adjusted one position backward to obtain the final target sorting result. The preset period can be related to the number of positions adjusted backward, that is, if a failure occurs within the past hour, the sorting of the corresponding gateway can be adjusted 2 positions backward; if a failure occurs within the past 24 hours, the sorting of the corresponding gateway can be adjusted 1 position backward, and so on. Example: When the fourth gateway includes gateway B, gateway C, gateway D, and gateway E, and the initial sorting is gateway B, gateway C, gateway D, gateway E, if gateway B has a failure within the past 1 hour, then gateway B in the initial sorting is adjusted 2 positions backward, and the target sorting result that can be obtained is gateway C, gateway D, gateway B, gateway E; if gateway C has a failure within the past 24 hours, then the sorting of gateway C can be adjusted 1 position backward, and the target sorting that can be obtained is gateway D, gateway C, gateway B, gateway E. After determining the gateway backup order, if the final target sorting result is gateway B, gateway C, gateway D, gateway E, then gateway A can select gateway B as the first backup gateway and gateway C as the second backup gateway. After the cloud platform obtains the gateway backup relationship, it can record it and support processing gateway A messages in the messages reported by gateway D and gateway C.

[0061] In an exemplary embodiment, after controlling the second process to send the data information to the third process, the method further includes: receiving feedback data sent by the second gateway, where the feedback data is the data obtained by the target platform processing the data information; storing the feedback data.

[0062] In the above embodiments, at the target platform level, the target platform can select the first gateway and the second gateway to establish a backup relationship at the target platform. When the first gateway fails, the data information of the first gateway can be uploaded to the target platform through the third process in the second gateway. After the target platform receives the data information about the first gateway reported by the third process, it can set the first gateway to the offline state, and send the feedback data that needs to be sent to the first gateway to the second gateway. The third process in the second gateway can send the feedback data to the second process in the first gateway, and the second process can use the queue to cache the feedback data. The target platform can also choose to still send the feedback data to the first gateway. Since the first gateway cannot receive the messages from the target platform at this time, the feedback data sent by the target platform to the first gateway will be lost.

[0063] In the above embodiments, the target platform may also select not to establish a backup relationship between the first gateway and the second gateway on the target platform, and only parse and process other gateway messages reported by a certain gateway. For example, in the data message reported by gateway B, the target platform can parse the data message to identify the message of gateway A, and then determine that this data message belongs to gateway A, and then process the data message of gateway A. However, since no backup relationship is established, the feedback data of the target platform will not be sent to the second gateway, and the first gateway will not receive the feedback message either.

[0064] In an exemplary embodiment, after storing the feedback data, the method further includes: when the target state changes from the abnormal state to the normal state, controlling the second process to send the feedback data to the first process.

[0065] In the above embodiments, after the first process restarts and completes, it can re - establish a connection with the target platform and re - establish a data transmission relationship with the access process. The data transmission relationships among the main process, the auxiliary process, and the access process will return to the data transmission relationships in the normal working state. Figure 7 It is a schematic diagram of the inter - process data transmission when the main process is normal according to an embodiment of the present invention, as Figure 7 shown. The access process sets the data transmission relationship with the first process as the main data transmission relationship and the data transmission relationship with the second process as the auxiliary data transmission relationship. When the second process detects that the first process has resumed normal operation, it can actively establish a data transmission relationship with the first process and send the cached feedback data to the first process for processing by the first gateway. At the same time, the second process can notify the third process in the second gateway that the first gateway has resumed normal operation.

[0066] The data transmission method will be described below in combination with specific embodiments:

[0067] Figure 8 It is a flowchart of the data transmission method according to a specific embodiment of the present invention, as Figure 8 shown. The process includes:

[0068] S802, system initialization;

[0069] S804, gateways establish a backup relationship;

[0070] S806, the main process of gateway A is abnormal;

[0071] S808, gateway A switches the connection to gateway B;

[0072] S810, gateway B acts as proxy for gateway A;

[0073] S812, the main process of gateway A resumes normal operation.

[0074] In the above embodiments, by establishing backup candidate relationships among multiple gateways, a backup gateway that establishes a backup relationship with the primary gateway can be selected, and the services of the faulty gateway can be transferred to the backup gateway with the lowest load, so as to reduce the impact on the entire system. In addition, through the multi-process technology, the primary gateway can establish a data transmission relationship with the primary process of the backup gateway through the secondary process, which increases the gateway backup function. The backup gateway can also establish a backup relationship with the primary gateway through the same solution. In scenarios such as industrial Internet or smart home that require multiple gateways, the gateways can form backup relationships with each other, and there is no need for a dedicated redundant backup gateway. It is also possible to strip the basic functions that are not prone to errors to the access process and the secondary process, that is, by establishing a backup data transmission relationship between two gateways, the primary gateway can have two communication links to the platform (the primary gateway communication link and the backup gateway communication link). When a failure occurs in the primary process of the primary gateway, that is, the primary gateway communication link fails, through the detection mechanism between processes, the primary gateway can immediately switch to the backup gateway communication link, avoiding the process of the sub-devices re-registering to the network and the gateway reconnecting to the platform.

[0075] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc), and includes several instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present invention.

[0076] In this embodiment, a data transmission device is further provided. The device is used to implement the above embodiments and preferred embodiments, and those that have been described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0077] Figure 9 is a structural block diagram of the data transmission device according to an embodiment of the present invention. As Figure 9 shown, the device includes:

[0078] A determination module 92, configured to determine the target state of a first process in a first gateway, where the first gateway is connected to a target platform through the first process;

[0079] The first sending module 94 is configured to, when the target state indicates that the first process is in an abnormal state, send the data information of the device connected to the first gateway to the second process in the first gateway;

[0080] The second sending module 96 is configured to control the second process to send the data information to the third process, so as to instruct the third process to send the data information to the target platform, where the third process is a process in the second gateway that allows data transmission with the second process, and the second gateway is connected to the target platform through the third process.

[0081] In an exemplary embodiment, before the device controls the second process to send the data information to the third process, the device may: determine the load status of the third gateway that has established a backup candidate relationship with the first gateway; determine a fourth gateway that meets a predetermined condition from the third gateways based on the load status; when the number of the fourth gateways is multiple, sort the fourth gateways to obtain a target sorting result, and determine the second gateway from the fourth gateways based on the target sorting result.

[0082] In an exemplary embodiment, the device may implement determining the load status of the third gateway that has established a backup candidate relationship with the first gateway in the following manner: obtain target information according to a predetermined time period, where the target information includes at least one of the following: the processor utilization rate of the third gateway, the memory usage rate of the third gateway, the number of backup gateways that are allowed to be the backup gateway of the third gateway, the network signal strength of the third gateway, the number of sub-devices of the third gateway, and the historical failure times of the third gateway; determine the obtained target information as the load status.

[0083] In an exemplary embodiment, the device may also implement determining a fourth gateway that meets a predetermined condition from the third gateways based on the load status in the following manner: determine the processor utilization rate included in the load status, and determine a fifth gateway as the gateway in the third gateways whose processor utilization rate is less than a first preset threshold; determine the memory usage rate of the fifth gateway included in the load status, and determine a sixth gateway as the gateway whose memory usage rate is less than a second preset threshold; determine the number of backup gateways that are allowed to be the backup gateway of the sixth gateway included in the load status, and determine a seventh gateway as the gateway whose number of backup gateways is greater than a third preset threshold; determine the network signal strength of the seventh gateway included in the load status, and determine the fourth gateway as the gateway whose network signal strength is greater than a fourth preset threshold.

[0084] In an exemplary embodiment, the device may also sort the fourth gateway in the following manner to obtain a target sorting result: determine the number of sub-devices of the fourth gateway included in the load status, sort the fourth gateway according to the number of sub-devices to obtain an initial sorting; determine the historical failure times of the fourth gateway included in the load status, and adjust the initial sorting according to the historical failure times to obtain the target sorting result.

[0085] In an exemplary embodiment, the device may also be used for: after controlling the second process to send the data information to the third process, receiving feedback data sent by the second gateway, where the feedback data is data obtained by the target platform processing the data information; storing the feedback data.

[0086] In an exemplary embodiment, the device may also be used for: after storing the feedback data, when the target state changes from the abnormal state to the normal state, controlling the second process to send the feedback data to the first process.

[0087] It should be noted that the above-mentioned modules can be implemented by software or hardware. For the latter, it can be achieved in the following ways, but not limited to this: the above-mentioned modules are all located in the same processor; or, the above-mentioned modules are respectively located in different processors in any combination form.

[0088] An embodiment of the present invention also provides a computer-readable storage medium, in which a computer program is stored, and the computer program is set to execute the steps in any one of the above method embodiments when running.

[0089] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drive, read-only memory (ROM for short), random access memory (RAM for short), mobile hard disk, magnetic disk or optical disk and other various media that can store computer programs.

[0090] An embodiment of the present invention also provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is set to run the computer program to execute the steps in any one of the above method embodiments.

[0091] In an exemplary embodiment, the above electronic device may further include a transmission device and an input / output device, where the transmission device is connected to the above processor, and the input / output device is connected to the above processor.

[0092] An embodiment of the present invention also provides a computer program product, including a computer program which, when executed by a processor, implements the steps of the methods in the various embodiments of the present application.

[0093] Specific examples in this embodiment may refer to the examples described in the above embodiments and exemplary embodiments, and will not be repeated here.

[0094] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. They can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order from here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. In this way, the present invention is not limited to any specific combination of hardware and software.

[0095] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data transmission method, characterized in that: include: Determining a target state of a first process in a first gateway, wherein the first gateway is connected to a target platform through the first process; When the target state indicates that the first process is in an abnormal state, sending data information of a device connected to the first gateway to a second process in the first gateway; Control the second process to send the data information to the third process to instruct the third process to send the data information to the target platform, wherein the third process is a process in the second gateway that allows data transmission with the second process, and the second gateway is connected to the target platform through the third process, and the first gateway and the second gateway both independently complete data transmission with the target platform under normal conditions, and the first gateway and the second gateway are connected to different sub-devices as independent gateways, and send data of different sub-devices to the target platform.

2. The method according to claim 1, characterized in that Before controlling the second process to send the data information to the third process, the method further includes: Determining a load state of a third gateway that establishes a backup candidate relationship with the first gateway; Determine a fourth gateway that meets a predetermined condition from the third gateways based on the load status; In the case that there are multiple fourth gateways, the fourth gateways are sorted to obtain a target sorting result, and the second gateway is determined from the fourth gateways based on the target sorting result.

3. The method according to claim 2, characterized in that Determining a load state of a third gateway that establishes a backup candidate relationship with the first gateway includes: Acquire target information according to a predetermined time period, wherein the target information includes at least one of the following: processor utilization of the third gateway, memory utilization of the third gateway, the number of backup gateways allowed to be backup gateways of the third gateway, network signal strength of the third gateway, the number of sub-devices of the third gateway, and the number of historical failures of the third gateway; The acquired target information is determined as the load state.

4. The method according to claim 2, characterized in that: Determining a fourth gateway that meets a predetermined condition from the third gateways based on the load state includes: Determine a processor utilization rate included in the load state, and determine a gateway included in the third gateway whose processor utilization rate is less than a first preset threshold as a fifth gateway; Determine the memory usage rate of the fifth gateway included in the load state, and determine a gateway whose memory usage rate is less than a second preset threshold as a sixth gateway; Determine the number of backup gateways included in the load state that are allowed to serve as backup gateways for the sixth gateway, and determine a gateway whose number of backup gateways is greater than a third preset threshold as the seventh gateway; The network signal strength of the seventh gateway included in the load status is determined, and a gateway whose network signal strength is greater than a fourth preset threshold is determined as the fourth gateway.

5. The method according to claim 2, characterized in that: Sorting the fourth gateway to obtain a target sorting result includes: Determine the number of sub-devices of the fourth gateway included in the load state, and sort the fourth gateways according to the number of sub-devices to obtain an initial sort; Determine the number of historical failures of the fourth gateway included in the load status, adjust the initial sorting according to the number of historical failures, and obtain the target sorting result.

6. The method according to claim 1, characterized in that After controlling the second process to send the data information to a third process, the method further includes: receiving feedback data sent by the second gateway, wherein the feedback data is data obtained by the target platform processing the data information; The feedback data is stored.

7. The method according to claim 6, characterized in that After storing the feedback data, the method further includes: When the target state is changed from the abnormal state to the normal state, the second process is controlled to send the feedback data to the first process.

8. A data transmission device, characterized in that: include: a determination module, configured to determine a target state of a first process in a first gateway, wherein the first gateway is connected to a target platform through the first process; A first sending module, configured to send data information of a device connected to the first gateway to a second process in the first gateway when the target state indicates that the first process is in an abnormal state; The second sending module is used to control the second process to send the data information to the third process, so as to instruct the third process to send the data information to the target platform, wherein the third process is a process in the second gateway that allows data transmission with the second process, and the second gateway is connected to the target platform through the third process, and the first gateway and the second gateway both independently complete data transmission with the target platform under normal conditions, and the first gateway and the second gateway are connected to different sub-devices as independent gateways, and send data of different sub-devices to the target platform.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Message forwarding method, equipment and system

    CN108206759A