CN114143299A - Data synchronization method and system based on Internet of things - Google Patents

Data synchronization method and system based on Internet of things Download PDF

Info

Publication number
CN114143299A
CN114143299A CN202111348247.9A CN202111348247A CN114143299A CN 114143299 A CN114143299 A CN 114143299A CN 202111348247 A CN202111348247 A CN 202111348247A CN 114143299 A CN114143299 A CN 114143299A
Authority
CN
China
Prior art keywords
data
service request
node
user
service
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.)
Pending
Application number
CN202111348247.9A
Other languages
Chinese (zh)
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.)
Guangzhou Coayu Robot Co Ltd
Original Assignee
Guangzhou Coayu Robot Co Ltd
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 Guangzhou Coayu Robot Co Ltd filed Critical Guangzhou Coayu Robot Co Ltd
Priority to CN202111348247.9A priority Critical patent/CN114143299A/en
Publication of CN114143299A publication Critical patent/CN114143299A/en
Pending legal-status Critical Current

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/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • 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/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • 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/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application relates to a data synchronization method and system based on the Internet of things, wherein the method comprises the steps of obtaining a user type corresponding to a current service request and initializing a sharing label; when the user type is a sharing user, resetting the sharing label as a tracking identifier of the data call chain; based on the current service request, binding the user tag and the shared tag to obtain a service request data packet, and transmitting the service request data packet to a service response node, so that the service response node feeds back the updated response data packet according to the service request data packet, and further, when one device is shared by a plurality of users for use, synchronous data display can be realized; the problem that data display of different intelligent terminals is not synchronous due to the fact that round-trip delay among all nodes is not consistent is solved, and therefore the round-trip delay of a distributed Internet of things system with a calculation dependency relationship is reduced.

Description

Data synchronization method and system based on Internet of things
Technical Field
The application relates to the technical field of data processing of the Internet of things, in particular to a data synchronization method and system based on the Internet of things.
Background
With the development of Internet of Things (IoT, Internet of Things) technology, "everything interconnection" is gradually changing from scientific research to mature application technology. Taking an intelligent home as an example, the intelligent home can be an independently controllable internet of things communication node regardless of large household appliances such as televisions, washing machines and refrigerators, or small household appliances such as table lamps, cameras, floor sweeping machines and fitness equipment. The user can carry out remote positioning, control to equipment with the help of intelligent terminal, can share other users with thing networking device even, realizes that a plurality of users share the same platform equipment of operation, improves the value of utilizing of hardware product.
Distributed computing (Distributed computing) is a common feature of all internet of things systems, that is, one internet of things system is constructed by a plurality of software modules which have computing dependency and realize remote deployment. When a user initiates a function call through a front-end service (such as APP/Web), a series of service request and response communication processes are triggered between software modules with calculation dependence, and the whole data link starts from the front-end service node and runs through a plurality of back-end service nodes. In the distributed internet of things system introduced above, Round-Trip Time (RTT) refers to the total Time required for a user to successfully acquire data content responded by a back-end node from a Time when the user initiates a function request through a front-end service node. In actual development of internet of things products, whether a round trip delay parameter meets a user expectation or not is emphasized in a system design stage, consistency between the round trip delay parameter and the round trip delay parameter is one of important technical indexes for measuring performance of internet of things products, and reduction of round trip delay (RTT) is a key technology and a main difficulty for improving performance of the internet of things systems.
In the implementation process, the inventor finds that at least the following problems exist in the conventional technology: in a weak network environment, namely when network communication of one or more service nodes exists in a data call chain is unstable, and when one device is shared by a plurality of users for use, round-trip delay among the nodes is inconsistent, so that data display of different intelligent terminals is asynchronous.
Disclosure of Invention
Therefore, it is necessary to provide a data synchronization method and system based on the internet of things, aiming at the problem that when the network communication of one or more service nodes in the data call chain is unstable and when one device is shared by a plurality of users, the round-trip delay between the nodes is inconsistent, which causes data display asynchronization of different intelligent terminals, in the conventional weak network environment.
In order to achieve the above object, an embodiment of the present invention provides a data synchronization method based on an internet of things based on a service request node, including the following steps:
acquiring a user type corresponding to the current service request, and initializing a sharing tag;
when the user type is a sharing user, resetting the sharing label as a tracking identifier of the data call chain;
and based on the current service request, binding the user tag and the shared tag to obtain a service request data packet, and transmitting the service request data packet to a service response node so that the service response node feeds back an updated response data packet according to the service request data packet.
In one embodiment, the step of obtaining the user type corresponding to the current node service request and initializing the shared tag includes:
applying for a sending delay stage occupying a round-trip delay, and acquiring a user type corresponding to a current service request by accessing a service response node in a data call chain;
the shared tag is initialized to a null data pointer.
In one embodiment, the step of initializing the shared tag is followed by:
when the user type is a non-sharing user, the sharing label is reserved as a null data pointer.
In one embodiment, the step of binding the user tag and the shared tag based on the current service request to obtain the service request data packet includes:
and the application is ended, and a sending delay stage in the round-trip delay is occupied.
The embodiment of the invention provides a data synchronization method based on the Internet of things based on a service response node, which comprises the following steps:
acquiring a service request data packet transmitted by a service request node;
processing the service request data packet to obtain a shared label and a user label, and initializing a shared user counter;
when the shared tag is effective, reading the user tag and updating a shared user counter;
and when the sharing label of the service request node is invalid or the sharing user counter is updated, updating the response mode into full data or incremental data to obtain an updated response data packet, and transmitting the updated response data packet to the service request node.
In one embodiment, the step of updating the shared user counter comprises:
updating the shared user counter in a set time period based on the relation table; the relation table comprises service names, sharing labels, user labels and field service request recent time.
In one embodiment, the step of updating the shared user counter within a set time period based on the relationship table comprises:
if the shared label is a non-null data pointer and the user label does not exist in the relation table, creating a shared request record;
if the shared tag is a non-null data pointer and the user tag exists in the relation table, updating the shared request record; wherein, the update sharing request record is as follows: updating the latest time of the field service request corresponding to the user tag into the time of a transmission delay stage in the round-trip delay occupied by the application;
and if the latest time of the field service request in the relation table exceeds a set time period, deleting the sharing request record.
In one embodiment, the method further comprises the following steps:
when the operation of creating the sharing request record is executed, the value of the sharing user counter is increased by a first set value, and the response mode is updated to be full data;
when the operation of deleting the sharing request record is executed, the value of the sharing user counter is reduced by a first set value, and the updating response mode is incremental data;
when the operation of updating the sharing request record is performed, the value of the sharing user counter remains unchanged, and the update response mode is incremental data.
In one embodiment, when the shared tag of the service request node is invalid or the shared user counter is updated, the step of updating the response mode to be full data or incremental data to obtain an updated response packet includes:
applying for a scheduling delay stage occupying the round trip delay, and reading a response mode;
if the response mode is full data, calling a rear terminal service node to acquire the full data; if the response mode is incremental data, calling a rear terminal service node to acquire the incremental data;
updating the full data or the incremental data to a response data packet to obtain an updated response data packet;
and the application is finished and the scheduling delay stage in the round-trip delay is occupied.
The embodiment of the invention also provides a data synchronization system based on the internet of things, which comprises: a service request node and a service response node;
the service request node is used for executing the data synchronization method based on the Internet of things based on the service request node;
the service response node is used for executing the data synchronization method based on the Internet of things and based on the service response node.
One of the above technical solutions has the following advantages and beneficial effects:
in each embodiment of the data synchronization method based on the internet of things, when a plurality of service request nodes share the same service response node, at least one service request node can acquire the user type corresponding to the current service request and initialize the sharing label; when the user type is a sharing user, resetting the sharing label as a tracking identifier of the data call chain; based on the current service request, the user tag and the shared tag are bound to obtain a service request data packet, and the service request data packet is transmitted to the service response node, so that the service response node feeds back the updated response data packet according to the service request data packet, and synchronous data display can be realized when one device is shared by a plurality of users. When the distributed internet of things system is in a weak network environment, namely the stability of network signals of a certain computing service node fluctuates greatly, and one device is shared by a plurality of users for use, the problem that a plurality of front end nodes keep real-time online for high-frequency and large-scale data communication on the premise of not increasing the processing time delay of a rear end node can be solved, the problem that data display of different intelligent terminals is asynchronous due to inconsistent round-trip time delay among the nodes is avoided, and therefore the round-trip time delay of the distributed internet of things system with a computing dependency relationship is reduced.
Drawings
FIG. 1 is a schematic diagram of a distributed computing feature of an Internet of things system;
FIG. 2 is a schematic diagram of an application environment of the data synchronization method based on the Internet of things in one embodiment;
fig. 3 is a first flowchart of a data synchronization method based on the internet of things on the service request node side in one embodiment;
fig. 4 is a second flowchart of the data synchronization method based on the internet of things on the service request node side in one embodiment;
fig. 5 is a third flowchart of the data synchronization method based on the internet of things on the service request node side in one embodiment;
fig. 6 is a first flowchart of a data synchronization method based on the internet of things on the service response node side in one embodiment;
FIG. 7 is a flowchart illustrating the shared subscriber counter update step at the service response node side in one embodiment;
FIG. 8 is a flowchart illustrating the response data update procedure at the service response node side in one embodiment;
FIG. 9 is a schematic diagram illustrating an application of the data synchronization method based on the Internet of things in one embodiment;
fig. 10 is a schematic structural diagram of a data synchronization system based on the internet of things in one embodiment.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In addition, the term "plurality" shall mean two as well as more than two.
Distributed computing (Distributed computing) is a common feature of all internet of things systems, that is, one internet of things system is constructed by a plurality of software modules which have computing dependency and realize remote deployment. When a user initiates a function call through a front-end service (e.g., APP/Web), a series of service request and response communication processes are triggered between software modules with computing dependencies, and the entire data link starts from the front-end service node and runs through a plurality of back-end service nodes (as shown in fig. 1). The computing architecture of the back-end service node is not limited, and may be a stationary computing unit or a moving robot.
In the distributed internet of things system introduced above, Round-Trip Time (RTT) refers to the total Time required for a user to successfully acquire data content responded by a back-end node from a Time when the user initiates a function request through a front-end service node. In the actual development of the internet of things products, whether a round-trip delay parameter meets the user expectation or not is emphasized in the system design stage, and the consistency between the round-trip delay parameter and the user expectation is one of important technical indexes for measuring the performance of the internet of things products. If a service data call chain is composed of N software modules with computational dependencies, TiThe time delay (including four serial stages of sending time delay, propagation time delay, scheduling time delay and processing time delay) generated by the ith pair of software modules with mutual dependency relationship is respectively used by using a parameter si、ti、di、piRepresenting the time required for each phase), the above equation for calculating the round trip delay of the data call chain can be expressed as
Figure BDA0003354769770000071
Figure BDA0003354769770000072
Reducing Round Trip Time (RTT) is a key technology and a major difficulty in improving the performance of the internet of things system, and two types of commonly used methods for reducing the RTT are mainly used. The first way is to reduce the propagation delay t by using a lightweight, reliable network communication protocoli. The second mode is to improve the scheduling time delay parameter d between software modules with calculation dependency relationship by optimizing the scheduling algorithm of the back-end service nodei. Both ways help to improve the overall round trip delay of the data call chain. Currently, service scheduling algorithms provided by most internet of things platforms can be further divided into two types, namely Asynchronous methods (Asynchronous) and Synchronous methods (Synchronous).
The asynchronous method comprises the following steps: after a calling software module (caller) initiates a service request through the Internet of things cloud, the called software module (caller) does not wait for the response; and directly returning a result after the cloud executes the call.
The synchronization method comprises the following steps: after a calling software module (caller) initiates a service request through the Internet of things cloud, the calling software module (caller) waits for the response of the calling software module (caller); and if the cloud executes the call within the set time (such as 6 seconds), if the response of the called software module is not received, the overtime of the call is fed back to the software module initiating the call.
However, two service scheduling methods provided by the existing internet of things platform have defects, specifically: in a weak network environment, that is, when network communication of one or more service nodes in a data call chain is unstable, the synchronous scheduling method may cause a service request to frequently receive a network call timeout exception, thereby affecting user experience of an internet of things product. In a weak network environment, the asynchronous scheduling method can effectively reduce the probability of abnormal network call of the synchronous method, but when the size of a request/response data packet is relatively large and a back-end node shared by multiple people needs to perform data synchronous display, the existing asynchronous service scheduling method can only perform undifferentiated data response, so that the processing delay parameter of the back-end service node is enlarged, and finally the round-trip delay performance of the whole service data call chain is deteriorated.
The data synchronization method based on the internet of things can be applied to the application environment shown in fig. 2. The plurality of service request nodes 102 are respectively connected to the service response nodes 104, an application object of the service request node 102 may be an intelligent terminal, and the intelligent terminal may be but is not limited to a smart phone, a smart tablet, a notebook computer, an intelligent wearable device, and the like. The application object of the service response node 104 may be a household appliance with the function of internet of things, for example, the household appliance may be, but is not limited to, a television, a washing machine, a refrigerator, a desk lamp, a sweeper, a camera, and the like. At least one service requesting node 102 is operable to perform the steps of: acquiring a user type corresponding to the current service request, and initializing a sharing tag; when the user type is a sharing user, resetting the sharing label as a tracking identifier of the data call chain; based on the current service request, the user tag and the shared tag are bound to obtain a service request data packet, and the service request data packet is transmitted to the service response node 104, so that the service response node 104 feeds back the updated response data packet according to the service request data packet. The service response node 104 may be operable to perform the following steps: acquiring a service request data packet transmitted by a service request node 102; processing the service request data packet to obtain a shared label and a user label, and initializing a shared user counter; when the shared tag is effective, reading the user tag and updating a shared user counter; when the sharing tag of the service request node is invalid or the sharing user counter is updated, the update response mode is full data or incremental data, an updated response data packet is obtained, and the updated response data packet is transmitted to the service request node 102.
In one embodiment, as shown in fig. 3, a data synchronization method based on the internet of things is provided, which is described by taking the method as an example applied to the service request node 102 in fig. 2, and includes the following steps:
step S310, obtain the user type corresponding to the current service request, and initialize the sharing tag.
Wherein, the current service request refers to a service request initiated by a service request node. The user types may include shared users and non-shared users. The service request node can acquire the user type corresponding to the current service request, and the service request node can also initialize the sharing tag according to the current service request, for example, the original information in the sharing tag is cleared, and the default information is set for the sharing tag again.
Illustratively, a plurality of service request nodes (such as intelligent terminals) are respectively in communication connection with the same service response node (such as an intelligent household appliance), and the service request nodes acquire the user type corresponding to the current service request in a manner of accessing the service response node and initialize the sharing tag.
In step S320, when the user type is a sharing user, the sharing tag is reset to the trace identifier of the data call chain.
The data call chain refers to that in the process that a system completes one service call, call information (time, interface, hierarchy and result) among services is dotted into a log, and then all dotted data are connected into a tree chain to generate a call chain. The tracking system analyzes and processes the log information generated in the process, restores the complete calling process of end-to-end execution of the service, and performs statistical analysis according to different dimensions; therefore, abnormal service calling is identified, and the service which is limited to the abnormal service can be quickly analyzed; meanwhile, the system performance bottleneck can be analyzed according to data statistics. The trace identifier, also known as a trace identifier, may be a full link call trace identifier in a chain of data calls.
And the service request node judges and processes the acquired user type, and resets the shared label as the tracking identifier of the data call chain when the user type is a shared user.
And step S330, based on the current service request, binding the user tag and the shared tag to obtain a service request data packet, and transmitting the service request data packet to the service response node, so that the service response node feeds back the updated response data packet according to the service request data packet.
The service request node can obtain a user label according to the obtained user type; the service request node can bind the user tag and the reset shared tag based on the current service request to obtain a service request data packet, transmit the processed service request data packet to the service response node, and then the service response node can process the service request data packet according to the service request data packet, and feed back the updated response data packet according to the processing result, thereby realizing the reduction of the round-trip delay of the distributed internet of things system with calculation dependency relationship, and ensuring that the service request nodes do not have asynchronous data display caused by the inconsistent round-trip delay among the service nodes.
Specifically, when a plurality of service request nodes share the same service response node, at least one service request node can acquire the user type corresponding to the current service request and initialize the sharing tag; when the user type is a sharing user, resetting the sharing label as a tracking identifier of the data call chain; based on the current service request, the user tag and the shared tag are bound to obtain a service request data packet, and the service request data packet is transmitted to the service response node, so that the service response node feeds back the updated response data packet according to the service request data packet, and synchronous data display can be realized when one device is shared by a plurality of users.
In the above embodiment, when the distributed internet of things system is in a weak network environment, that is, the network signal stability of a certain computing service node fluctuates greatly, and one device is shared by multiple users for use, the problem that multiple front-end nodes keep real-time online for high-frequency and large-scale data communication on the premise of not increasing the processing delay of a back-end node can be solved, and the problem that different intelligent terminals are not synchronous in data display due to inconsistent round-trip delay among the nodes is avoided, so that the round-trip delay of the distributed internet of things system with a computing dependency relationship is reduced.
It should be noted that, when calculating the round-trip delay index of the data call chain of the internet of things system, the service request node and the service response node are a pair of communication nodes in which a calculation dependency relationship exists.
In one embodiment, as shown in fig. 4, a data synchronization method based on the internet of things is provided, which is described by taking the method as an example applied to the service request node 102 in fig. 2, and includes the following steps:
step S410, applying for the stage of occupying the sending time delay in the round-trip time delay, and obtaining the user type corresponding to the current service request by accessing the service response node in the data call chain.
The round trip delay may include a transmit delay phase and a call delay phase. Before obtaining the user type, the service request node needs to apply for a sending delay stage occupying a round trip delay, and then the service request node can access a back-end node providing a public service in the data call chain, namely, a service response node in the data call chain, and further obtain the user type corresponding to the current service request, so that whether the user type belongs to a shared user or not is judged in subsequent steps, namely, whether the service request type represented by the current node belongs to a shared data request or not is judged, and the obtained user type is used as a type mark for judging that the current service request node accesses the back-end service node.
Step S420, initializing the sharing tag as a null data pointer.
After the service request node obtains the user type, initializing the shared label, and assigning the shared label as a null data pointer.
In step S430, when the user type is a sharing user, the sharing tag is reset to the trace identifier of the data call chain.
Step S440, based on the current service request, binding the user tag and the shared tag to obtain a service request data packet, and transmitting the service request data packet to the service response node, so that the service response node feeds back the updated response data packet according to the service request data packet.
For the detailed description of the step S430 and the step S440, reference is made to the description of the above embodiments, which is not repeated herein.
In the above embodiment, when the distributed internet of things system is in a weak network environment, that is, the network signal stability of a certain computing service node fluctuates greatly, and one device is shared by multiple users for use, the problem that multiple front-end nodes keep real-time online for high-frequency and large-scale data communication on the premise of not increasing the processing delay of a back-end node can be solved, and the problem that different intelligent terminals are not synchronous in data display due to inconsistent round-trip delay among the nodes is avoided, so that the round-trip delay of the distributed internet of things system with a computing dependency relationship is reduced.
In one embodiment, as shown in fig. 5, a data synchronization method based on the internet of things is provided, which is described by taking the method as an example applied to the service request node 102 in fig. 2, and includes the following steps:
step S510, applying for a transmission delay stage occupying a round-trip delay, and obtaining a user type corresponding to the current service request by accessing a service response node in the data call chain.
Step S520, initialize the sharing tag as a null data pointer.
In step S530, when the user type is a non-sharing user, the sharing tag is reserved as a null data pointer.
In step S540, when the user type is the sharing user, the sharing tag is reset to the trace identifier of the data call chain.
And step S550, based on the current service request, binding the user tag and the shared tag to obtain a service request data packet, and transmitting the service request data packet to the service response node, so that the service response node feeds back the updated response data packet according to the service request data packet.
Step S560, applying for ending the transmission delay phase in the round-trip delay.
Specifically, the service request node applies for a transmission delay stage occupying round-trip delay, accesses a back-end node providing public service in a data call chain, and acquires and judges whether the service request type represented by the current node belongs to a user type of a shared data request. The service request node takes the acquired user type as a type mark for judging that the current service request node accesses the back-end service node, and initializes the sharing label as a null data pointer. When the service request node judges that the type mark of the current service request node accessing the back-end service node is a sharing user, resetting the sharing label as a tracking identifier (with global uniqueness) of the data call chain; otherwise, the shared tag is reserved as a null data pointer. The service request node binds the shared label and the user label (with global uniqueness) in the service request data packet, applies for ending the sending delay stage in the round-trip delay, and further can realize synchronous data display when one device is shared by a plurality of users. When the distributed internet of things system is in a weak network environment, namely the stability of network signals of a certain computing service node fluctuates greatly, and one device is shared by a plurality of users for use, the problem that a plurality of front end nodes keep real-time online for high-frequency and large-scale data communication on the premise of not increasing the processing time delay of a rear end node can be solved, the problem that data display of different intelligent terminals is asynchronous due to inconsistent round-trip time delay among the nodes is avoided, and therefore the round-trip time delay of the distributed internet of things system with a computing dependency relationship is reduced.
In one embodiment, as shown in fig. 6, a data synchronization method based on the internet of things is provided, which is described by taking the method as an example for being applied to the service response node 104 in fig. 2, and includes the following steps:
step S610, a service request data packet transmitted by the service request node is obtained.
The service request data packet may include a sharing tag and a user tag, and further includes a service request instruction for requesting service data. The service response node can obtain the service request data packet transmitted by the service request node. It should be noted that, the service response node may actively obtain the service request data packet from the service request node; in other embodiments, the service request node may also actively send a service request packet to the service response node, and the service response node receives the service request packet.
Step S620, process the service request packet to obtain a sharing tag and a user tag, and initialize a sharing user counter.
The service response node can analyze and process the service request data packet, and further can obtain a corresponding shared label and a user label; the service response node may further perform an initialization process on the initialized shared user counter according to the service request data packet, for example, the shared user counter is initialized and assigned to 0.
Step S630, when the shared tag is valid, reads the user tag, and updates the shared user counter.
The service response node can judge the effectiveness of the processed shared label, reads the user label when the shared label is effective according to the processing result, and updates the shared user counter according to the user label.
Step S640, when the sharing tag of the service request node is invalid or the sharing user counter is updated, the response mode is updated to full data or incremental data, an updated response data packet is obtained, and the updated response data packet is transmitted to the service request node.
The service response node may update the response mode to be full data or incremental data when detecting that the shared tag of the service request node is invalid, obtain an updated response packet, and transmit the updated response packet to the service request node. The service response node can also update the response mode into full data or incremental data when the shared user counter is updated, obtain an updated response data packet, and transmit the updated response data packet to the service request node.
In the above embodiment, based on the distributed data call chain principle, the overall round-trip delay of the internet of things system is reduced by optimizing the service scheduling algorithm of the service response node (i.e., the backend node). The distributed Internet of things system is in a weak network environment, namely, the stability of network signals of a certain computing service node fluctuates greatly, and when one device is shared by a plurality of users, the problem that a plurality of service request nodes (namely front end nodes) keep online high-frequency and large-scale data communication in real time on the premise of not increasing the processing time delay of a rear end node can be solved, the problem that different intelligent terminals have asynchronous data display due to inconsistent round-trip time delay among the nodes is solved, and therefore the round-trip time delay of the distributed Internet of things system with computing dependency is reduced.
In one example, in step S630, the step of updating the shared user counter includes:
updating the shared user counter in a set time period based on the relation table; the relation table comprises service names, sharing labels, user labels and field service request recent time.
In particular, the relationship table may be used to record login and logout information of the service function and the sharing request. The main fields maintained by the relationship table include service name (FL), Shared Label (SL), User Label (UL), service request last time (FRLT). The field service name (FL) is a function identifier defined by the object model represented by S2, and the field share tag (SL) and the field user tag (UL) are the same as those described in S1. When the field service request latest time (FRLT) is the time when the service request node S1 reaches the service response backend node S2, it is determined by S2 whether to update the time of the transmission delay stage occupying the round trip delay for the application of S2 according to the legitimacy of the field shared tag and the field user tag.
Illustratively, the internet of things system product design updates the value of the shared user counter within a set time period (e.g., 3 seconds) according to the actual service requirements of the application scenario.
In one embodiment, as shown in fig. 7, the step of updating the shared user counter in a set time period based on the relationship table includes:
step S710, if the sharing tag is a non-null data pointer and the user tag does not exist in the relationship table, creating a sharing request record.
Step S720, if the sharing tag is a non-null data pointer and the user tag exists in the relation table, updating the sharing request record; wherein, the update sharing request record is as follows: and updating the latest time of the field service request corresponding to the user tag into the time of the transmission delay stage in the round-trip delay occupied by the application.
In step S730, if the latest time of the field service request in the relationship table exceeds the set time period, the sharing request record is deleted.
Specifically, the relationship table has three basic operations, namely creating a sharing request record, updating the sharing request record and deleting the sharing request record. When the service request node reaches the service response node, the service response node analyzes the service request data packet corresponding to the service request to obtain the bound shared label and the user label. If the shared tag is a non-null data pointer and the user tag does not exist in the relationship table, a record is created. If the shared label is a non-null data pointer and the user label exists in the relationship table, the service request latest time (FRLT) of the field corresponding to the user label is updated, and the time occupying the transmission delay stage in the round trip delay is applied for S2. If the field service request latest time (FRLT) of a record in the relation table is expired and exceeds the time period (such as 3 seconds) set by the design of the system product of the Internet of things, the record is deleted.
Further, the data synchronization method based on the internet of things further comprises the following steps:
when an operation of creating a sharing request record is performed, the value of the sharing user counter is increased by a first set value, and the response mode is updated to full data.
When an operation of deleting the sharing request record is performed, the value of the sharing user counter is decreased by a first set value, and the update response mode is incremental data.
When the operation of updating the sharing request record is performed, the value of the sharing user counter remains unchanged, and the update response mode is incremental data.
Specifically, in the process of completing three basic operations of the relationship table, the important operations that the service response node needs to complete in the stage of applying for occupying the transmission delay in the round-trip delay include: when the record creating operation is executed, the value of the local maintenance shared user counter is increased by 1, and the response mode of the local maintenance of the update service response node is full data. When the record deleting operation is executed, the value of the local maintenance shared user counter is reduced by 1, and the response mode of the local maintenance of the update service response node is incremental data. When the record updating operation is executed, the value of the local maintenance shared user counter is kept unchanged, and the response mode of the update service response node in the local maintenance is incremental data.
In an embodiment, as shown in fig. 8, when the shared tag of the service request node is invalid or the shared user counter is updated, the step of updating the response mode to be full data or incremental data to obtain an updated response packet includes:
step S810, applying for a scheduling delay stage occupying the round trip delay, and reading a response mode.
Step S820, if the response mode is full data, calling a rear terminal service node to acquire the full data; and if the response mode is incremental data, calling the rear terminal service node to acquire the incremental data.
Step S830, the full data or the incremental data is updated to the response data packet, so as to obtain an updated response data packet.
Step 840, applying for finishing the scheduling delay stage in the round-trip delay.
Specifically, after the service response node finishes applying for the transmission delay stage in the round-trip delay, the service response node also detects whether a time period (for example, 3 seconds) set by the product design of the internet of things system expires. If yes, applying for occupying a scheduling delay stage in the round-trip delay, and reading a local maintenance response mode set in the sending delay; and if not, exiting. And the service response node calls the rear terminal service node to acquire the full data if the response mode is the full data according to the read response mode. And if the response mode is incremental data, calling the rear terminal service node to acquire the incremental data. Updates to the response packet are made using data (either full or incremental) obtained from the back-end service node. And applying for finishing a scheduling delay stage in the round trip delay.
In the above embodiment, when multiple service request nodes share the same service response node and acquire data for synchronous display, the service response node only needs to call the back-end service node once to acquire the data in the scheduling delay stage, thereby overcoming the defect that service requests and service responses must be in one-to-one correspondence in the prior art of the internet of things. The round-trip delay of a single data call chain is reduced, and the time consumed by a back-end response node in the delay processing stage is also reduced; the service request has strong fault-tolerant capability under the weak network environment. The service node can automatically sense whether a certain service request is terminated because of network failure or not and whether the service request is on-line again because the network is recovered to be normal or not by utilizing the locally maintained shared user counter. When a certain service request is terminated, the back-end response node continues to report the incremental data; on the contrary, when a certain service request is online again, the back-end response node reports the full data again, and high-precision synchronization is carried out on all the request nodes.
In an example, as shown in fig. 9, an application scenario in which a plurality of intelligent terminals (e.g., mobile phones) interact with a sweeping robot is taken as an example for description.
In a sweeping robot scene, real-time positioning and mapping (SLAM) is a software function with high user operation frequency and relatively large calculation scale. In order to ensure better user experience, when a user mobile phone is online and the SLAM man-machine interaction function is started, the intelligent terminal can synchronize map data at a higher frequency. With 3 seconds as the request cycle for map data, the sweeping robot needs to respond 20 times in one minute. Considering that the floor sweeping robot has extremely limited computing resources, the map building quality of the map is sacrificed and even the motion control of the robot is affected by frequently responding to the data request of the front end node.
In order to improve the utilization value of products, the sharing function of the sweeping robot becomes the basic function of the sweeping robot, namely, one sweeping robot can be shared by a plurality of family members by using the smart phone terminal. When the floor sweeping robot is used by a plurality of family members to simultaneously use the smart phone terminal to operate the SLAM function on line, service scheduling methods provided by the existing distributed Internet of things platform cannot achieve the technical index of Round Trip Time (RTT) meeting the functional requirements of products. The reason is that a plurality of front-end nodes repeatedly and asynchronously request map data, and a back-end device node is easy to cause computation overload and communication blockage caused by high-frequency data transmission of the distributed internet of things in the weak network environment.
As shown in fig. 9, the example system of the internet of things is composed of three pairs of software modules with calculation dependency relationship, which are respectively S1: APP (User1) and S2: Robot; s1 APP (User2), S2 Robot; s1 APP (User3), S2 Robot. Wherein S1 is used to indicate service request node and S2 is used to indicate service response node. The network of the two nodes S1 APP (User2) and S2 Robot is unstable, and the data communication of the Internet of things is in a weak network state. Although the three front-end nodes adopt the asynchronous scheduling method, the response frequency of the back-end machine node is always kept constant and does not change along with the increase of the number of the front-end request nodes within a set time period (such as 3 seconds). Further, the back-end node may automatically sense the network state of the front-end node. After the network of the front end node is interrupted, the data calling chain of the Internet of things system can work normally, and the problem of communication blockage existing in the synchronous calling method can not occur. When the network interruption occurs at S1, the data call chain is not affected at all. Only if the network recovers to normal at S1, S2 needs to adjust the data response policy once. And S2, the Robot node can utilize the locally maintained shared user counter to adaptively adjust the data type of the response. When the value of the shared user counter is increased, the response data type is full map data; otherwise, incremental map data.
In the above example, when the distributed internet of things system is in a weak network environment, that is, the stability of the network signal of a certain computing service node fluctuates greatly, and one device is shared by multiple users for use, the problem that multiple front-end nodes keep real-time online for high-frequency and large-scale data communication on the premise of not increasing the processing delay of a back-end node is solved, the problem that different intelligent terminals are not synchronous in data display due to inconsistent round-trip delay among the nodes is avoided, and the round-trip delay of the distributed internet of things system with a computing dependency relationship is reduced.
It should be understood that although the various steps in the flow charts of fig. 3-8 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 3-8 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 10, there is further provided an internet of things-based data synchronization system, including: a service request node 10 and a service response node 20.
The number of the service request nodes 10 may be multiple, the multiple service request nodes 10 are respectively connected to the service response nodes 20, an application object of the service request node 10 may be an intelligent terminal, and the intelligent terminal may be but is not limited to a smart phone, a smart tablet, a notebook computer, an intelligent wearable device, and the like. The application object of the service response node 20 may be a household appliance with the internet of things function, for example, the household appliance may be, but is not limited to, a television, a washing machine, a refrigerator, a desk lamp, a sweeper, a camera, and the like.
For example, the network communication protocol used between the service request node 10 and the service response node 20 is not limited in this application, and preferably, in the actual engineering development of the internet of things system, if the data communication scale between the service request node 10 and the service response node 20 is large, or it can be predicted in advance that the network communication environment between the service request node 10 and the service response node 20 is weak, the network communication between the service request node 10 and the service response node 20 uses an mqtt (message Queuing telemetery transport) protocol which is light and has a certain fault tolerance mechanism for an unstable network itself. The MQTT protocol is realized by adopting a lightweight data communication protocol based on a publish/subscribe mode. That is, when a plurality of user accounts share the same device, the internet of things platform subscribes the same theme message for all the user accounts; when the equipment sends certain data to the platform, the platform actively releases the corresponding data through the theme, one-time data synchronization of all users is automatically completed, and code compensation is not required through additional programming.
The service request node 10 is configured to execute the data synchronization method based on the internet of things. For example, the service requesting node 10 may be adapted to perform the following steps:
acquiring a user type corresponding to the current service request, and initializing a sharing tag; when the user type is a sharing user, resetting the sharing label as a tracking identifier of the data call chain; based on the current service request, the user tag and the shared tag are bound to obtain a service request data packet, and the service request data packet is transmitted to the service response node 20, so that the service response node 20 feeds back the updated response data packet according to the service request data packet.
The service response node 20 is configured to execute the data synchronization method based on the internet of things. For example, the service response node 20 may be adapted to perform the following steps:
acquiring a service request data packet transmitted by a service request node 10; processing the service request data packet to obtain a shared label and a user label, and initializing a shared user counter; when the shared tag is effective, reading the user tag and updating a shared user counter; when the sharing tag of the service request node is invalid or the sharing user counter is updated, the update response mode is full data or incremental data, an updated response data packet is obtained, and the updated response data packet is transmitted to the service request node 10.
When a plurality of service request nodes share the same back-end response node and acquire data for synchronous display, the back-end response node only needs to call the back-end service node once to acquire the data in the scheduling delay stage, and the defect that service requests and service responses need to be in one-to-one correspondence in the prior art of the internet of things is overcome. Therefore, the new scheme not only reduces the round trip delay of a single data call chain, but also reduces the time consumed by the back-end response node in the processing delay stage. The method has strong fault tolerance capability to the service request in the weak network environment. The back-end response node can automatically sense whether a certain service request is terminated because of network failure or not and whether the service request is on-line again because the network is recovered to be normal or not by using the locally maintained shared user counter. When a certain service request is terminated, the back-end response node continues to report the incremental data; on the contrary, when a certain service request is online again, the back-end response node reports the full data again, and high-precision synchronization is carried out on all the request nodes.
In the embodiment, in the internet of things system, when one background device node is shared by a plurality of front end nodes, based on the distributed data call chain principle, the overall round trip delay of the internet of things system is reduced by optimizing the data service scheduling algorithm of the rear end node, and the front end nodes do not have asynchronous data display caused by inconsistent round trip delay among the service nodes. The back-end node automatically senses the interruption and recovery of the network and adaptively adjusts the data type of the service response. The computation size and communication pressure of the back-end nodes remain substantially constant regardless of the number of front-end data requesting nodes.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A data synchronization method based on the Internet of things is characterized by comprising the following steps:
acquiring a user type corresponding to the current service request, and initializing a sharing tag;
resetting the sharing tag as a tracking identifier of a data call chain when the user type is a sharing user;
and based on the current service request, binding the user tag and the shared tag to obtain a service request data packet, and transmitting the service request data packet to a service response node, so that the service response node feeds back an updated response data packet according to the service request data packet.
2. The data synchronization method based on the internet of things of claim 1, wherein the step of obtaining the user type corresponding to the current node service request and initializing the shared tag comprises:
applying for a sending delay stage in the round-trip delay, and acquiring the user type corresponding to the current service request by accessing the service response node in the data call chain;
and initializing the shared label as a null data pointer.
3. The internet of things-based data synchronization method of claim 2, wherein the step of initializing a shared tag is followed by:
and when the user type is a non-sharing user, the sharing label is reserved as the null data pointer.
4. The data synchronization method based on the internet of things as claimed in claim 3, wherein the step of binding the user tag and the shared tag based on the current service request to obtain the service request data packet comprises:
and occupying a sending delay stage in the round-trip delay after the application is finished.
5. A data synchronization method based on the Internet of things is characterized by comprising the following steps:
acquiring a service request data packet transmitted by a service request node;
processing the service request data packet to obtain a shared label and a user label, and initializing a shared user counter;
reading the user tag and updating the shared user counter when the shared tag is effective;
and when the sharing label of the service request node is invalid or the sharing user counter is updated, updating the response mode into full data or incremental data to obtain an updated response data packet, and transmitting the updated response data packet to the service request node.
6. The Internet of things-based data synchronization method of claim 5, wherein the step of updating the shared user counter comprises:
updating the shared user counter within a set time period based on a relationship table; the relation table comprises service names, sharing labels, user labels and field service request recent time.
7. The Internet of things-based data synchronization method according to claim 6, wherein the step of updating the shared user counter within a set time period based on the relationship table comprises:
if the shared label is a non-null data pointer and the user label does not exist in the relation table, creating a shared request record;
if the shared label is the non-null data pointer and the user label exists in the relation table, updating the shared request record; wherein updating the sharing request record is: updating the latest time of the field service request corresponding to the user tag into the time of a transmission delay stage in the round-trip delay;
and if the latest time of the field service request in the relation table exceeds the set time period, deleting the sharing request record.
8. The data synchronization method based on the internet of things of claim 7, further comprising the steps of:
when the operation of creating the sharing request record is executed, the value of the sharing user counter is increased by a first set value, and the response mode is updated to be full data;
when the operation of deleting the sharing request record is executed, the value of the sharing user counter is reduced by the first set value, and the response mode is updated to be incremental data;
when an operation of updating the sharing request record is performed, the value of the sharing user counter remains unchanged, and the response pattern is updated to incremental data.
9. The data synchronization method based on the internet of things of claim 6, wherein the step of updating the response mode to be full data or incremental data when the shared tag of the service request node is invalid or the shared user counter is updated to obtain an updated response data packet comprises:
applying for a scheduling delay stage occupying the round trip delay, and reading the response mode;
if the response mode is full data, calling a rear terminal service node to acquire the full data; if the response mode is incremental data, calling the rear terminal service node to acquire the incremental data;
updating the full data or the incremental data to the response data packet to obtain an updated response data packet;
and occupying a scheduling delay stage in the round-trip delay after application is finished.
10. A data synchronization system based on the Internet of things is characterized by comprising: a service request node and a service response node;
the service request node is used for executing the data synchronization method based on the Internet of things of claims 1 to 4;
the service response node is configured to execute the data synchronization method based on the internet of things according to claims 5 to 9.
CN202111348247.9A 2021-11-15 2021-11-15 Data synchronization method and system based on Internet of things Pending CN114143299A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111348247.9A CN114143299A (en) 2021-11-15 2021-11-15 Data synchronization method and system based on Internet of things

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111348247.9A CN114143299A (en) 2021-11-15 2021-11-15 Data synchronization method and system based on Internet of things

Publications (1)

Publication Number Publication Date
CN114143299A true CN114143299A (en) 2022-03-04

Family

ID=80393260

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111348247.9A Pending CN114143299A (en) 2021-11-15 2021-11-15 Data synchronization method and system based on Internet of things

Country Status (1)

Country Link
CN (1) CN114143299A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117394943A (en) * 2023-12-11 2024-01-12 深圳市华腾智能科技有限公司 Operation method and system for distributed control intelligent switch panel
CN117714088A (en) * 2023-05-11 2024-03-15 荣耀终端有限公司 Data reporting method and electronic equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117714088A (en) * 2023-05-11 2024-03-15 荣耀终端有限公司 Data reporting method and electronic equipment
CN117394943A (en) * 2023-12-11 2024-01-12 深圳市华腾智能科技有限公司 Operation method and system for distributed control intelligent switch panel
CN117394943B (en) * 2023-12-11 2024-02-20 深圳市华腾智能科技有限公司 Operation method and system for distributed control intelligent switch panel

Similar Documents

Publication Publication Date Title
CN114143299A (en) Data synchronization method and system based on Internet of things
US6321250B1 (en) Data communication system and method for transporting objects over a permanent connections
WO2021151312A1 (en) Method for determining inter-service dependency, and related apparatus
CN106713391B (en) Session information sharing method and sharing system
WO2018064939A1 (en) Method for disaster recovery of audio and video communication connection, apparatus and system
CN101917394B (en) Middleware system for sharing data in mobile phone equipment and working method
CN107682460B (en) Distributed storage cluster data communication method and system
CN112995269B (en) Data processing method, computer device and readable storage medium
CN102077543A (en) Method and apparatus for resource sharing between user devices in computer network
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN115499447A (en) Cluster master node confirmation method and device, electronic equipment and storage medium
WO2023035374A1 (en) Highly reliable video conferencing system, control method therefor, and storage medium
CN114268631A (en) Low-delay network system, communication connection method thereof and readable storage medium
WO2024103943A1 (en) Service processing method and apparatus, storage medium, and device
CN106375324B (en) Network communication system and method based on TCP/IP communication protocol
CN110099136A (en) Network Access Method, client, network interaction method and scheduling, network system
CN114884975B (en) Service message processing method and device, storage medium and electronic device
CN114143569B (en) Webpage recording and live broadcasting method and system
CN113242313B (en) Data synchronization method, system, device, server and storage medium
CN112751907B (en) Information processing method, information processing apparatus, storage medium, and electronic apparatus
CN115658290A (en) Message processing method, device, equipment and storage medium
CN104462235A (en) Internet of Things general event service mechanism based on Restful Web Service
JP6374362B2 (en) Call processing apparatus, session recovery method, and call processing server program
JP2010527475A (en) Information appliance data storage system and data processing method
CN114846901B (en) Communication method, device, equipment 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