Data transmission method and device, computer equipment, medium and product
By adopting a dual cache mechanism in distributed cloud, using message queues and databases to cache device status data, the problem of low data transmission reliability in distributed cloud is solved, and the reliability and adaptability of data transmission is improved.
Patent Information
- Application Number
- CN202310820880.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-05
- Publication Date
- 2025-01-07
AI Technical Summary
Data transmission in distributed clouds is low reliability, especially when the network is blocked or congested, it is easy to cause data loss or lag.
The dual cache mechanism is adopted, first store the device status data in the message queue, and then store it in the database when the threshold is reached to ensure reliable transmission of data.
It effectively avoids loss during data transmission, improves the reliability of data transmission and the system's adaptability to weak network environments.
Smart Images

Figure CN119276806A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data transmission method, a data transmission device, a computer equipment, a computer-readable storage medium, and a computer program product. Background Art
[0002] Data transmission refers to the process of transmitting data between a data source and a data sink through one or more links in accordance with appropriate procedures. Data transmission in distributed clouds mainly relies on VPN (Virtual Private Network) dedicated lines. Distributed clouds deploy resources in customer rooms under the cloud, and then connect the cloud management server and customer rooms under the cloud through VPN dedicated lines. However, the bandwidth of VPN dedicated lines is often limited, and VPN dedicated lines have to span from cloud to cloud, and the transmission distance is also relatively long. Therefore, weak network conditions such as network disconnection or network congestion often occur, which may cause problems such as data transmission delays or losses.
[0003] Therefore, how to improve the reliability of data transmission in distributed clouds has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The embodiments of the present application provide a data transmission method, apparatus, computer equipment, medium, and product, which can improve the reliability of data transmission.
[0005] On the one hand, an embodiment of the present application discloses a data transmission method, which is applied to data transmission between a local computer room and a management server, wherein the local computer room and the management server are connected via a target communication line, and the method comprises:
[0006] If the network state of the target communication line is a first network state, storing the device state data of the local computer room in a message queue, the first network state is used to indicate that the network transmission rate of the target communication line is less than a first transmission rate threshold;
[0007] If the amount of device status data included in the message queue is greater than the data amount threshold, storing the device status data at the head of the message queue in the database;
[0008] The device status data in the database is sent to the management server.
[0009] On one hand, an embodiment of the present application discloses a data transmission device, which is applied to data transmission between a local computer room and a management server, wherein the local computer room and the management server are connected via a target communication line, and the device includes:
[0010] a processing unit, configured to store the device status data of the local computer room in a message queue if the network status of the target communication line is a first network status, wherein the first network status is used to indicate that the network transmission rate of the target communication line is less than a first transmission rate threshold;
[0011] The processing unit is further configured to store the device status data at the head of the message queue in the database if the amount of device status data included in the message queue is greater than a data amount threshold;
[0012] A sending unit is used to send the device status data in the database to the management server.
[0013] On the one hand, an embodiment of the present application discloses a computer device, which includes a processor suitable for implementing one or more computer programs; and a computer storage medium, wherein the computer storage medium stores one or more computer programs, and the one or more computer programs are suitable for being loaded by the processor and executed with the above-mentioned data transmission method.
[0014] One aspect of the present application discloses a computer-readable storage medium, which stores one or more computer programs. The one or more computer programs are suitable for being loaded by a processor and executing the above-mentioned data transmission method.
[0015] In one aspect, the present application discloses a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned data transmission method.
[0016] In the embodiment of the present application, when the local computer room and the management server transmit data through the target communication line, if the network state of the target communication line is the first network state, and the first grid state is used to indicate that the network transmission rate of the target communication line is less than the first transmission rate threshold, the device status data of the local computer room is stored in the message queue to achieve the first cache of the device status data for delayed transmission; as the device status data is continuously sent, if the number of device status data included in the message queue is greater than the data quantity threshold, the device status data at the head of the message queue is stored in the database, which is equivalent to caching the device status data for the second time to ensure that the data is not lost. Then the device status data is sent to the management server through the database. In this process, the device status data is first cached once through the message queue. As the device status data is continuously sent, if the device status data in the message queue reaches the threshold, the device status data that has not been successfully sent is cached for the second time. The device status data is cached by the message queue and the database under the double cache mechanism, which can ensure the reliability of data transmission and effectively avoid the loss of data during data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a schematic diagram of a network architecture of a data transmission system disclosed in an embodiment of the present application;
[0019] Figure 2 It is a flowchart of a data transmission method disclosed in an embodiment of the present application;
[0020] Figure 3 It is a flowchart of another data transmission method disclosed in an embodiment of the present application;
[0021] Figure 4 This is a transmission process of device status data under a double-layer cache mechanism disclosed in an embodiment of the present application;
[0022] Figure 5 It is a flowchart of another data transmission method disclosed in an embodiment of the present application;
[0023] Figure 6 It is a structural schematic diagram of a data transmission device disclosed in an embodiment of the present application;
[0024] Figure 7It is a structural schematic diagram of a computer device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] In order to more clearly understand the technical solution provided by the embodiments of the present application, some key terms involved in the embodiments of the present application are first introduced here:
[0027] 1. Message Queue
[0028] A message queue (MQ) is a queue used to store messages. You can put messages into the queue or get messages from the message queue. In many cases, the message queue is not a permanent storage and can be used as a temporary storage. The message queue can be regarded as a producer-consumer model, in which the producer is responsible for producing messages into MQ and the consumer is responsible for getting messages from MQ. The producer and the consumer are decoupled, and the producer may be one program and the consumer may be another program. In an embodiment of the present application, caching the device status data in the message queue can play a role in delayed sending.
[0029] 2. Cloud Technology
[0030] Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support.
[0031] Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, allowing various application systems to obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". From the user's perspective, the resources in the "cloud" are infinitely scalable and can be obtained at any time, used on demand, expanded at any time, and paid for by use. As a provider of basic cloud computing capabilities, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices. According to the logical function division, the PaaS (Platform as a Service) layer can be deployed on the IaaS (Infrastructure as a Service) layer, and the SaaS (Software as a Service) layer can be deployed on the PaaS layer. SaaS can also be deployed directly on IaaS. PaaS is a platform for software operation, such as databases, web containers, etc. SaaS is a variety of business software, such as web portals, SMS mass senders, etc. Generally speaking, SaaS and PaaS are upper layers relative to IaaS.
[0032] Database, in short, can be regarded as an electronic filing cabinet - a place to store electronic files, where users can add, query, update, delete, and other operations on the data in the files. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application. Database management system (DBMS) is a computer software system designed for managing databases, generally with basic functions such as storage, interception, security, and backup. Database management systems can be classified according to the database model it supports, such as relational, XML (Extensible Markup Language); or according to the type of computer supported, such as server clusters, mobile phones; or according to the query language used, such as SQL (Structured Query Language), XQuery; or according to the performance impulse focus, such as maximum scale, maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMS can cross categories, for example, supporting multiple query languages at the same time.
[0033] A private cloud is a cloud infrastructure and software and hardware resources created within a firewall so that departments within an organization or enterprise can share resources within the data center. In addition to hardware resources, creating a private cloud generally also requires cloud equipment (IaaS, Infrastructure as a Service) software. Private cloud computing also includes three levels: cloud hardware, cloud platform, and cloud services. The difference is that cloud hardware is the user's own personal computer or server, not the data center of the cloud computing vendor. The purpose of cloud computing vendors building data centers is to provide public cloud services to millions of users, so they need to have tens of millions of servers. Private cloud computing only serves friends and family for individuals, and only serves employees, customers, and suppliers of the enterprise for enterprises. Therefore, an individual or enterprise's own personal computer or server is sufficient to provide cloud services.
[0034] Public Cloud usually refers to a cloud provided by a third-party provider for users to use. Public Cloud is generally available through the Internet and may be free or low-cost. The core attribute of Public Cloud is shared resource services. There are many instances of this cloud, which can provide services throughout the open public network today.
[0035] Hybrid Cloud combines public cloud and private cloud, and is the main model and development direction of cloud computing in recent years. Private cloud is mainly for enterprise users. For security reasons, enterprises are more willing to store data in private cloud, but at the same time hope to obtain computing resources of public cloud. In this case, hybrid cloud is increasingly adopted, which mixes and matches public cloud and private cloud to obtain the best effect. This personalized solution achieves the purpose of saving money and security.
[0036] Distributed cloud refers to extending public cloud services to different physical locations, while the ownership, operation, governance, updates and development of the services are still the responsibility of the original public cloud provider. The characteristic of distributed cloud is that public cloud resources are delivered near the source, while the operation and maintenance is still the responsibility of the cloud service provider, allowing customers to enjoy the same services as the public cloud locally.
[0037] 3. VPN dedicated line
[0038] VPN is a communication method commonly used to connect private networks of medium and large enterprises or groups. It uses tunneling protocols to achieve confidentiality, sender authentication, message accuracy and other private message security effects. This technology can use insecure networks (such as the Internet) to send reliable and secure messages. Among them, the distributed cloud is achieved by connecting the cloud management server and the cloud customer room through VPN dedicated lines.
[0039] 4. Blockchain
[0040] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block.
[0041] The embodiment of the present application provides a data transmission scheme for realizing data transmission between a local computer room and a management database, wherein the local computer room is connected to the management server through a target communication line, and the scheme includes: ① detecting the network status of the target communication line at the current moment, if the network status of the target communication line is the first network status, then storing the device status data of the local computer room in the message queue, wherein the first grid status is used to indicate that the network transmission rate of the target communication line is less than the first transmission rate threshold, that is, when the network status is not good, the device status data to be transmitted is cached and then sent, so as to ensure that the data can be sent with a delay and not lost. ② In the process of continuous transmission of device status data, if the number of device status data included in the message queue is greater than the data quantity threshold, then the device status data at the head of the message queue is stored in the database, that is, when there are too many device status data in the message queue, in order to ensure that the data is not lost, the data can be cached twice. ③ Send the device status data in the database to the management server. After being stored in the database, the device status data is sent to the management server again to ensure the probability of successful data transmission. In this process, the device status data is first cached through the message queue. As the device status data is continuously sent, if the device status data in the message queue reaches the threshold, the device status data is cached for the second time through the database. Therefore, the device is cached by the message queue and database under the double cache mechanism, which can ensure the reliability of data transmission and effectively avoid data loss during data transmission.
[0042] In one possible implementation, the data transmission method provided in the present application can be implemented based on cloud technology. Specifically, it may involve one or more of cloud storage, cloud database, and big data in cloud technology. For example, the data involved in the data transmission method is stored in a cloud database (such as device status data). It also involves cloud applications, including private clouds, public clouds, and distributed clouds. For example, the cloud management server and the customer room under the cloud in the distributed cloud are connected through a VPN dedicated line, thereby realizing the transmission of device status data.
[0043] In a possible implementation, the data transmission method provided by the present application can also be implemented based on blockchain technology. For example, the data required / generated to execute the data transmission method can be stored in the form of blocks on the blockchain. For example, the device status data is first stored in the blockchain and then obtained from the blockchain to ensure the risk of data tampering. In addition, the data transmission device that executes the data transmission method can be a node device in the blockchain network.
[0044] See also Figure 1 , is a schematic diagram of the architecture of a data transmission system disclosed in an embodiment of the present application. The data transmission system 100 may include at least one computer room device 101, a first server 102 and a second server 103. The computer room device 101 and the first server 102 may be deployed in a local computer room. The first server 102 and the computer room device 101 may be separate devices, and the first server 102 may also be one of the computer room devices in the local computer room. In an embodiment of the present application, the computer room device 101 of the local computer room may include multiple units. Specifically, the computer room device 101 may include a host machine and a virtual machine generated on the host machine. The first server 102 is mainly used to execute the data transmission method. If the first server 102 is a computer room device, the data transmission method is executed by the computer room device. In a distributed cloud, an agent module is deployed on the first server 102. The agent module is mainly responsible for sending and receiving device status data, and is responsible for determining the network status of the target communication line. The first server 102 is also connected to a database 104, which is mainly responsible for data storage, and is responsible for storing device status data overflowed from the message queue. The second server 103 is mainly responsible for receiving device status data, and may specifically refer to a management server, such as a video management server, a game management server, and a shopping management server.
[0045] In one embodiment, the computer room equipment 101 deployed in the local computer room includes but is not limited to: personal computers, smart cameras, routing devices, virtual reality devices (such as AR (Augmented Reality, augmented reality) devices) and other devices, and this application does not limit this. The first server 102 and the second server 103 can be independent physical servers, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network, content distribution network), and big data and artificial intelligence platforms, and this embodiment of the application does not limit this. The computer room equipment 101 and the first server 102, and the first server 102 and the second server 103 can establish a direct communication connection by wired communication, or an indirect communication connection can be established by wireless communication, and this embodiment of the application does not limit this.
[0046] In the embodiment of the present application, in combination with the data transmission system, the data transmission method realizes the data transmission between the computer room equipment 101 and the second server 103, which may include: the agent (agent thread) on the computer room equipment 101 is responsible for collecting the device status data to be transmitted of the deployed device, the first server 102 checks the network status of the target communication line connecting the computer room equipment 101 and the second server 103, and if the network status of the current target communication line is the first network status, the device status of the local computer room in the computer room equipment 101 is stored in the message queue, and this process is continuously executed, that is, the message queue will continuously store the device status data of the weak network status, and at the same time, the message queue is also continuously consuming the device status data, that is, sending the device status data to the second server 103 (i.e., the management server). In the process of sending the device status data in the message queue to the management server, if the number of device status data included in the message queue is greater than the data quantity threshold, the device status data at the head of the message queue is stored in the database, and then the device status data in the database is sent to the management server. In this process, when the network status of the current target communication line is weak or congested, the device status data is first cached through the message queue. If the device status data is not sent successfully in the message queue and the number of device status data in the message queue reaches the data quantity threshold, the device status data is cached for the second time through the database. By caching the device status data through the message queue and the database under the double cache mechanism, the reliability of data transmission can be guaranteed and the loss of data during data transmission can be effectively avoided.
[0047] In one implementation, the data transmission method can be applied to various application scenarios to manage data. For example, the following scenarios can be applied: cloud gaming scenarios or cloud shopping scenarios.
[0048] In one possible implementation, cloud gaming, also known as gaming on demand, is an online gaming technology based on cloud computing technology. Cloud gaming technology enables thin clients with relatively limited graphics processing and data computing capabilities to run high-quality games. In a cloud gaming scenario, the game is not played on the player's game terminal, but on a cloud server, which renders the game scene into a video and audio stream and transmits it to the player's game terminal over the network. The player's game terminal does not need to have powerful graphics computing and data processing capabilities, but only needs to have basic streaming media playback capabilities and the ability to obtain player input commands and send them to the cloud server. When the data transmission method is applied to a game scenario, the local computer room is the local computer room of the game user, and the management server is the game management center. It may include: when a user is playing an online game, the collection agent process in the local computer room of the game user collects the device status data of the physical computer in the local computer room of the game user and the virtual machine deployed on the physical computer. When the collected device status data is received from the local computer room of the game user to the game management center, if the current network status indicates that the current network transmission rate is lower than the preset threshold, the collected device status data is sent to the game cloud management center through a message queue or a database.
[0049] In one possible implementation, when the data transmission method is applied to a shopping scenario, the local computer room is the local computer room of the shopping user, and the management server is the shopping management center. Specifically, it may include: when the user is shopping online, the collection agent process in the local computer room of the shopping user collects the device status data of the physical computer in the local computer room of the shopping user and the virtual machine deployed on the physical computer. When the collected device status data is received from the local computer room of the shopping user to the shopping management center, if the current network status indicates that the current network transmission rate is lower than a preset threshold, the collected device status data is sent to the shopping management center via a message queue or a database.
[0050] It should be noted that in this application, the relevant data involved in the data transmission process, such as the device status data to be transmitted. When the above embodiments of this application are applied to specific products or technologies, user permission or consent must be obtained, and the relevant data collection, use and processing processes must comply with relevant national and regional laws, regulations and standards, and comply with the principles of legality, legitimacy and necessity, and do not involve obtaining data types prohibited or restricted by laws and regulations. In some optional embodiments, the relevant data involved in the embodiments of this application are obtained after the object has been authorized separately. In addition, when obtaining the object's separate authorization, the purpose of the relevant data involved is indicated to the object.
[0051] The data transmission method proposed in the embodiment of the present application is introduced in detail below.
[0052] See also Figure 2 , is a flow chart of a data transmission method disclosed in an embodiment of the present application. The data transmission method can be executed by a computer device. The data processing method can realize data transmission between a local computer room and a management server. The computer device can be Figure 1 For the first server 102 shown, the data transmission method may specifically include but is not limited to the following steps:
[0053] S201: If the network state of the target communication line is a first network state, the device state data of the local computer room is stored in a message queue, and the first network state is used to indicate that the network transmission rate of the target communication line is less than a first transmission rate threshold.
[0054] In a possible implementation, the device status data of the local computer room to be transmitted is first obtained, and the device status data includes one or both of the resource usage status and the working status of the device deployed in the local computer room. Specifically, the resource usage status of the device may include the disk occupancy rate, network card status, etc. of the device, and the working status of the device may include the temperature of the CPU, being in standby / working, etc. Among them, the devices deployed in the local computer room include but are not limited to multiple host machines and multiple virtual machines deployed on multiple host machines. The device status data can be obtained by the agent (agent thread) on each host machine in the local computer room through regular collection. The device status data includes N pieces of data, where N is an integer greater than 1. The N pieces of device status data can be from N agents, or can be obtained by summarizing multiple agents. In addition to regular collection, event-triggered collection can also be performed. For example, when the device status data on the host machine reaches a threshold, the agent on the host machine is triggered to perform data collection. Alternatively, when a data collection instruction is received, the agent on the host machine performs data collection.
[0055] The target communication line is the connection between the local computer room and the management server. When the local computer room and the management server are respectively the off-cloud client computer room and the on-cloud management server in the distributed cloud, the target communication line connecting the local computer room and the management server may include but is not limited to VPN and / or dedicated line.
[0056] After obtaining the equipment status data of the local computer room, the network status of the target communication line is judged by the first server 102. In the first server 102, an agent module is deployed, and there is a special network discriminator in the agent module to judge the network status. At the current moment, after the first server 102 obtains the equipment status data, the network status of the current target communication line is judged by the network discriminator. This process may include: obtaining the network transmission rate of the target communication line at the current moment; if the network transmission rate of the target communication line is less than the first transmission rate threshold, then determining that the network status of the target communication line is the first network status. The first network status indicates that the current network is poor or the current network is congested. For example, when the first transmission rate threshold can be set to 120 megabits per second, if the current network transmission rate is 100 megabits per second, it can be determined that the network status at the current moment is the first network status.
[0057] If the network status of the target communication line is the first network status, the device status data of the local computer room is stored at the end of the message queue. It can be understood that the message queue itself stores some device status data. Therefore, the device status data to be transmitted is stored at the end of the queue in chronological order. In the message queue, the device status data can be classified and stored according to the type of device status data. For example, the message queue may contain N queues, where queue A stores device status data of type A, queue B stores device status data of type B, and so on. Therefore, the current device status data of the local computer room can be understood as multiple device status data. Among them, it should be noted that the N queues can send device status data to the management server in parallel, that is, each queue sends data independently of each other, and all are sent from the head of the queue.
[0058] S202: If the amount of device status data included in the message queue is greater than the data amount threshold, the device status data at the head of the message queue is stored in the database.
[0059] When the network status is poor, the device status data is stored in the message queue to ensure reliable data transmission in weak network scenarios. The device status data stored in the message queue will still be sent to the management server, so data loss can be prevented. In the process of sending the device status data in the message queue to the management server, and as the device status data is continuously sent to the management server, if the network status is still the first network status, the device status data will continue to be stored at the end of the message queue. When the number of device status data included in the message queue is greater than the data quantity threshold, the device status data at the head of the message queue is stored in the database. Optionally, the message control thread can be called to take out the device status data at the head of the message queue, and then the message control thread can be called to store the device status data at the head of the message queue in the database. According to the above description, if the number of device status data included in the message queue reaches the data quantity threshold, the device status data at the head of the message queue is still not sent successfully, and the device status data can be stored in the database.
[0060] Optionally, the message queue includes N queues. Similarly, the database may also include N tables. Different tables represent different types, and there is a one-to-one correspondence between tables and queues. For example, the device status data taken from queue A is stored in table A, and the device status data taken from queue B is stored in table B.
[0061] S203: Send the device status data in the database to the management server.
[0062] In a possible implementation, after the device status data is stored in the database, the device status data in the database may be sent to the management server according to certain rules. For example, the rule may be a set sending order and a set sending interval, etc. Specifically, the following process may be included:
[0063] ① Determine the first device status data from the database. The first device status data is the device status data to be transmitted in the database. The first device status data to be sent each time can be determined according to the timestamp information or storage order of each device status data: first obtain the timestamp information or storage order of each device status data stored in the database. The timestamp information is carried in the device status data, and can be obtained by parsing the device status data; the storage order is recorded when the device status data is stored, and the storage order can be marked with a serial number. For example, the storage order of the first device status data stored is recorded as "1", the storage order of the second device status data stored is recorded as "2", and the storage order of the Nth device status data stored is recorded as "N". The larger the serial number, the later the storage time. Then, according to the timestamp information of each device status data or the time indicated by the storage order, a set number of device status data are selected from the database in order from the latest to the earliest time as the first device status data. Sending the device status data in this way can ensure the timeliness of the data and send the latest device status data to the management server to the greatest extent.
[0064] ② Use the message confirmation mechanism and the message retransmission mechanism to send the first device status data to the management server, and send the latest one first in chronological order. The message confirmation mechanism is that if the first device status data is sent successfully, the first device status data will be deleted from the database. The message retransmission mechanism is that if the first device status data fails to be sent, the first device status data will be sent to the management server again according to the retransmission time interval. A batch of first device status data is determined at a time, and the sending interval of each batch of device status data can be customized by the device. For example, a timer is set to trigger the sending process once every fixed time interval. Sending the device status data in the database in this way can ensure the timeliness of the data, that is, the newer data is sent to the management server earlier.
[0065] ③ If the first device status data is not sent successfully within the set time, the first device status data is cleared from the database. This step is equivalent to managing the database to avoid useless data accumulation. The set time can be one day or one week.
[0066] In an embodiment of the present application, when the local computer room and the management server transmit data through the target communication line, if the network state of the target communication line is the first network state, the device status data of the local computer room is stored in the message queue to achieve the first cache of the device status data for delayed transmission; as the device status data is continuously sent, if the number of device status data included in the message queue is greater than the data quantity threshold, the device status data at the head of the message queue is stored in the database, at this time, it is equivalent to caching the device status data for the second time to ensure that the data is not lost. Then the device status data is sent to the management server through the database. In this process, the device status data is first cached once through the message queue. As the device status data is continuously sent, if the device status data in the message queue reaches the threshold, the device status data that has not been successfully sent is cached for the second time. The device status data is cached by the message queue and the database under the double cache mechanism, which can ensure the reliability of data transmission and effectively avoid the loss of data during data transmission.
[0067] See also Figure 3 , is a flow chart of another data transmission method disclosed in an embodiment of the present application, the data transmission method can be executed by a computer device, and the computer device can be Figure 1 The first server 102 shown in the figure, the data transmission method describes the two caches of the device status data, and also describes how the device status data is transmitted in the message queue and the database, including but not limited to the following steps:
[0068] S301: Acquire device status data of a local computer room to be transmitted, where the device status data includes one or both of resource usage status and working status of devices deployed in the local computer room, and the local computer room is connected to a management server via a target communication line.
[0069] S302: Determine the network status of the target communication line.
[0070] The network transmission rate of the target communication line at the current moment is obtained. If the network transmission rate of the target communication line is less than the first transmission rate threshold, the network state of the target communication line is determined to be the first network state; if the transmission rate of the target communication line is greater than the second transmission rate threshold, the network state of the target communication line is determined to be the second network state. The second transmission rate threshold is greater than or equal to the first transmission rate threshold. The first network state indicates that the current network belongs to a weak network, and the second network state indicates that the current network belongs to a strong network.
[0071] S303: If the network state of the target communication line is the first network state, the device state data is stored in the message queue.
[0072] S304: Send the device status data in the message queue to the management server.
[0073] In one possible implementation, the device status data in the message queue can be consumed through the message confirmation mechanism and the message retransmission mechanism. The process is as follows:
[0074] S1: Determine second device status data from the message queue, and send the second device status data to the management server, where the second device status data is the device status data to be transmitted in the message queue.
[0075] In the message queue, the device status data in the message queue is sent from the head to the tail, that is, the device status data at the head of the message queue is sent first. The second device status data is the data at the head of the queue.
[0076] S2: The consumer of the message queue sends a message to the management server, and determines whether the first device status data is sent successfully through the message confirmation mechanism. If the second device status data is sent successfully, the second device status data will be deleted from the message queue; that is, the second device status data will be removed from the message queue only when the second device status data is successfully pushed to the management server to avoid data loss. When the second device status data is sent successfully, the next device status data in the queue can be sent according to the target time interval. Optionally, the target time interval can be set to 0.1 seconds, 0.01 seconds, 1 second, etc. Among them, the target time interval can also be set to 0 seconds, that is, the next device status data is sent immediately after the previous device status data is sent successfully.
[0077] S3: If the second device status data fails to be sent, the message retransmission mechanism is used to send the second device status data to the management server again. After the second device status data fails to be sent, it can be continuously retransmitted, so it is necessary to determine a retransmission time interval here to ensure the reliability of data transmission. This process may include: ① Determine the number of retransmissions of the second device status data and the first transmission time interval in the message queue, the first transmission time interval being the largest transmission time interval between any two adjacent device status data in the message queue; ② Determine the retransmission time interval based on the number of retransmissions and the first transmission time interval. First, determine the second transmission time interval based on the number of retransmissions and the set calculation rules, and then select the smaller one from the first transmission time interval and the second transmission time interval as the retransmission time interval.
[0078] The number of retransmissions is determined according to the number of repeated transmissions of the second device status data. For example, if the second device status data has been transmitted 4 times, the number of retransmissions is 4. The second transmission time interval S is determined according to the number of retransmissions n and the set calculation rule, as shown in the following formula (1):
[0079] S = 2*(n-1)(1)
[0080] For example, when the number of retransmissions is 4, then S=2*(4-1)=6 seconds.
[0081] Furthermore, the retransmission time interval R is determined according to formula (2):
[0082] R=min(2*(n-1),max_time_interval) (2)
[0083] Wherein, max_time_interval is the first transmission time interval, 2*(n-1) is the second transmission time interval, and formula (2) means taking the smaller of the two as the retransmission time interval R. It should be noted that, according to the above formula, it can be known that the more the number of retries, the longer the second transmission time interval, which can be constrained by the first transmission time interval to improve transmission efficiency.
[0084] ③ After the retransmission time interval, send the second device status data to the management server again. If it still fails to send, continue sending according to step ② until it is sent successfully.
[0085] S305: In the process of sending the device status data in the message queue to the management server, if the amount of device status data included in the message queue is greater than the data amount threshold, the device status data at the head of the message queue is stored in the database.
[0086] If the amount of device status data included in the message queue is greater than the data amount threshold, and the second device status data in step S304 is still not sent successfully, then the second device status data can be directly stored in the database.
[0087] S306: Send the device status data in the database to the management server.
[0088] The detailed process of step S306 has been described in detail in step S204, and will not be repeated here.
[0089] In a possible implementation, steps S303 to S306 implement a double-layer cache mechanism in the data transmission method of the present application, including storage and transmission of data, such as Figure 4 As shown, a transmission process of device status data under a double-layer cache mechanism disclosed in an embodiment of the present application includes the following steps:
[0090] S10: The producer of the message queue receives the device status data from the local computer room (collected by the Agent) and stores it in the message queue (MQ). In a normal weak network scenario, the producer continuously receives the device status data sent from the local computer room and stores it in the message queue, so there is a certain backlog of messages in the message queue.
[0091] S20: The consumer of the message queue takes messages from the message queue and reports them to the management server (Server). Although the message queue is constantly storing messages, consumers are also constantly sending messages to the management server, and under normal circumstances, network congestion is not serious and recovers quickly, so the backlog of messages in the message queue generally does not exceed the data quantity threshold.
[0092] S30: The message controller (message control thread) of the message queue takes the message and stores it in the database (DB) when the message in the message queue reaches the data quantity threshold. At present, most solutions for the data in the message queue will discard the data when the data backlog reaches the data quantity threshold. However, the present application uses the message controller to take the device status data at the head of the queue and store it in the database for secondary caching when the device status data in the message queue reaches the data quantity threshold, thereby ensuring that the data in the message queue is not lost.
[0093] S40: The database then reports the device status data therein to the management server through the message confirmation mechanism and the message retransmission mechanism, which ensures that the data can be reliably reported to the management server without losing the data.
[0094] S307: If the network state of the target communication line is the second network state, the device state data is sent to the management server via the bypass transmission path of the target communication line.
[0095] The second network status indicates that the current network is strong, and the message can be directly uploaded to the management server through a pre-set bypass transmission path. This path can achieve high-speed transmission.
[0096] In the embodiment of the present application, after obtaining the status data to be transmitted and determining that the current network status is a weak network, the device status data is transmitted through a double-layer cache mechanism and a message retransmission mechanism. The double-layer cache mechanism not only ensures the reliable transmission of device status data in a weak network, but also ensures that the backlog of messages is not lost when the network fails and can be reported to the management server normally, further improving the system's ability to adapt to worse network conditions. The device status data stored in the message queue is transmitted through a message confirmation mechanism and a message retransmission mechanism to ensure the reliability of data transmission; and in the case of a network failure, the device status data overflowing the message queue is cached twice and then transmitted through the database transmission path, further ensuring the reliability of data transmission.
[0097] The following is an example to introduce the data transmission method disclosed in the embodiment of the present application.
[0098] Take the distributed scenario as an example, in which the local computer room is the customer computer room under the cloud, the management server is the management server on the cloud, and the distributed cloud is to deploy resources in the computer room specified by the user under the cloud, and then connect the cloud management server and the customer computer room under the cloud through a VPN dedicated line. For cost considerations, the bandwidth of the VPN dedicated line is often limited, and the VPN dedicated line must cross from the cloud to the cloud, and the transmission distance is also relatively far, so weak network situations such as network disconnection or network congestion often occur. The data transmission method proposed in this application can ensure that the device status data of the host device of the customer computer room under the cloud can be reliably reported to the cloud management server in a weak network environment through a message queue and a message retransmission mechanism. At the same time, since the message in the message queue will only be removed from the queue when the message is successfully sent or the message expires, even if the network is completely disconnected, as long as the network conditions improve within the validity period of the message, the message can be successfully sent through the message queue and will not be lost. At the same time, due to the limited capacity of the message queue, when the amount of device status data exceeds the data quantity threshold, the device status data will be transferred to the database. Through such a double-layer cache mechanism, it not only ensures the reliable transmission of messages in weak network conditions, but also ensures that messages are not lost in the event of network failure.
[0099] See also Figure 5 , is a flow chart of a data transmission method disclosed in an embodiment of the present application, wherein different transmission paths are selected for data transmission according to the current network status, and mainly include the following three transmission paths:
[0100] 1. Bypass transmission path
[0101] The agent (proxy thread) on the host machine of the customer's room under the cloud collects device status data and sends it to the Proxy module. The entry of the Proxy module - the network status discriminator makes a network status judgment and forwards the device status data to different transmission paths according to the current network status. When it is a strong network environment (that is, the network transmission rate of the target communication line is greater than the second transmission rate threshold), the device status data is directly forwarded to the bypass transmission path, which can directly reach the cloud management server and will not affect the transmission efficiency under normal business conditions.
[0102] 2. Message Queue Transmission Path
[0103] When it is a weak network environment (that is, the network transmission rate of the target communication line is less than the first transmission rate threshold), the device status data is forwarded to the message queue transmission path, and then the device status data is sent to the cloud management server through the message confirmation mechanism and the message retransmission mechanism to ensure the reliability of the device status data in a weak network environment. In the message queue, the consumer in the message queue takes the device status data from the message queue and reports the device status data to the cloud management server, but the device status data still exists in the message queue at this time. Only when the device status data is successfully pushed to the cloud management server will the device status data be removed from the message queue, and then the next device status data will be consumed. When the device status data fails to be successfully pushed to the cloud management server, it will be retransmitted until the device status data is successfully pushed, thereby ensuring the reliability of data transmission in a weak network environment. Among them, the message queue adopts a multi-queue mode, and different services have independent queues to avoid mutual interference between different services, such as Figure 5 The A queue and the B queue are shown in FIG.
[0104] 3. Database transmission path:
[0105] Due to network failure, the VPN dedicated line is unavailable for a long time, and the message queue will have a backlog of device status data. When the amount of device status data in the message queue reaches the data quantity threshold, the earliest message in the message queue can be removed from the queue and stored in the database for secondary caching. The device status data is then reported to the cloud management server through the database transmission path. The database adopts a multi-table mode, and each table is independent of each other. Figure 5 Similarly, the cloud management server also adopts a multi-service model, such as Figure 5 As shown, the cloud management server includes two servers, namely server A and server B. Different servers are used for different types of services, and the services are associated with the types of device status data.
[0106] Through this embodiment, in a normal strong network environment, the host device detection information of the customer room under the cloud is directly reported to the cloud management and control through the Bypass path, and the transmission efficiency is not affected; in a weak network environment, through the message queue and failure retry mechanism, it is ensured that the device status data of the host device in the customer room under the cloud can be reliably reported to the cloud management server, ensuring the integrity of the device status data and solving the problem of breakpoints in the device status data caused by network disturbances.
[0107] The data transmission method provided in this embodiment not only ensures the reliable transmission of device status data in weak network conditions through a double-layer cache mechanism, but also ensures that the backlog of messages is not lost when the network fails and can be reported to the management server normally, further improving the system's ability to adapt to worse network conditions. The device status data stored in the message queue is transmitted through a message confirmation mechanism and a message retransmission mechanism to ensure the reliability of data transmission; and in the case of a network failure, the device status data overflowing the message queue is cached twice and then transmitted through the database transmission path, further ensuring the reliability of data transmission.
[0108] The method of the embodiment of the present application is described in detail above. In order to facilitate better implementation of the above scheme of the embodiment of the present application, the device of the embodiment of the present application is provided below accordingly.
[0109] See also Figure 6 , Figure 6 It is a structural diagram of a data transmission device provided in an embodiment of the present application. The data transmission device can be arranged in the computer device provided in an embodiment of the present application. Figure 6 The data transmission device shown may be a computer program (including program code) running in a computer device, and the data transmission device may be used to execute Figure 2 , Figure 3 as well as Figure 5 Some or all of the steps in the method embodiment shown. Figure 6 The data transmission device is applied to data transmission between a local computer room and a management server, the local computer room and the management server are connected via a target communication line, and the data transmission device may include the following units:
[0110] The processing unit 601 is configured to store the device status data of the local computer room in a message queue if the network status of the target communication line is a first network status, wherein the first network status is used to indicate that the network transmission rate of the target communication line is less than a first transmission rate threshold;
[0111] The processing unit 601 is further configured to store the device status data at the head of the message queue in the database if the amount of device status data included in the message queue is greater than a data amount threshold;
[0112] The sending unit 602 is used to send the device status data in the database to the management server.
[0113] In a possible implementation, when the processing unit 601 stores the device status data at the head of the message queue in the database, it is specifically configured to perform the following steps:
[0114] Calling the message control thread to fetch the second device status data at the head of the queue from the message queue;
[0115] The message control thread is called to store the device status data at the head of the queue in a database.
[0116] In a possible implementation, when the sending unit 602 sends the device status data in the database to the management server, it is specifically configured to perform the following steps:
[0117] Determine first device status data from the database, where the first device status data is device status data to be transmitted in the database;
[0118] The first device status data is sent to the management server by using a message confirmation mechanism and a message retransmission mechanism, wherein the message confirmation mechanism is to delete the first device status data from the database if the first device status data is sent successfully, and the message retransmission mechanism is to send the first device status data to the management server again according to a retransmission time interval if the first device status data fails to be sent;
[0119] If the first device status data is not sent successfully within the set time, the first device status data is cleared from the database.
[0120] In a possible implementation, when the processing unit 601 determines the first device status data from the database, it is specifically configured to perform the following steps:
[0121] Obtain the timestamp information or storage order of each device status data stored in the database;
[0122] According to the timestamp information of each device status data or the time indicated by the storage order, a set number of device status data are selected from the database in order from the latest to the earliest time as the first device status data.
[0123] In a possible implementation, the acquisition unit 603 is configured to acquire a network transmission rate of the target communication line at a current moment;
[0124] The processing unit 601 is further configured to determine that the network state of the target communication line is a first network state if the network transmission rate of the target communication line is less than a first transmission rate threshold.
[0125] In a possible implementation, the acquiring unit 603 is further configured to acquire second device status data from the message queue, and send the second device status data to the management server, where the second device status data is the device status data to be transmitted in the message queue;
[0126] The processing unit 601 is further configured to delete the second device status data from the message queue if the second device status data is sent successfully; and to use a message retransmission mechanism to send the second device status data to the management server again if the second device status data is sent unsuccessfully.
[0127] In a possible implementation, when the sending unit 602 uses a message retransmission mechanism to send the second device status data to the management server again, it is specifically configured to perform the following steps:
[0128] Determine the number of retransmissions of the second device status data and a first transmission time interval in the message queue, where the first transmission time interval is the maximum transmission time interval among the transmission time intervals between any two adjacent device status data in the message queue;
[0129] Determine a retransmission time interval based on the number of retransmissions and the first transmission time interval;
[0130] After the retransmission time interval, the second device status data is sent to the management server again.
[0131] In one implementation, the sending unit 602 is also used to send the equipment status data of the local computer room to the management server through the bypass transmission path of the target communication line if the network status of the target communication line is a second network status, and the second network status is used to indicate that the network transmission rate of the target communication line is greater than a second transmission rate threshold.
[0132] According to another embodiment of the present application, Figure 6 The various units in the data transmission device shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the data transmission device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0133] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 , Figure 3 or Figure 4 A computer program (including program code) for each step involved in part or all of the method shown in the figure is used to construct a computer program (including program code) for each step involved in part or all of the method shown in the figure. Figure 6 The data transmission device shown in the embodiment of the present application is used to implement the data transmission method of the embodiment of the present application. The computer program can be recorded on a computer-readable storage medium, for example, and loaded into the above-mentioned computing device through the computer-readable storage medium and run therein.
[0134] In an embodiment of the present application, when the local computer room and the management server transmit data through the target communication line, if the network state of the target communication line is the first network state, the device status data of the local computer room is stored in the message queue to achieve the first cache of the device status data for delayed transmission; as the device status data is continuously sent, if the number of device status data included in the message queue is greater than the data quantity threshold, the device status data at the head of the message queue is stored in the database, which is equivalent to caching the device status data for the second time to ensure that the data is not lost. Then the device status data is sent to the management server through the database. In this process, the device status data is first cached once through the message queue. As the device status data is continuously sent, if the device status data in the message queue reaches the threshold, the device status data that has not been successfully sent is cached for the second time. The device status data is cached by the message queue and the database under the double cache mechanism, which can ensure the reliability of data transmission and effectively avoid the loss of data during data transmission.
[0135] Based on the above method and device embodiments, the present application embodiment provides a computer device. Figure 7 , Figure 7 is a schematic diagram of a computer device provided in an embodiment of the present application. The computer device may be Figure 1 A first server 102 is shown. Figure 7 The computer device shown includes at least a processor 701, an input interface 702, an output interface 703, and a computer-readable storage medium 704. The processor 701, the input interface 702, the output interface 703, and the computer-readable storage medium 704 may be connected via a bus or other means.
[0136] The computer-readable storage medium 704 may be stored in a memory of a computer device. The computer-readable storage medium 704 is used to store a computer program. The computer program includes computer instructions. The processor 701 is used to execute the program instructions stored in the computer-readable storage medium 704. The processor 701 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more computer instructions, and is specifically suitable for loading and executing one or more computer instructions to implement a corresponding method flow or a corresponding function.
[0137] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the operating system of the computer device. In addition, one or more computer instructions suitable for being loaded and executed by the processor are also stored in the storage space. These computer instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory, or a non-volatile memory (Non-VolatileMemory), such as at least one disk storage; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.
[0138] In some embodiments, the processor 701 may load and execute one or more computer instructions stored in the computer-readable storage medium 704 to implement the above-mentioned Figure 2 , Figure 3 as well as Figure 5 In the specific implementation, the local computer room is connected to the management server through the target communication line to realize data transmission, and the computer instructions in the computer readable storage medium 704 are loaded by the processor 701 and execute the following steps:
[0139] If the network state of the target communication line is a first network state, storing the device state data of the local computer room in a message queue, the first network state is used to indicate that the network transmission rate of the target communication line is less than a first transmission rate threshold;
[0140] If the amount of device status data included in the message queue is greater than the data amount threshold, storing the device status data at the head of the message queue in the database;
[0141] The device status data in the database is sent to the management server.
[0142] In a possible implementation, when the computer instructions in the computer-readable storage medium 704 are loaded and executed by the processor 701 to store the device status data at the head of the message queue in the database, the computer instructions are specifically used to perform the following steps:
[0143] Calling the message control thread to fetch the second device status data at the head of the queue from the message queue;
[0144] The message control thread is called to store the device status data at the head of the queue in a database.
[0145] In a possible implementation, when the computer instructions in the computer-readable storage medium 704 are loaded and executed by the processor 701 to send the device status data in the database to the management server, the computer instructions are specifically used to perform the following steps:
[0146] Determine first device status data from the database, where the first device status data is device status data to be transmitted in the database;
[0147] The first device status data is sent to the management server by using a message confirmation mechanism and a message retransmission mechanism, wherein the message confirmation mechanism is to delete the first device status data from the database if the first device status data is sent successfully, and the message retransmission mechanism is to send the first device status data to the management server again according to a retransmission time interval if the first device status data fails to be sent;
[0148] If the first device status data is not sent successfully within the set time, the first device status data is cleared from the database.
[0149] In a possible implementation, when the computer instructions in the computer-readable storage medium 704 are loaded and executed by the processor 701 to determine the first device status data from the database, they are specifically used to perform the following steps:
[0150] Obtain the timestamp information or storage order of each device status data stored in the database;
[0151] According to the timestamp information of each device status data or the time indicated by the storage order, a set number of device status data are selected from the database in order from the latest to the earliest time as the first device status data.
[0152] In a possible implementation, the computer instructions in the computer-readable storage medium 704 are further used by the processor 701 to load and execute the following steps:
[0153] Obtaining the network transmission rate of the target communication line at the current moment;
[0154] If the network transmission rate of the target communication line is less than a first transmission rate threshold, the network state of the target communication line is determined to be a first network state.
[0155] In a possible implementation, the computer instructions in the computer-readable storage medium 704 are further used by the processor 701 to load and execute the following steps:
[0156] Acquire second device status data from the message queue, and send the second device status data to the management server, where the second device status data is the device status data to be transmitted in the message queue;
[0157] If the second device status data is sent successfully, deleting the fourth device status data from the message queue;
[0158] If the sending of the second device status data fails, a message retransmission mechanism is used to send the second device status data to the management server again.
[0159] In a possible implementation, when the computer instructions in the computer-readable storage medium 704 are loaded and executed by the processor 701 to send the second device status data to the management server again using a message retransmission mechanism, the computer instructions are specifically used to perform the following steps:
[0160] Determine the number of retransmissions of the second device status data and a first transmission time interval in the message queue, where the first transmission time interval is the maximum transmission time interval among the transmission time intervals between any two adjacent device status data in the message queue;
[0161] Determine a retransmission time interval based on the number of retransmissions and the first transmission time interval;
[0162] After the retransmission time interval, the second device status data is sent to the management server again.
[0163] In one implementation, the computer instructions in the computer readable storage medium 704 are further used by the processor 701 to load and execute the following steps:
[0164] If the network state of the target communication line is a second network state, the device state data of the local computer room is sent to the management server via a bypass transmission path of the target communication line, and the second network state is used to indicate that the network transmission rate of the target communication line is greater than a second transmission rate threshold.
[0165] In an embodiment of the present application, when the local computer room and the management server transmit data through the target communication line, if the network state of the target communication line is the first network state, the device status data of the local computer room is stored in the message queue to achieve the first cache of the device status data for delayed transmission; as the device status data is continuously sent, if the number of device status data included in the message queue is greater than the data quantity threshold, the device status data at the head of the message queue is stored in the database, which is equivalent to caching the device status data for the second time to ensure that the data is not lost. Then the device status data is sent to the management server through the database. In this process, the device status data is first cached once through the message queue. As the device status data is continuously sent, if the device status data in the message queue reaches the threshold, the device status data that has not been successfully sent is cached for the second time. The device status data is cached by the message queue and the database under the double cache mechanism, which can ensure the reliability of data transmission and effectively avoid the loss of data during data transmission.
[0166] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the data transmission method provided in the above-mentioned various optional modes.
[0167] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0168] In the several embodiments provided in this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, and the division of the modules described above is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0169] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data transmission method, the method is applied to data transmission between a local computer room and a management server, the local computer room and the management server are connected via a target communication line, characterized in that: The method comprises: If the network state of the target communication line is a first network state, storing the device state data of the local computer room in a message queue, the first network state is used to indicate that the network transmission rate of the target communication line is less than a first transmission rate threshold; If the amount of device status data included in the message queue is greater than the data amount threshold, storing the device status data at the head of the message queue in the database; The device status data in the database is sent to the management server.
2. The method according to claim 1, characterized in that: The storing the device status data at the head of the message queue in the database includes: Calling the message control thread to fetch the device status data at the head of the queue from the message queue; The message control thread is called to store the device status data at the head of the queue in a database.
3. The method according to claim 1 or 2, characterized in that: The sending the device status data in the database to the management server includes: Determine first device status data from the database, where the first device status data is device status data to be transmitted in the database; The first device status data is sent to the management server by using a message confirmation mechanism and a message retransmission mechanism, wherein the message confirmation mechanism is to delete the first device status data from the database if the first device status data is sent successfully, and the message retransmission mechanism is to send the first device status data to the management server again according to a retransmission time interval if the first device status data fails to be sent; If the first device status data is not sent successfully within the set time, the first device status data is cleared from the database.
4. The method according to claim 3, characterized in that: The determining the first device status data from the database includes: Obtain the timestamp information or storage order of each device status data stored in the database; According to the timestamp information of each device status data or the time indicated by the storage order, a set number of device status data are selected from the database in order from the latest to the earliest time as the first device status data.
5. The method according to claim 1, characterized in that The method further comprises: Obtaining the network transmission rate of the target communication line at the current moment; If the network transmission rate of the target communication line is less than a first transmission rate threshold, the network state of the target communication line is determined to be a first network state.
6. The method according to claim 1 or 2, characterized in that: The method further comprises: Acquire second device status data from the message queue, and send the second device status data to the management server, where the second device status data is the device status data to be transmitted in the message queue; If the second device status data is sent successfully, deleting the second device status data from the message queue; If the sending of the second device status data fails, a message retransmission mechanism is used to send the second device status data to the management server again.
7. The method according to claim 6, characterized in that The adopting a message retransmission mechanism to send the second device status data to the management server again includes: Determine the number of retransmissions of the second device status data and a first transmission time interval in the message queue, where the first transmission time interval is the maximum transmission time interval among the transmission time intervals between any two adjacent device status data in the message queue; Determine a retransmission time interval based on the number of retransmissions and the first transmission time interval; After the retransmission time interval, the second device status data is sent to the management server again.
8. The method according to claim 1, characterized in that The method further comprises: If the network state of the target communication line is a second network state, the device state data of the local computer room is sent to the management server via a bypass transmission path of the target communication line, and the second network state is used to indicate that the network transmission rate of the target communication line is greater than a second transmission rate threshold.
9. A data transmission device, the device is used for data transmission between a local computer room and a management server, the local computer room and the management server are connected through a target communication line, characterized in that: The device comprises: a processing unit, configured to store the device status data of the local computer room in a message queue if the network status of the target communication line is a first network status, wherein the first network status is used to indicate that the network transmission rate of the target communication line is less than a first transmission rate threshold; The processing unit is further configured to store the device status data at the head of the message queue in the database if the amount of device status data included in the message queue is greater than a data amount threshold; A sending unit is used to send the device status data in the database to the management server.
10. A computer device, characterized in that: The computer device comprises: a processor adapted to implement one or more computer programs; and, A computer storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded by the processor and executing the data transmission method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more computer programs, and the one or more computer programs are suitable for being loaded by a processor and executing the data transmission method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the data transmission method according to any one of claims 1 to 8.
Citation Information
Cited By
Data transmission method, device and system and storage medium
CN119967099A