Data transmission method and device, equipment and storage medium
Through the adaptive switching transmission protocol method, the problem of inability to take into account both transmission speed and communication quality is solved, and the effect of improving data transmission speed without affecting communication quality is achieved.
Patent Information
- Application Number
- CN202410025014.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-03
- Publication Date
- 2025-07-04
AI Technical Summary
In the prior art, data transmission using a fixed transmission protocol cannot be taken into account both the transmission speed and communication quality.
Through the method of adaptively switching the transmission protocol, a link to the second transmission protocol is established between the first device and the second device according to the conditions, and encapsulated into a logical link, and the link to the first transmission protocol is closed to realize data transmission.
Without affecting the communication quality, the data transmission speed is improved to ensure that protocol switching is unaware of the user.
Smart Images

Figure CN120263640A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technologies, and in particular, to a data transmission method, apparatus, device, and storage medium. Background Art
[0002] Currently, two devices communicate through a fixed transmission protocol. For example, the Transmission Control Protocol (TCP) or the Remote Direct Memory Access (RDMA) transmission protocol can be used for communication between two devices. However, each transmission protocol has its own advantages and disadvantages. For example, the TCP protocol has a relatively low transmission speed, but it is applicable to various communication paths. The RDMA protocol has a relatively high transmission speed, but for a communication path with too many switches, communication anomalies will occur.
[0003] Based on this, when using a fixed transmission protocol for data transmission, it is impossible to balance both the transmission speed and the communication quality. Summary of the Invention
[0004] The embodiments of the present application provide a data transmission method, apparatus, device, and storage medium, so as to balance both the transmission speed and the communication quality.
[0005] In a first aspect, the embodiments of the present application provide a data transmission method, which is applied to a first device. The method includes: if a switching condition for switching from a first transmission protocol to a second transmission protocol is satisfied between the first device and a second device, establish a second link using the second transmission protocol with the second device; encapsulate the second link into a logical link between the first device and the second device; if there is no data being transmitted on a first link using the first transmission protocol, or if there is data being transmitted on the first link and a forced switching instruction is obtained, transmit data to the second device through the second link, and close the first link.
[0006] In a second aspect, the embodiments of the present application provide a data transmission method, which is applied to a second device. The method includes: establish a second link using the second transmission protocol with the first device; wherein the establishment of the second link is initiated by the first device when it is determined that the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the first device and the second device; and the second link is encapsulated into a logical link between the first device and the second device; receive data transmitted by the first device through the second link when there is no data being transmitted on a first link using the first transmission protocol, or when there is data being transmitted on the first link and a forced switching instruction is obtained, and close the first link.
[0007] In a third aspect, an embodiment of the present application provides a data transmission device, including: a processing module and a communication module; the processing module is configured to establish a second link using a second transmission protocol with a second device if a switching condition for switching from a first transmission protocol to a second transmission protocol is met between the data transmission device and the second device; the processing module is further configured to encapsulate the second link into a logical link between the data transmission device and the second device; the communication module is configured to transmit data to the second device through the second link if there is no data being transmitted on a first link using the first transmission protocol, or if there is data being transmitted on the first link and a forced switching instruction is obtained; the processing module is further configured to close the first link.
[0008] In a fourth aspect, an embodiment of the present application provides a data transmission device, including: a processing module and a communication module; the processing module is configured to establish a second link using a second transmission protocol with a first device; wherein, the establishment of the second link is initiated by the first device when it is determined that a switching condition for switching from a first transmission protocol to a second transmission protocol is met between the first device and the data transmission device; and the second link is encapsulated into a logical link between the first device and the data transmission device; the communication module is configured to receive data transmitted by the first device through the second link if there is no data being transmitted on a first link using the first transmission protocol, or if there is data being transmitted on the first link and a forced switching instruction is obtained; the processing module is further configured to close the first link.
[0009] In a fifth aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory, the memory is configured to store a computer program, and the processor is configured to call and run the computer program stored in the memory to execute the method according to any one of the first aspect to the second aspect or its various implementation manners.
[0010] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium for storing a computer program, and the computer program causes a computer to execute the method according to any one of the first aspect to the second aspect or its various implementation manners.
[0011] In a seventh aspect, an embodiment of the present application provides a computer program product, including computer program instructions, and the computer program instructions cause a computer to execute the method according to any one of the first aspect to the second aspect or its various implementation manners.
[0012] In an eighth aspect, an embodiment of the present application provides a computer program, and the computer program causes a computer to execute the method according to any one of the first aspect to the second aspect or its various implementation manners.
[0013] With the technical solution provided by this application, if the switching condition for switching from the first transmission protocol to the second transmission protocol is met between the first device and the second device, a second link using the second transmission protocol is established between the first device and the second device; the first device transmits data to the second device through the second link and closes the first link using the first transmission protocol. By means of this adaptive switching of the transmission protocol for data transmission, both the transmission speed and the communication quality can be taken into account. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other accompanying drawings can be obtained based on these drawings without creative efforts.
[0015] Figure 1 It is a schematic diagram of a system architecture related to an embodiment of this application;
[0016] Figure 2 It is a schematic diagram of components provided by an embodiment of this application;
[0017] Figure 3 It is an interaction flowchart of a data transmission method provided by an embodiment of this application;
[0018] Figure 4 It is a schematic diagram of a data transmission device 400 provided by an embodiment of this application;
[0019] Figure 5 It is a schematic diagram of a data transmission device 500 provided by an embodiment of this application;
[0020] Figure 6 It is a schematic block diagram of an electronic device provided by an embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.
[0022] It should be noted that in the description and claims of the present invention and the above-mentioned drawings, the terms "first", "second", etc. are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or server that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0023] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.
[0024] The embodiments of the present application may relate to cloud technology.
[0025] Cloud technology is a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.
[0026] Cloud technology is the 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, be used on demand, and is flexible and convenient. Cloud computing technology will become an important support. The back-end services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark and needs to be transmitted to the back-end system for logical processing. Data at different levels will be processed separately, and various industry data requires a powerful system back-end support, which can only be achieved through cloud computing.
[0027] In the embodiments of the present application, at least one of the first device and the second device may be a cloud server.
[0028] A cloud server is a simple, efficient, secure, and reliable computing service with elastic scalability in processing power. Its management is simpler and more efficient than that of physical servers. Users can quickly create or release any number of cloud servers without the need to purchase hardware in advance. Cloud servers can help users quickly build more stable and secure applications, reduce the difficulty of development and operation, and the overall IT cost, enabling users to focus more on the innovation of core business. Each cluster node of the cloud server platform is deployed in the backbone data centers of the Internet and can independently provide Internet infrastructure services such as computing, storage, online backup, hosting, and bandwidth. The characteristics of cloud servers include stability, security, efficiency, and elastic scalability, and the resources can be dynamically adjusted according to user needs. Cloud servers are usually used to host websites, applications, databases, etc., and provide various Internet services. Compared with traditional physical servers, cloud servers have higher flexibility, scalability, and reliability, and can be customized and configured according to needs.
[0029] The relevant knowledge related to this application will be elaborated below:
[0030] I. The transfer protocol is a set of specifications and standards used for data transmission in computer networks. The goal of the transfer protocol is to achieve efficient, reliable, and secure data transmission. Common transfer protocols include TCP, RDMA protocol, and User Datagram Protocol (UDP), etc.
[0031] II. The logical link manages multiple actual links internally, such as TCP links and RDMA links.
[0032] III. TCP is a connection-oriented, reliable, byte-stream-based transport layer communication protocol. TCP is designed to adapt to the hierarchical protocol architecture that supports multiple network applications.
[0033] IV. The RDMA protocol is a protocol that supports high-speed remote memory access. It can be used in high-performance computing, data centers, cloud computing, etc. RDMA allows data to be directly transferred between computers without passing through the Central Processing Unit (CPU), thus greatly improving the speed and efficiency of data transmission.
[0034] V. The Data Plane Development Kit (DPDK) is a data plane development protocol. It aims to optimize packet processing performance and improve the performance of networks and storage. The DPDK protocol itself is not a network protocol but a protocol for developing data plane applications.
[0035] VI. Component refers to a software component with certain functions and interfaces that can run independently, and can be reused, replaced, and upgraded. It is an object-oriented software design concept that encapsulates unrelated functional modules, enabling the software system to have a good modular structure and be easy to maintain and upgrade.
[0036] VII. Global incrementing identifier is a unique identifier, usually used in distributed systems to uniquely identify each piece of data or message. This identifier usually has global uniqueness, that is, there will be no duplicate identifier numbers in the entire system. At the same time, the global incrementing identifier usually has the characteristic of increasing trend, that is, the next identifier number must be greater than the previous one to meet special requirements.
[0037] Next, the technical problems to be solved, the inventive concept, and the system architecture of the embodiments of the present application will be elaborated:
[0038] As mentioned above, when using a fixed transmission protocol for data transmission, it is impossible to balance the transmission speed and communication quality.
[0039] To solve the above technical problems, the embodiments of the present application propose an adaptive switching transmission protocol for data transmission, so as to balance the transmission speed and communication quality.
[0040] In some implementable ways, the system architecture of the embodiments of the present application is as Figure 1 shown.
[0041] Figure 1 This is a schematic diagram of a system architecture related to the embodiments of the present application, including a first device 110 and a second device 120. Among them, the first device 110 and the second device 120 can be directly or indirectly connected through wired or wireless communication methods, and the present application does not limit this here.
[0042] In some implementable ways, the first device 110 can be a terminal device, which can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a virtual reality (VR) device, an augmented reality (AR) device, etc., but is not limited thereto.
[0043] In some other implementable ways, the first device 110 can be a network device, which can be an access network device, a core network device, a local area network device, or a wide area network device, etc., but is not limited thereto.
[0044] In some implementable ways, the second device 120 may be a terminal device, which may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a VR device, an AR device, etc., but is not limited thereto.
[0045] In some other implementable ways, the second device 120 may be a network device, which may be an access network device, a core network device, a local area network device, a wide area network device, etc., but is not limited thereto.
[0046] Among them, the access network device may include: a base station, an access point (AP), a wireless fidelity (WiFi) node, etc., but is not limited thereto.
[0047] The core network device may include: a mobility management entity (MME), a serving gateway (S-GW), a home subscriber server (HSS), etc., but is not limited thereto.
[0048] The local area network device or the wide area network device may include: a server. Among them, the server may be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing 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, content delivery network (CDN), and big data and artificial intelligence platforms.
[0049] In some implementable ways, the first device 110 may use an operating system such as Windows, Unix, Linux, IOS, etc., but is not limited thereto.
[0050] In some implementable ways, the second device 120 may use an operating system such as Windows, Unix, Linux, IOS, etc., but is not limited thereto.
[0051] In some implementable ways, the first device 110 may be configured with at least one transmission protocol, for example, TCP, RDMA protocol.
[0052] In some implementable ways, the second device 120 may also be configured with at least one transmission protocol, for example, TCP, RDMA protocol.
[0053] In some implementable ways, components as shown below can be installed on both the first device 110 and the second device 120. Figure 2 As shown, Figure 2 is a schematic diagram of the components provided by the embodiments of the present application. As shown in Figure 2 , the components include: an interface layer, a logical link management module, a protocol stack management module, a thread management module, and a task management module.
[0054] Among them, an application using the above components can be embedded into the application. The first device 110 and the second device 120 can directly call the interfaces of the interface layer for network communication, or can encapsulate the Remote Procedure Call Protocol (RPC) protocol on the basis of the above components and then perform network communication, that is, the RPC protocol is optional.
[0055] In some implementable ways, the interface layer includes interfaces for creating or closing logical links, etc., but is not limited thereto.
[0056] In some implementable ways, the logical link management module internally manages multiple actual links, such as TCP links, RDMA links, etc. The logical links are actually exposed to users using the above components, and specific transmission protocols do not need to be understood by users.
[0057] In some implementable ways, the protocol stack management module is used to manage transmission protocols, such as TCP, RDMA protocols, etc.
[0058] In some implementable ways, the thread management module is used to manage threads, such as adding, deleting, or modifying threads.
[0059] In some implementable ways, the task management module is used to manage tasks, such as receiving requests, sending requests, etc.
[0060] The technical solution of the present application will be elaborated in detail below:
[0061] Figure 3 is an interaction flowchart of a data transmission method provided by the embodiments of the present application. This method can be executed by the first device and the second device. For example, it is Figure 1 the first device 110 and the second device 120 as shown in Figure 3 . As shown, this method includes:
[0062] S310: If the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the first device and the second device, a second link using the second transmission protocol is established between the first device and the second device;
[0063] It should be understood that the first transmission protocol is the transmission protocol currently adopted by the first device and the second device, and the second transmission protocol is the transmission protocol that the first device and the second device will switch to. Among them, the transmission speed of the second transmission protocol is better than that of the first transmission protocol. For example, the second transmission protocol is the RDMA protocol and the first transmission protocol is the TCP protocol, or the transmission speed of the second transmission protocol is lower than that of the first transmission protocol. For example, the second transmission protocol is the TCP protocol and the first transmission protocol is the RDMA protocol.
[0064] In the embodiments of the present application, the transmission speed can also be referred to as the transmission rate.
[0065] In some implementable manners, when the transmission speed of the second transmission protocol is better than that of the first transmission protocol: if both the first device and the second device support the first transmission protocol, and the first device and the second device allow data transmission through the second transmission protocol, then the first device determines that the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the first device and the second device; otherwise, the first device determines that the switching condition for switching from the first transmission protocol to the second transmission protocol is not satisfied between the first device and the second device. In other words, if the first device does not support the first transmission protocol, or the second device does not support the first transmission protocol, or the first device and the second device do not allow data transmission through the second transmission protocol, then the first device determines that the switching condition for switching from the first transmission protocol to the second transmission protocol is not satisfied between the first device and the second device.
[0066] For example, assume that the first transmission protocol is the TCP protocol, the second transmission protocol is the RDMA protocol, both the first device and the second device support the RDMA protocol, and the first device and the second device allow data transmission through the RDMA protocol. Then the first device determines that the switching condition for switching from the TCP protocol to the RDMA protocol is satisfied between the first device and the second device.
[0067] For example, assume that the first transmission protocol is the TCP protocol, the second transmission protocol is the RDMA protocol, and the first device does not support the RDMA protocol. Then the first device determines that the switching condition for switching from the TCP protocol to the RDMA protocol is not satisfied between the first device and the second device.
[0068] For example, assume that the first transmission protocol is the TCP protocol, the second transmission protocol is the RDMA protocol, and the second device does not support the RDMA protocol. Then the first device determines that the switching condition for switching from the TCP protocol to the RDMA protocol is not satisfied between the first device and the second device.
[0069] For example, assume that the first transport protocol is the TCP protocol and the second transport protocol is the RDMA protocol. Both the first device and the second device support the RDMA protocol, but the first device and the second device do not allow data transmission through the RDMA protocol. Then, the first device determines that the switching condition from the TCP protocol to the RDMA protocol is not met between the first device and the second device.
[0070] In some implementable ways, the first device may send the physical address of the first device and the first indication information indicating whether the first device supports the second transport protocol to the second device. Based on this, the second device determines whether the first device and the second device are allowed to perform data transmission through the second transport protocol according to the physical address of the first device and the physical address of the second device, and combines the first indication information and the situation of whether the second device itself supports the second transport protocol to indicate to the first device whether the switching condition from the first transport protocol to the second transport protocol is met between the first device and the second device.
[0071] For example, the first device indicates to the second device that the first device supports the RDMA protocol. The second device determines that the first device and the second device are allowed to perform data transmission through the RDMA protocol based on the physical address of the first device and its own physical address, and the second device also supports the RDMA protocol. Based on this, the second device indicates to the first device that the switching condition from the TCP protocol to the RDMA protocol is met between the first device and the second device.
[0072] For example, the first device indicates to the second device that the first device does not support the RDMA protocol. Based on this, the second device indicates to the first device that the switching condition from the TCP protocol to the RDMA protocol is not met between the first device and the second device.
[0073] For example, the first device indicates to the second device that the first device supports the RDMA protocol. The second device determines that the first device and the second device are not allowed to perform data transmission through the RDMA protocol based on the physical address of the first device and its own physical address. Based on this, the second device indicates to the first device that the switching condition from the TCP protocol to the RDMA protocol is not met between the first device and the second device.
[0074] For example, the first device indicates to the second device that the first device supports the RDMA protocol, while the second device does not support the RDMA protocol. Based on this, the second device indicates to the first device that the switching condition from the TCP protocol to the RDMA protocol is not met between the first device and the second device.
[0075] In some implementable manners, the second device may determine whether the first device and the second device are located in the same network area based on the physical address of the first device and the physical address of the second device. If the first device and the second device are located in the same network area, it is determined that the first device and the second device are allowed to perform data transmission through the second transmission protocol. If the first device and the second device are located in different network areas, it is determined that the first device and the second device are not allowed to perform data transmission through the second transmission protocol.
[0076] In some implementable manners, the physical address includes at least one of the following, but is not limited thereto: computer room identifier, rack identifier, computer room module identifier.
[0077] In some implementable manners, the second device may determine the network area corresponding to the physical address through the mapping relationship between the physical address and the network area. For example, as shown in Table 1:
[0078] Table 1
[0079] Physical address Network area Computer room 1 - Rack 01 - Computer room module 011 Network area A Computer room 1 - Rack 01 - Computer room module 012 Network area A Computer room 2 - Rack 01 - Computer room module 011 Network area B
[0080] In some implementable manners, the second device may determine whether the first device and the second device can reach within a preset number of hops based on the physical address of the first device and the physical address of the second device. If the first device and the second device can reach within a preset number of hops, it is determined that the first device and the second device are allowed to perform data transmission through the second transmission protocol. If the first device and the second device cannot reach within a preset number of hops, it is determined that the first device and the second device are not allowed to perform data transmission through the second transmission protocol.
[0081] For example, the first device and the second device can reach through 3 hops, but the preset number of hops is 5. In this case, it can be determined that the first device and the second device are allowed to perform data transmission through the second transmission protocol.
[0082] For example, the first device and the second device can reach through 6 hops, but the preset number of hops is 5. In this case, it can be determined that the first device and the second device are not allowed to perform data transmission through the second transmission protocol.
[0083] It should be understood that the embodiments of the present application do not limit how to determine whether the first device and the second device are located in the same network area based on the physical address of the first device and the physical address of the second device.
[0084] In some implementable ways, the second device may send the physical address of the second device and second indication information for indicating whether the second device supports the second transmission protocol to the first device. Based on this, the first device determines whether data transmission between the first device and the second device is allowed through the second transmission protocol according to the physical address of the first device and the physical address of the second device, and determines whether the switching condition for switching from the first transmission protocol to the second transmission protocol is met between the first device and the second device in combination with the second indication information and whether the first device itself supports the second transmission protocol.
[0085] For example, the second device indicates to the first device that the second device supports the RDMA protocol. Based on the physical address of the second device and its own physical address, the first device determines that data transmission between the first device and the second device is allowed through the RDMA protocol, and the first device also supports the RDMA protocol. Based on this, the first device determines that the switching condition for switching from the TCP protocol to the RDMA protocol is met between the first device and the second device.
[0086] For example, the second device indicates to the first device that the second device does not support the RDMA protocol. Based on this, the first device determines that the switching condition for switching from the TCP protocol to the RDMA protocol is not met between the first device and the second device.
[0087] For example, the second device indicates to the first device that the second device supports the RDMA protocol. Based on the physical address of the second device and its own physical address, the first device determines that data transmission between the first device and the second device is not allowed through the RDMA protocol. Based on this, the first device determines that the switching condition for switching from the TCP protocol to the RDMA protocol is not met between the first device and the second device.
[0088] For example, the second device indicates to the first device that the second device supports the RDMA protocol, but the first device does not support the RDMA protocol. Based on this, the first device determines that the switching condition for switching from the TCP protocol to the RDMA protocol is not met between the first device and the second device.
[0089] It should be understood that regarding how to determine whether the first device and the second device are in the same network area based on the physical address of the first device and the physical address of the second device, reference may be made to the above, and this is not elaborated in the embodiments of the present application.
[0090] In the embodiments of the present application, when the transmission speed of the second transmission protocol is better than that of the first transmission protocol, the first device may determine the second transmission protocol through the following implementable ways, but not limited thereto:
[0091] In some implementations, the first device selects at least one third transmission protocol with a transmission speed higher than that of the first transmission protocol from the transmission protocols supported by the first device; and uses the transmission protocol with the highest transmission speed among the at least one third transmission protocol as the second transmission protocol.
[0092] For example, assume that the transmission protocols supported by the first device include: TCP protocol, RDMA protocol, DPDK protocol, and the transmission speed of the RDMA protocol > DPDK protocol > TCP protocol. Assume that the first transmission protocol is the TCP protocol. The first device can use the transmission protocol with the highest transmission speed among the RDMA protocol and the DPDK protocol, that is, the RDMA protocol as the second transmission protocol.
[0093] In some implementations, the first device selects at least one third transmission protocol with a transmission speed higher than that of the first transmission protocol from the transmission protocols supported by the first device; and randomly selects a transmission protocol from the at least one third transmission protocol as the second transmission protocol.
[0094] For example, assume that the transmission protocols supported by the first device include: TCP protocol, RDMA protocol, DPDK protocol, and the transmission speed of the RDMA protocol > DPDK protocol > TCP protocol. Assume that the first transmission protocol is the TCP protocol. The first device can randomly select a protocol from the RDMA protocol and the DPDK protocol. If the RDMA protocol is selected, use the RDMA protocol as the second transmission protocol.
[0095] In some implementations, the first device selects at least one third transmission protocol with a higher priority than the first transmission protocol from the transmission protocols supported by the first device; and uses the transmission protocol with the highest priority among the at least one third transmission protocol as the second transmission protocol.
[0096] In some implementations, the user can set the priorities of the various transmission protocols of the device. Among them, for any transmission protocol, if its transmission speed is higher, its corresponding priority is higher, but it is not limited to this.
[0097] For example, assume that the transmission protocols supported by the first device include: TCP protocol, RDMA protocol, DPDK protocol, and the priority order is RDMA protocol > DPDK protocol > TCP protocol. Assume that the first transmission protocol is the TCP protocol. The first device can use the transmission protocol with the highest priority among the RDMA protocol and the DPDK protocol, that is, the RDMA protocol as the second transmission protocol.
[0098] In some implementations, the first device selects at least one third transmission protocol with a higher priority than the first transmission protocol from the transmission protocols supported by the first device; and randomly selects a transmission protocol from the at least one third transmission protocol as the second transmission protocol.
[0099] For example, assume that the transmission protocols supported by the first device include: TCP protocol, RDMA protocol, and DPDK protocol. Sorted by priority, it is RDMA protocol > DPDK protocol > TCP protocol. Assume that the first transmission protocol is the TCP protocol. The first device can randomly select one protocol from the RDMA protocol and the DPDK protocol. If the RDMA protocol is selected, the RDMA protocol is used as the second transmission protocol.
[0100] In some implementable ways, when the transmission speed of the second transmission protocol is lower than that of the first transmission protocol, if a data transmission exception occurs during data transmission through the first link, the first device determines that the switching condition for switching from the first transmission protocol to the second transmission protocol is met between the first device and the second device. If no data transmission exception occurs during data transmission through the first link, the first device determines that the switching condition for switching from the first transmission protocol to the second transmission protocol is not met between the first device and the second device.
[0101] For example, assume that the first transmission protocol is the RDMA protocol and the second transmission protocol is the TCP protocol. When data is transmitted between the first device and the second device using the RDMA protocol, a transmission timeout occurs. Then the first device determines that the switching condition for switching from the RDMA protocol to the TCP protocol is met between the first device and the second device.
[0102] For another example, assume that the first transmission protocol is the RDMA protocol and the second transmission protocol is the TCP protocol. When data is transmitted between the first device and the second device using the RDMA protocol, a network error occurs. Then the first device determines that the switching condition for switching from the RDMA protocol to the TCP protocol is met between the first device and the second device.
[0103] In the embodiments of the present application, when the transmission speed of the second transmission protocol is lower than that of the first transmission protocol, the first device can determine the second transmission protocol through the following implementable ways, but not limited to this:
[0104] In some implementable ways, the first device determines at least one fifth transmission protocol with a transmission speed lower than that of the first transmission protocol among the transmission protocols supported by the first device; and uses the transmission protocol with the highest transmission speed among the at least one fifth transmission protocol as the second transmission protocol.
[0105] For example, assume that the transmission protocols supported by the first device include: TCP protocol, RDMA protocol, and DPDK protocol, and the transmission speed is RDMA protocol > DPDK protocol > TCP protocol. Assume that the first transmission protocol is the RDMA protocol. The first device can use the transmission protocol with the highest transmission speed among the DPDK protocol and the TCP protocol, that is, the DPDK protocol as the second transmission protocol.
[0106] In some implementable ways, the first device determines at least one fifth transport protocol in the transport protocols supported by the first device, where the transmission speed of the at least one fifth transport protocol is lower than that of the first transport protocol; and randomly selects one transport protocol from the at least one fifth transport protocol as the second transport protocol.
[0107] For example, assume that the transport protocols supported by the first device include: TCP protocol, RDMA protocol, DPDK protocol, and the transmission speed of the RDMA protocol > DPDK protocol > TCP protocol. Assume that the first transport protocol is the RDMA protocol. The first device can randomly select one transport protocol from the DPDK protocol and the TCP protocol, such as the TCP protocol, and use it as the second transport protocol.
[0108] In some implementable ways, the first device determines at least one fifth transport protocol in the transport protocols supported by the first device, where the priority of the at least one fifth transport protocol is lower than that of the first transport protocol; and uses the transport protocol with the highest transmission speed among the at least one fifth transport protocols as the second transport protocol.
[0109] In some implementable ways, the user can set the priorities of the various transport protocols of the device. Among them, for any transport protocol, the higher its transmission speed, the higher its corresponding priority, but this is not limited to this.
[0110] For example, assume that the transport protocols supported by the first device include: TCP protocol, RDMA protocol, DPDK protocol, and sorted by priority: RDMA protocol > DPDK protocol > TCP protocol. Assume that the first transport protocol is the RDMA protocol. The first device can use the transport protocol with the highest priority among the DPDK protocol and the TCP protocol, that is, the DPDK protocol as the second transport protocol.
[0111] In some implementable ways, the first device determines at least one fifth transport protocol in the transport protocols supported by the first device, where the priority of the at least one fifth transport protocol is lower than that of the first transport protocol; and randomly selects one transport protocol from the at least one fifth transport protocols as the second transport protocol.
[0112] For example, assume that the transport protocols supported by the first device include: TCP protocol, RDMA protocol, DPDK protocol, and sorted by priority: RDMA protocol > DPDK protocol > TCP protocol. Assume that the first transport protocol is the RDMA protocol. The first device can randomly select one transport protocol from the DPDK protocol and the TCP protocol, such as the TCP protocol, and use it as the second transport protocol.
[0113] S320: The first device encapsulates the second link into the logical link between the first device and the second device;
[0114] In some implementable manners, after establishing a second link using a second transmission protocol between a first device and a second device, the first device may encapsulate the second link into a logical link between the first device and the second device.
[0115] In some implementable manners, a logical link is established between a first device and a second device; the first device obtains target information for calculating an identifier of the logical link; the first device calculates the identifier of the logical link based on the target information; the first device sends the target information to the second device so that the second device calculates the identifier of the logical link based on the target information; the second device calculates the identifier of the logical link based on the target information.
[0116] In some implementable manners, the target information includes at least one of the following, but is not limited thereto: the incrementing sequence number (client idx) of the client, the thread instance of the client, the container namespace of the client, the client address, and the server address.
[0117] Wherein, the first device and the second device may calculate the identifier of the logical link in the following manner, but is not limited thereto:
[0118] Hash(struct{client idx, thread instance, container namespce, clientaddress, server address})
[0119] Wherein, Hash(*) represents calculating the hash value of *, and in the embodiments of the present application, the client is the first device and the server is the second device.
[0120] It should be understood that the identifier of the logical link is used to uniquely identify the logical link, and the logical link can be determined through this identifier.
[0121] It should be understood that each time a new link is established between the first device and the second device, the first device may encapsulate the new link into the logical link.
[0122] In the embodiments of the present application, by encapsulating the link into the logical link, the user does not need to understand and master the transmission protocol. In other words, Figure 2 the provided components can be switched among multiple transmission protocols in a manner transparent to the user, thereby improving the user experience.
[0123] S330: If there is no data being transmitted on the first link using the first transmission protocol, or if there is data being transmitted on the first link and a forced switch instruction is obtained, the first device transmits data to the second device via the second link;
[0124] It should be understood that if the switching condition for switching from the first transmission protocol to the second transmission protocol is met between the first device and the second device, the first device transmits data to the second device via the second link.
[0125] For example, assume that the first transmission protocol is the TCP protocol, the second transmission protocol is the RDMA protocol, and the switching condition for switching from the TCP protocol to the RDMA protocol is met between the first device and the second device. Then the first device can transmit data to the second device via the RDMA link.
[0126] For another example, assume that the first transmission protocol is the RDMA protocol, the second transmission protocol is the TCP protocol, and the switching condition for switching from the RDMA protocol to the TCP protocol is met between the first device and the second device. Then the first device can transmit data to the second device via the TCP link.
[0127] In some implementable ways, before the second device receives the data transmitted by the first device via the second link, the second device can allocate a globally increasing identifier to the second link; and identify the second link through the globally increasing identifier corresponding to the second link.
[0128] For example, assume that the identifier corresponding to the first link is 1 and the identifier corresponding to the second link is 2. When the second device identifies the identifier 2 of the second link, it can determine that the second link is the latest link between the first device and the second device. Based on this, it can receive data via this second link and can close the first link between it and the first device.
[0129] It should be understood that each time a new link is established between the first device and the second device, the second device can allocate a globally increasing identifier to this new link and identify this new link through the globally increasing identifier corresponding to this new link.
[0130] It should be understood that the first device transmitting data to the second device via the second link includes: lossless data transmission and lossy data transmission.
[0131] Among them, lossless data transmission means that if there is no data being transmitted on the first link, the first device transmits data to the second device via the second link.
[0132] Lossy data transmission means that if there is data being transmitted on the first link and the first device receives a forced switch instruction, the first device transmits data to the second device via the second link. Herein, the request switch instruction is used to indicate a forced switch from the first transmission protocol to the second transmission protocol, or is used to indicate a forced switch from the first link to the second link.
[0133] In some implementable manners, if there is no data being transmitted on the first link, the first device may perform data transmission in a lossless data transmission manner; if there is data being transmitted on the first link, the first device may wait until the data transmission on the first link is completed and then transmit data to the second device via the second link, or if there is data being transmitted on the first link, the first device performs lossy data transmission.
[0134] S340: The first device closes the first link.
[0135] S350: The second device closes the first link.
[0136] It should be understood that the first device closing the first link is also referred to as the first device stopping using the first link, or the first device discarding the first link.
[0137] It should be understood that the second device closing the first link is also referred to as the second device stopping using the first link, or the second device discarding the first link.
[0138] It should be understood that the embodiments of the present application do not limit the execution order of S330 and S340. For example, the first device may first execute S330 and then execute S340, or may first execute S340 and then execute S330, or may execute S330 and S340 simultaneously. The embodiments of the present application do not limit the execution order of S340 and S350 either, nor do they limit the execution order of S330 and S350.
[0139] An embodiment of the present application provides a data transmission method, including: if the switching condition for switching from the first transmission protocol to the second transmission protocol is met between the first device and the second device, a second link using the second transmission protocol is established between the first device and the second device; the first device transmits data to the second device through the second link and closes the first link using the first transmission protocol. By means of this adaptive switching of the transmission protocol for data transmission, the transmission speed and communication quality can be taken into account. For example, when the first device and the second device are currently using the TCP protocol for data transmission and the switching condition from the TCP protocol to the RDMA protocol is met between them, the first device and the second device can establish an RDMA link and subsequently transmit data through the RDMA link. Since the RDMA protocol has a higher transmission speed than the TCP protocol, the data transmission speed can be increased using the RDMA protocol without affecting the communication quality. Another example is that when the first device and the second device are currently using the RDMA protocol for data transmission and there is an abnormal data transmission situation between them, based on this, the first device and the second device can establish a TCP link and subsequently transmit data through the TCP link. Although the TCP protocol has a lower transmission speed than the RDMA protocol, the communication quality can be guaranteed in this way.
[0140] Further, if there is no data being transmitted on the first link, the first device can use a lossless data transmission method for data transmission to ensure that the protocol switch is imperceptible to the user; if there is data being transmitted on the first link, the first device can wait for the data on the first link to be transmitted completely and then transmit data to the second device through the second link to ensure that the protocol switch is imperceptible to the user, or, if there is data being transmitted on the first link, the first device uses a lossy data transmission method for data transmission to meet the user's requirement for an immediate protocol switch.
[0141] In some implementable ways, when the transmission speed of the second transmission protocol is better than that of the first transmission protocol: if the switching condition for switching from the first transmission protocol to the second transmission protocol is not met between the first device and the second device, the first device continues to transmit data to the second device through the first link.
[0142] In some other implementable ways, when the transmission speed of the second transmission protocol is better than that of the first transmission protocol: if the switching condition from the first transmission protocol to the second transmission protocol is not satisfied between the first device and the second device, and there is at least one fourth transmission protocol whose transmission speed is between the first transmission protocol and the second transmission protocol, then the first device selects a target transmission protocol from the at least one fourth transmission protocol, takes the target transmission protocol as the new second transmission protocol, and continues to execute that if the switching condition from the first transmission protocol to the second transmission protocol is satisfied between the first device and the second device, then a second link using the second transmission protocol is established with the second device until data is transmitted through a link between the first device and the second device.
[0143] In some implementable ways, the first device takes the transmission protocol with the highest transmission speed among the at least one fourth transmission protocol as the target transmission protocol.
[0144] For example, assume that the transmission protocols supported by the first device include: TCP protocol, RDMA protocol, DPDK protocol, UDP protocol, and the transmission speed of RDMA protocol > DPDK protocol > UDP protocol > TCP protocol. Assume that the first transmission protocol is the TCP protocol and the second transmission protocol is the RDMA protocol, and assume that the switching condition from the TCP protocol to the RDMA protocol is not satisfied between the first device and the second device. Then the first device can select the transmission protocol with the highest transmission speed between the DPDK protocol and the UDP protocol, that is, the DPDK protocol as the target transmission protocol. Further, if the switching condition from the TCP protocol to the DPDK protocol is satisfied between the first device and the second device, then a fourth link using the DPDK protocol is established between the first device and the second device, and data is transmitted to the second device through the fourth link. If the switching condition from the TCP protocol to the DPDK protocol is not satisfied between the first device and the second device, then the first device can take the UDP protocol as the target transmission protocol. Further, if the switching condition from the TCP protocol to the UDP protocol is satisfied between the first device and the second device, then a fifth link using the UDP protocol is established between the first device and the second device, and data is transmitted to the second device through the fifth link. If the switching condition from the TCP protocol to the UDP protocol is not satisfied between the first device and the second device, then the first device and the second device continue to use the TCP protocol to transmit data.
[0145] In some other implementable ways, the first device randomly selects a transmission protocol from the at least one fourth transmission protocol as the target transmission protocol.
[0146] For example, assume that the transmission protocols supported by the first device include: TCP protocol, RDMA protocol, DPDK protocol, UDP protocol, and the transmission speed of the RDMA protocol > DPDK protocol > UDP protocol > TCP protocol. Assume that the first transmission protocol is the TCP protocol and the second transmission protocol is the RDMA protocol, and assume that the switching condition from the TCP protocol to the RDMA protocol is not met between the first device and the second device. Then the first device can randomly select a transmission protocol from the DPDK protocol and the UDP protocol. For example, if the UDP protocol is selected, the UDP protocol is used as the target transmission protocol. Further, if the switching condition from the TCP protocol to the UDP protocol is met between the first device and the second device, a sixth link using the UDP protocol is established between the first device and the second device, and data is transmitted to the second device through the sixth link. If the switching condition from the TCP protocol to the UDP protocol is not met between the first device and the second device, the first device can use the DPDK protocol as the target transmission protocol. Further, if the switching condition from the TCP protocol to the DPDK protocol is met between the first device and the second device, a seventh link using the DPDK protocol is established between the first device and the second device, and data is transmitted to the second device through the seventh link. If the switching condition from the TCP protocol to the DPDK protocol is not met between the first device and the second device, the first device and the second device continue to transmit data using the TCP protocol.
[0147] In some other implementable ways, when the transmission speed of the second transmission protocol is better than that of the first transmission protocol: if the switching condition from the first transmission protocol to the second transmission protocol is not met between the first device and the second device, and there is at least one fourth transmission protocol with a priority between the first transmission protocol and the second transmission protocol, the first device selects a target transmission protocol from at least one fourth transmission protocol, uses the target transmission protocol as the new second transmission protocol, and continues to execute. If the switching condition from the first transmission protocol to the second transmission protocol is met between the first device and the second device, a second link using the second transmission protocol is established with the second device until data is transmitted through a link between the first device and the second device.
[0148] It should be understood that the selection method of the target transmission protocol can refer to the above content, and the embodiments of the present application will not elaborate on this.
[0149] For example, assume that the transmission protocols supported by the first device include: TCP protocol, RDMA protocol, DPDK protocol, UDP protocol, and the transmission speeds are sorted by priority: RDMA protocol > DPDK protocol > UDP protocol > TCP protocol. Assume that the first transmission protocol is the TCP protocol and the second transmission protocol is the RDMA protocol, and assume that the switching condition from the TCP protocol to the RDMA protocol is not satisfied between the first device and the second device. Then the first device can select the transmission protocol with the highest priority between the DPDK protocol and the UDP protocol, that is, the DPDK protocol as the target transmission protocol. Further, if the switching condition from the TCP protocol to the DPDK protocol is satisfied between the first device and the second device, a fourth link using the DPDK protocol is established between the first device and the second device, and data is transmitted to the second device through the fourth link. If the switching condition from the TCP protocol to the DPDK protocol is not satisfied between the first device and the second device, the first device can use the UDP protocol as the target transmission protocol. Further, if the switching condition from the TCP protocol to the UDP protocol is satisfied between the first device and the second device, a fifth link using the UDP protocol is established between the first device and the second device, and data is transmitted to the second device through the fifth link. If the switching condition from the TCP protocol to the UDP protocol is not satisfied between the first device and the second device, the first device and the second device continue to transmit data using the TCP protocol.
[0150] In some implementable ways, when the transmission speed of the second transmission protocol is lower than that of the first transmission protocol, if the switching condition from the first transmission protocol to the second transmission protocol is not satisfied between the first device and the second device, the first device continues to transmit data to the second device through the first link.
[0151] For example, assume that data is transmitted between the first device and the second device using the RDMA protocol, and assume that the first transmission protocol is the RDMA protocol and the second transmission protocol is the TCP protocol, and data is transmitted between the first device and the second device using the RDMA protocol without any transmission anomalies, that is, the switching condition from the RDMA protocol to the TCP protocol is not satisfied between the first device and the second device. Then the first device continues to transmit data to the second device through the RDMA link.
[0152] In some implementable ways, if the current transmission protocol used between the first device and the second device is the transmission protocol with the lowest transmission speed among the transmission protocols supported by the first device, and a data transmission anomaly occurs when transmitting data through the current link using the current transmission protocol, a third link using the current transmission protocol is established between the first device and the second device; the first device transmits the data to be transmitted to the second device through the third link and closes the current link.
[0153] For example, assume that the current transmission protocol between the first device and the second device is a TCP connection, which is the transmission protocol with the lowest transmission speed among the transmission protocols supported by the first device. When a data transmission anomaly occurs during data transmission using this TCP connection, a new TCP connection is established between the first device and the second device. The first device transmits the data to be transmitted to the second device through the newly established TCP connection and closes the previous TCP connection.
[0154] In the embodiments of the present application, if the switching condition for switching from the first transmission protocol to the second transmission protocol is met between the first device and the second device, the first device and the second device can continue to use the first connection using the first transmission protocol for data transmission, or reselect a transmission protocol for data transmission. In addition, if the current transmission protocol between the first device and the second device is the transmission protocol with the lowest transmission speed among the transmission protocols supported by the first device, and a data transmission anomaly occurs during data transmission using the current connection of the current transmission protocol, a third connection using the current transmission protocol is established between the first device and the second device. The first device transmits the data to be transmitted to the second device through the third connection and closes the current connection. This can ensure that there is an available connection between the first device and the second device for data transmission, thereby ensuring the reliability of data transmission.
[0155] The preferred embodiments of the present application have been described in detail above in conjunction with the accompanying drawings. However, the present application is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present application, various simple modifications can be made to the technical solutions of the present application, and these simple modifications all fall within the protection scope of the present application. For example, in the various specific technical features described in the above specific embodiments, they can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the present application does not separately describe various possible combination methods. Another example is that any combination can be made between various different embodiments of the present application as long as it does not violate the idea of the present application, and it should also be regarded as the content disclosed by the present application.
[0156] It should also be understood that in the various method embodiments of the present application, the magnitudes of the sequence numbers of the above processes do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0157] The method provided by the embodiments of the present application has been described above. Next, the data transmission device provided by the embodiments of the present application will be described.
[0158] Figure 4 A schematic diagram of a data transmission device 400 provided by the embodiments of the present application is shown in Figure 4As shown, the device 400 includes: a processing module 410 and a communication module 420; wherein, the processing module 410 is configured to establish a second link using the second transmission protocol with the second device if a switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the data transmission device and the second device; the processing module 410 is further configured to encapsulate the second link into the logical link between the data transmission device and the second device; the communication module 420 is configured to transmit data to the second device through the second link if there is no data being transmitted on the first link using the first transmission protocol, or if there is data being transmitted on the first link and a forced switching instruction is obtained; the processing module 410 is further configured to close the first link.
[0159] In some implementable manners, the processing module 410 is further configured to: establish a logical link with the second device before the processing module 410 encapsulates the second link into the logical link between the data transmission device and the second device; obtain target information for calculating the identifier of the logical link; calculate the identifier of the logical link based on the target information; the communication module 420 is further configured to send the target information to the second device so that the second device calculates the identifier of the logical link based on the target information.
[0160] In some implementable manners, the transmission speed of the second transmission protocol is superior to that of the first transmission protocol; the processing module 410 is further configured to: determine that the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the data processing device and the second device if both the data transmission device and the second device support the first transmission protocol and the data processing device and the second device allow data transmission through the second transmission protocol; otherwise, determine that the switching condition for switching from the first transmission protocol to the second transmission protocol is not satisfied between the data processing device and the second device.
[0161] In some implementable manners, the processing module 410 is further configured to: select at least one third transmission protocol with a transmission speed higher than that of the first transmission protocol from the transmission protocols supported by the data processing device; use the transmission protocol with the highest transmission speed among the at least one third transmission protocol as the second transmission protocol.
[0162] In some implementable manners, the communication module 420 is further configured to: continue to transmit data to the second device through the first link if the switching condition for switching from the first transmission protocol to the second transmission protocol is not satisfied between the data processing device and the second device.
[0163] In some implementable manners, the processing module 410 is further configured to: if the switching condition for switching from the first transmission protocol to the second transmission protocol is not satisfied between the data processing device and the second device, and there is at least one fourth transmission protocol whose transmission speed is between the first transmission protocol and the second transmission protocol, select a target transmission protocol from the at least one fourth transmission protocol, use the target transmission protocol as the new second transmission protocol, and continue to execute that if the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the data processing device and the second device, establish a second link using the second transmission protocol with the second device until data is transmitted through a link between the data processing device and the second device.
[0164] In some implementable manners, the processing module 410 is specifically configured to: use the transmission protocol with the highest transmission speed among the at least one fourth transmission protocol as the target transmission protocol.
[0165] In some implementable manners, the transmission speed of the second transmission protocol is lower than that of the first transmission protocol; the processing module 410 is further configured to: if a data transmission exception occurs during data transmission through the first link, determine that the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the data processing device and the second device.
[0166] In some implementable manners, the processing module 410 is further configured to: determine at least one fifth transmission protocol whose transmission speed is lower than that of the first transmission protocol among the transmission protocols supported by the data processing device; use the transmission protocol with the highest transmission speed among the at least one fifth transmission protocol as the second transmission protocol.
[0167] In some implementable manners, the processing module 410 is further configured to: if the current transmission protocol used between the data processing device and the second device is the transmission protocol with the lowest transmission speed among the transmission protocols supported by the data processing device, and a data transmission exception occurs during data transmission through the current link using the current transmission protocol, establish a third link using the current transmission protocol with the second device; the communication module 420 is further configured to: transmit the data to be transmitted to the second device through the third link, and the processing module 410 is further configured to close the current link.
[0168] It should be understood that the device embodiments and the method embodiments can correspond to each other, and similar descriptions can refer to the method embodiments. To avoid repetition, they will not be elaborated here. Specifically, Figure 4 The illustrated device can execute the method embodiments corresponding to the above first device, and the foregoing and other operations and / or functions of each module in the device respectively implement the corresponding processes in the above various methods. For the sake of brevity, they will not be elaborated here.
[0169] The device according to the embodiments of the present application has been described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that the functional modules can be implemented in the form of hardware, or in the form of instructions in software, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in the present application can be completed by the integrated logic circuit in the hardware in the processor and / or instructions in the form of software. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps in the above method embodiments.
[0170] Figure 5 FIG. is a schematic diagram of a data transmission device 500 provided by an embodiment of the present application. As Figure 5 shown, the device 500 includes a processing module 510 and a communication module 520. Among them, the processing module 510 is used to establish a second link using a second transmission protocol with a first device; wherein, the establishment of the second link is initiated by the first device when it determines that the switching condition for switching from the first transmission protocol to the second transmission protocol is met between the first device and the data processing device; and the second link is encapsulated into the logical link between the first device and the data transmission device; the communication module 520 is used to receive, through the second link, data that the first device is not transmitting on a first link using the first transmission protocol, or data transmitted when there is data being transmitted on the first link and a forced switching instruction is obtained; the processing module 510 is further used to close the first link.
[0171] In some implementable manners, the processing module 510 is further used to establish a logical link with the first device; the communication module 520 is further used to receive target information for calculating an identifier of the logical link; the processing module 510 is further used to calculate the identifier of the logical link based on the target information.
[0172] In some implementable manners, the processing module 510 is further used to: before the communication module 520 receives data transmitted by the first device through the second link, allocate a globally increasing identifier to the second link; identify the second link through the globally increasing identifier corresponding to the second link.
[0173] It should be understood that the device embodiments and the method embodiments can correspond to each other, and similar descriptions can refer to the method embodiments. To avoid repetition, they will not be elaborated here. Specifically, Figure 5The device shown can execute the method embodiments corresponding to the above-mentioned second device, and the foregoing and other operations and / or functions of each module in the device respectively implement the corresponding processes in the above-mentioned various methods. For the sake of brevity, they will not be described herein again.
[0174] In the foregoing, the device of the embodiments of the present application has been described from the perspective of functional modules in combination with the accompanying drawings. It should be understood that the functional modules can be implemented in the form of hardware, or in the form of instructions in software, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in the embodiments of the present application can be completed by the integrated logic circuit in the hardware in the processor and / or instructions in the form of software. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps in the above method embodiments.
[0175] Figure 6 It is a schematic block diagram of an electronic device provided by an embodiment of the present application.
[0176] As Figure 6 shown, the electronic device may include:
[0177] A memory 610 and a processor 620. The memory 610 is used to store a computer program and transmit the program code to the processor 620. In other words, the processor 620 can call and run the computer program from the memory 610 to implement the method in the embodiments of the present application.
[0178] For example, the processor 620 can be used to execute the above method embodiments according to the instructions in the computer program.
[0179] In some embodiments of the present application, the processor 620 may include but is not limited to:
[0180] A general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and so on.
[0181] In some embodiments of the present application, the memory 610 includes, but is not limited to:
[0182] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double DataRate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), synch link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0183] In some embodiments of the present application, the computer program can be divided into one or more modules, and the one or more modules are stored in the memory 610 and executed by the processor 620 to complete the method provided by the present application. The one or more modules can be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.
[0184] As Figure 6 shown, the electronic device may further include:
[0185] A transceiver 630, and the transceiver 630 can be connected to the processor 620 or the memory 610.
[0186] Among them, the processor 620 can control the transceiver 630 to communicate with other devices. Specifically, it can send information or data to other devices, or receive information or data sent by other devices. The transceiver 630 can include a transmitter and a receiver. The transceiver 630 may further include an antenna, and the number of antennas can be one or more.
[0187] It should be understood that the various components in the electronic device are connected through a bus system. Among them, the bus system includes, in addition to the data bus, a power bus, a control bus, and a status signal bus.
[0188] This application also provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a computer, the computer can execute the methods in the above method embodiments. Or rather, the embodiments of this application also provide a computer program product containing instructions. When the instructions are executed by a computer, the computer executes the methods in the above method embodiments.
[0189] When implemented using software, it can be fully or partially implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of this application are fully or partially generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, a computer, a server, or a data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or a data center that integrates one or more available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital video disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)), etc.
[0190] Those of ordinary skill in the art can realize that the modules and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0191] In several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the devices or modules can be in electrical, mechanical, or other forms.
[0192] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical modules, that is, they can be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, in each embodiment of the present application, the various functional modules can be integrated in a processing module, or each module can exist physically alone, or two or more modules can be integrated in one module.
[0193] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A data transmission method, characterized in that, The method is applied to a first device, and the method includes: If a switching condition for switching from a first transmission protocol to a second transmission protocol is satisfied between the first device and a second device, establish a second link using the second transmission protocol with the second device; Encapsulate the second link into a logical link between the first device and the second device; If there is no data being transmitted on a first link using the first transmission protocol, or if there is data being transmitted on the first link and a forced switching instruction is obtained, transmit data to the second device through the second link and close the first link.
2. The method according to claim 1, characterized in that, Before encapsulating the second link into the logical link between the first device and the second device, it further includes: Establish the logical link with the second device; Obtain target information for calculating an identifier of the logical link; Calculate the identifier of the logical link based on the target information; Send the target information to the second device so that the second device calculates the identifier of the logical link based on the target information.
3. The method according to claim 1 or 2, characterized in that, The transmission speed of the second transmission protocol is better than that of the first transmission protocol; the method further includes: If both the first device and the second device support the first transmission protocol, and the first device and the second device allow data transmission through the second transmission protocol, determine that the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the first device and the second device; Otherwise, determine that the switching condition for switching from the first transmission protocol to the second transmission protocol is not satisfied between the first device and the second device.
4. The method according to claim 3, wherein It further includes: Select at least one third transmission protocol with a transmission speed higher than that of the first transmission protocol from the transmission protocols supported by the first device; Use the transmission protocol with the highest transmission speed among the at least one third transmission protocol as the second transmission protocol.
5. The method according to claim 3, wherein It further includes: If the switching condition for switching from the first transmission protocol to the second transmission protocol is not satisfied between the first device and the second device, continue to transmit data to the second device through the first link.
6. The method according to claim 3, characterized in that, It further includes: If the switching condition for switching from the first transmission protocol to the second transmission protocol is not satisfied between the first device and the second device, and there is at least one fourth transmission protocol with a transmission speed between the first transmission protocol and the second transmission protocol, select a target transmission protocol from the at least one fourth transmission protocol, use the target transmission protocol as the new second transmission protocol, and continue to execute If the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the first device and the second device, establish a second link using the second transmission protocol with the second device until data is transmitted through a link between the first device and the second device.
7. The method according to claim 6, characterized in that, The selecting a target transmission protocol from the at least one fourth transmission protocol includes: Use the transmission protocol with the highest transmission speed among the at least one fourth transmission protocol as the target transmission protocol.
8. The method according to claim 1 or 2, characterized in that, The transmission speed of the second transmission protocol is lower than that of the first transmission protocol; the method further includes: If a data transmission exception occurs during data transmission through the first link, it is determined that the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the first device and the second device.
9. The method according to claim 8, characterized in that, It further includes: Determine at least one fifth transmission protocol with a transmission speed lower than that of the first transmission protocol among the transmission protocols supported by the first device; Use the transmission protocol with the highest transmission speed among the at least one fifth transmission protocols as the second transmission protocol.
10. The method according to claim 1 or 2, characterized in that, It further includes: If the current transmission protocol adopted between the first device and the second device is the transmission protocol with the lowest transmission speed among the transmission protocols supported by the first device, and a data transmission exception occurs during data transmission through the current link using the current transmission protocol, then establish a third link using the current transmission protocol with the second device; Transmit the data to be transmitted to the second device through the third link and close the current link.
11. A data transmission method, characterized in that, The method is applied to a second device, and the method includes: Establish a second link using the second transmission protocol with a first device; wherein, the establishment of the second link is initiated by the first device when it is determined that the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the first device and the second device; and the second link is encapsulated into the logical link between the first device and the second device; Receive, through the second link, data that the first device is not transmitting on the first link using the first transmission protocol, or data transmitted upon obtaining a forced switching instruction when there is data being transmitted on the first link, and close the first link.
12. The method according to claim 11, wherein It further includes: Establish the logical link with the first device; Receive target information for calculating the identifier of the logical link; Calculate the identifier of the logical link based on the target information.
13. The method according to claim 11 or 12, characterized in that, Before receiving the data transmitted by the first device through the second link, it further includes: Assign a globally incrementing identifier to the second link; Identify the second link through the globally incrementing identifier corresponding to the second link.
14. A data transmission device, characterized in that, It includes: A processing module and a communication module; The processing module is used to establish a second link using the second transmission protocol with the second device if the switching condition for switching from the first transmission protocol to the second transmission protocol is satisfied between the data transmission device and the second device; The processing module is further used to encapsulate the second link into the logical link between the data transmission device and the second device; The communication module is used to transmit data to the second device through the second link if there is no data being transmitted on the first link using the first transmission protocol, or if there is data being transmitted on the first link and a forced switching instruction is obtained; The processing module is further used to close the first link.
15. A data transmission device, characterized in that, It includes: A processing module and a communication module; The processing module is used to establish a second link with the first device using a second transmission protocol; wherein, the establishment of the second link is initiated by the first device when it determines that the switching condition for switching from the first transmission protocol to the second transmission protocol between the first device and the data transmission device is met; and the second link is encapsulated into the logical link between the first device and the data transmission device; The communication module is used to receive, via the second link, data that is not being transmitted on the first link of the first device using the first transmission protocol, or data transmitted upon obtaining a forced switching instruction when there is data being transmitted on the first link; The processing module is further used to close the first link.
16. An electronic device, characterized in that, Comprising: A processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method according to any one of claims 1 to 13.
17. A computer-readable storage medium, characterized in that, For storing a computer program, which causes a computer to execute the method according to any one of claims 1 to 13.