WO2020151449A1 - 基于quic协议栈的数据处理方法、系统、设备及存储介质 - Google Patents
基于quic协议栈的数据处理方法、系统、设备及存储介质 Download PDFInfo
- Publication number
- WO2020151449A1 WO2020151449A1 PCT/CN2019/128464 CN2019128464W WO2020151449A1 WO 2020151449 A1 WO2020151449 A1 WO 2020151449A1 CN 2019128464 W CN2019128464 W CN 2019128464W WO 2020151449 A1 WO2020151449 A1 WO 2020151449A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- threads
- worker
- connection identifier
- worker threads
- thread
- Prior art date
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 18
- 238000000034 method Methods 0.000 claims abstract description 40
- 230000008569 process Effects 0.000 claims abstract description 30
- 238000010586 diagram Methods 0.000 description 8
- 238000013507 mapping Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 4
- 230000007547 defect Effects 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/164—Adaptation or special uses of UDP protocol
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/146—Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/02—Protocol performance
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/30—Definitions, standards or architectural aspects of layered protocol stacks
- H04L69/32—Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
- H04L69/322—Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
- H04L69/326—Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the transport layer [OSI layer 4]
Definitions
- This application relates to the field of computer technology, and in particular to a data processing method, system, computer equipment and computer-readable storage medium based on the QUIC protocol stack.
- QUIC Quic UDP Internet Connections
- UDP User Datagram Protocol
- Google has many advantages, such as reducing connection delay and avoiding head-of-line blocking.
- a QUIC protocol stack is configured in the server, and all server programs share the QUIC protocol stack.
- the related technology has at least the following defects: usually the CPU used in the server has multiple cores, and a single QUIC protocol stack configured for the server in the prior art processes data at the same time When only one of the cores of the CPU can be used, the multi-core feature of the CPU cannot be fully utilized and this core of the CPU is easily overloaded; and when processing data, all data must be processed by the single QUIC protocol stack, resulting in concurrency The number of connections is very low.
- the purpose of this application is to provide a data processing method, system, computer equipment, and computer-readable storage medium based on the QUIC protocol stack, which are used to solve the problem of under-utilizing the multi-core characteristics of the CPU caused by configuring a single QUIC protocol stack for the server in the prior art , A certain core of the CPU is overloaded and the number of concurrent connections is too low.
- One aspect of the present application provides a data processing method based on the QUIC protocol stack.
- the method includes: obtaining a connection identifier of a data packet; determining a server program for processing the data packet, wherein the server program includes multiple The worker thread, the worker thread runs the QUIC protocol stack; based on the connection identifier, the corresponding worker thread is determined from the plurality of worker threads; and the data packet is distributed to the corresponding worker thread, so that the corresponding work
- the QUIC protocol stack on the thread processes the aforementioned data packets.
- the foregoing determination of the corresponding worker thread from the plurality of worker threads based on the foregoing connection identifier includes: determining the number of threads of the foregoing multiple worker threads; and, based on the foregoing connection identifier and the foregoing number of threads, from The corresponding worker thread is determined among the multiple worker threads.
- the determination of the corresponding worker thread from the multiple worker threads based on the connection identifier and the number of threads includes: performing a modulo operation on the connection identifier and the number of threads to obtain the modulus Result; and determine the worker thread corresponding to the modulo result from the above-mentioned multiple worker threads.
- determining the corresponding worker thread from the multiple worker threads based on the connection identifier includes: querying whether the connection identifier corresponds to any one of the multiple worker threads; and If the connection identifier does not correspond to any one of the multiple worker threads, the corresponding worker thread is determined from the multiple worker threads.
- determining the corresponding worker thread from the multiple worker threads includes: if the connection identifier does not Corresponding to any one of the multiple worker threads, the number of first data packets corresponding to each of the multiple worker threads is determined to obtain the number of multiple first data packets; from the multiple first data packets Determine the number of first data packets with the smallest value from the number; and determine the worker thread corresponding to the number of first data packets with the smallest value from the multiple worker threads.
- determining the corresponding worker thread from the multiple worker threads includes: if the connection identifier does not Corresponding to any one of the above-mentioned multiple working threads, the preset weight of each of the above-mentioned multiple working threads is obtained, and multiple preset weights are obtained; the first corresponding to each of the above-mentioned multiple working threads is determined Second data packet quantity to obtain multiple second data packet quantities; and based on the multiple preset weights and the multiple second data packet quantities, the corresponding working thread is determined from the multiple working threads.
- the aforementioned QUIC protocol stack is used to parse or encapsulate the aforementioned data packet according to the QUIC protocol.
- Another aspect of the application also provides a data processing system based on the QUIC protocol stack.
- the above system includes: an acquisition module for acquiring a connection identifier of a data packet; and a first determining module for determining whether to process the data packet.
- the server program wherein the server program includes a plurality of worker threads, the worker thread runs the QUIC protocol stack; the second determining module is used to determine the corresponding work from the plurality of worker threads based on the connection identifier Thread; and a distribution module, configured to distribute the data packet to the corresponding worker thread, so that the QUIC protocol stack on the corresponding worker thread processes the data packet.
- Another aspect of the present application provides a computer device, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor.
- the processor is used for executing the computer-readable instructions The following steps are implemented: obtaining the connection identifier of the data packet; determining a server program for processing the data packet, wherein the server program includes a plurality of worker threads, and the worker threads run the QUIC protocol stack; based on the Connection identifier, determine the corresponding worker thread from the multiple worker threads; and distribute the data packet to the corresponding worker thread, so that the QUIC protocol stack on the corresponding worker thread processes the data package.
- Another aspect of the present application provides a computer-readable storage medium on which computer-readable instructions are stored.
- the computer-readable instructions When the computer-readable instructions are executed by a processor, they are used to implement the following steps: obtain the connection identifier of the data packet; determine A server program for processing the data packet, wherein the server program includes a plurality of worker threads, and the worker thread runs a QUIC protocol stack; based on the connection identifier, it is determined from the plurality of worker threads Output a corresponding worker thread; and distribute the data packet to the corresponding worker thread, so that the QUIC protocol stack on the corresponding worker thread processes the data packet.
- the data processing method based on the QUIC protocol stack divides the server program used to process data packets into multiple different worker threads, and configures a QUIC protocol stack for each worker thread.
- First assign a connection identifier to the data packet and then find the corresponding worker thread through the connection identifier, thereby distributing the data packet to the corresponding worker thread, so that the QUIC protocol stack running on the corresponding worker thread can process The packet.
- each worker thread can independently use its own QUIC protocol stack to process data packets at the same time, making full use of the multi-core characteristics of the CPU and improving the system
- the number of concurrent connections in the prior art avoids the shortcomings in the prior art that the configuration of a single QUIC protocol stack for the server causes the multi-core feature of the CPU to be underutilized, a certain core of the CPU is overloaded, and the number of concurrent connections is too low.
- Fig. 1 schematically shows a flowchart of a data processing method based on a QUIC protocol stack according to an embodiment of the present application
- Fig. 2 schematically shows a schematic diagram of a data processing solution based on the QUIC protocol stack according to an embodiment of the present application
- Fig. 3 schematically shows a structure diagram of a QUIC data packet according to an embodiment of the present application
- Fig. 4 schematically shows a block diagram of a data processing system based on a QUIC protocol stack according to an embodiment of the present application.
- FIG. 5 schematically shows a schematic diagram of the hardware architecture of a computer device suitable for implementing a data processing method based on the QUIC protocol stack according to an embodiment of the present application.
- the data processing method based on the QUIC protocol stack divides the server program used to process data packets into multiple different worker threads, and configures a QUIC protocol stack for each worker thread.
- First assign a connection identifier to the data packet and then find the corresponding worker thread through the connection identifier, thereby distributing the data packet to the corresponding worker thread, so that the QUIC protocol stack running on the corresponding worker thread can process The packet.
- each worker thread can independently use its own QUIC protocol stack to process data packets at the same time, making full use of the multi-core characteristics of the CPU and improving the system The number of concurrent connections.
- Fig. 1 schematically shows a flowchart of a data processing method based on a QUIC protocol stack according to an embodiment of the present application.
- the data processing method based on the QUIC protocol stack may include steps S101 to S104, wherein:
- Step S101 Obtain the connection identifier of the data packet.
- the data packet may include a UDP data packet, each data packet corresponds to a connection identifier, and the connection identifiers corresponding to different data packets may be the same.
- the connection identifier may include CID (Connection ID, also known as connection ID).
- Step S102 Determine a server program for processing the data packet, where the server program includes multiple worker threads, and the worker threads run a QUIC protocol stack.
- the server program can be divided into multiple different working threads in advance, and a QUIC protocol stack can be configured for each working thread, where the QUIC protocol stack is used to parse data packets according to the QUIC protocol Or package.
- Step S103 Based on the connection identifier, a corresponding worker thread is determined from multiple worker threads.
- determining the corresponding worker thread from multiple worker threads may include three strategies, which are specifically as follows.
- the first strategy is specifically to determine the number of threads of multiple worker threads; and to determine the corresponding worker thread from the multiple worker threads based on the connection identifier and the number of threads.
- determining the corresponding worker thread from multiple worker threads based on the connection identifier and the number of threads may include: modulo the connection identifier and the number of threads to obtain the modulo result; and determining from the multiple worker threads The worker thread corresponding to the modulo result.
- connection identifier is 9, the number of threads is 10, and the modulo result is 9, the 9th worker thread can be used as the corresponding worker thread.
- each worker thread is preset with a mapping identifier
- the mapping identifier of the fourth worker thread is 9, and the modulus result is 9, which exactly corresponds to the mapping identifier 9, then the fourth worker thread can be used as the corresponding Working thread.
- the second strategy can be used, also known as the load balancing mapping strategy. Specifically, query whether the connection identifier corresponds to any one of the multiple worker threads; and if the connection identifier does not correspond to any one of the multiple worker threads, then determine the corresponding one from the multiple worker threads Worker thread.
- determining the corresponding worker thread from the multiple worker threads may include: if the connection identifier does not correspond to any one of the multiple worker threads For thread correspondence, the number of first data packets corresponding to each of the multiple worker threads is determined to obtain the number of multiple first data packets; the number of first data packets with the smallest value is determined from the number of multiple first data packets; And the worker thread corresponding to the first data packet quantity with the smallest value is determined from the multiple worker threads.
- connection identification 9 the data packet corresponding to connection identification 9 has been sent to the ninth worker thread before, and the data packet with connection identification 9 that will still appear in the future also needs to be distributed to the ninth worker thread.
- the strategy described in this application does not meet the above mechanism, data packets corresponding to the same connection identifier may be distributed to different worker threads, which will inevitably cause some data packet connections to fail, thereby increasing the load and retransmission ratio.
- Using the mechanism described in this application can avoid the above-mentioned defects and reduce the load and retransmission ratio.
- the first data packet quantity of the data packet corresponding to each worker thread can be determined first, and then the first data packet with the smallest value can be found.
- the number of data packets, and the worker thread corresponding to the first number of data packets with the smallest value is used as the worker thread corresponding to the current connection identifier.
- the connection identifier has not matched any worker thread before, and the number of data packets corresponding to the first worker thread is 4, and the number of data packets corresponding to the second worker thread The number of the first data packet is 2, and the number of the first data packet of the data packet corresponding to the third worker thread is 5. Then the second worker thread can be used as the worker thread corresponding to the connection identifier.
- the third strategy is also called the weight mapping strategy. Specifically, the third strategy can also be to first query whether the connection identifier corresponds to any one of the multiple worker threads; and if the connection identifier does not correspond to any one of the multiple worker threads, then The corresponding worker thread is determined among the worker threads.
- determining the corresponding worker thread from the multiple worker threads may include: if the connection identifier does not correspond to any one of the multiple worker threads
- the preset weight of each of the multiple worker threads is obtained to obtain multiple preset weights
- the number of second data packets corresponding to each of the multiple worker threads is determined to obtain the number of multiple second data packets
- determine the corresponding work thread from the multiple work threads based on multiple preset weights and multiple second data packet quantities.
- the connection identifier has not matched any worker thread before, and the preset weight of the first worker thread is 1, the number of the first data packet corresponding to the data packet is 3, and the second The preset weight of each worker thread is 2, the first data packet quantity of the corresponding data packet is 4, the preset weight of the third worker thread is 3, and the first data packet quantity of the corresponding data packet is 6.
- the ratio of the first data packet number of the data packets corresponding to each worker thread can be maintained at the respective preset weight ratio, that is, 1:2:3, try to be on the worker threads other than the first worker thread Drop the data packet, that is, any one of the second worker thread and the third worker thread can be used as the worker thread corresponding to the connection identifier.
- Step S104 Distribute the data packet to the corresponding worker thread, so that the QUIC protocol stack on the corresponding worker thread processes the data packet.
- distributing the data packet to the corresponding worker thread may actually be distributing the data packet to the QUIC protocol station on the worker thread, so that the QUIC protocol stack can perform the data packet according to the QUIC protocol.
- Parsing or encapsulation, where the data packet processed by the QUIC protocol stack can be called a QUIC data packet.
- the data processing method based on the QUIC protocol stack divides the server program used to process data packets into multiple different worker threads, and configures a QUIC protocol stack for each worker thread.
- First assign a connection identifier to the data packet and then find the corresponding worker thread through the connection identifier, thereby distributing the data packet to the corresponding worker thread, so that the QUIC protocol stack running on the corresponding worker thread can process The packet.
- each worker thread can independently use its own QUIC protocol stack to process data packets at the same time, making full use of the multi-core characteristics of the CPU and improving the system
- the number of concurrent connections in the prior art avoids the shortcomings in the prior art that the configuration of a single QUIC protocol stack for the server causes the multi-core feature of the CPU to be underutilized, a certain core of the CPU is overloaded, and the number of concurrent connections is too low.
- Fig. 2 schematically shows a schematic diagram of a data processing solution based on the QUIC protocol stack according to an embodiment of the present application.
- the embodiment of the present application can receive data packets (such as UDP data packets) from the client through the Recvfrom function on the main thread, and then arrange the data packets in order in the network packet receiving FIFO (First Input First Output, In the (also called first-in-first-out) queue, the CID is further allocated by the Worker Manager, and then the corresponding worker thread is determined by any one of the strategies in the foregoing embodiments, and the data packet is put on the worker thread.
- each worker thread runs the HTTP parser, TLS (Transport Layer Security, also known as the Transport Layer Security Protocol), and QUIC protocol stack.
- the HTTP parser can provide request and response reports.
- TLS The purpose of the text analysis function, TLS is to provide security and data integrity guarantee for Internet communication, and the QUIC protocol stack is used to parse or encapsulate the data packet according to the QUIC protocol.
- UDP data packets Take UDP data packets as an example.
- UDP data packets delivered they can be processed by the QUIC protocol stack and parsed into QUIC data packets.
- the QUIC data packets are parsed by the HTTP parser and then passed on Process inside the system.
- the data that the system needs to send out can be encapsulated into QUIC data packets through the HTTP parser, TLS, and QUIC protocol stack of the worker thread, and then queued out, and then sent by the main thread through the network packet FIFO queue in turn To the client.
- Fig. 3 schematically shows a structure diagram of a QUIC data packet according to an embodiment of the present application.
- Flags occupies 8 bits and can be used to characterize the flag bits of the QUIC data packet.
- Flags can be used to indicate that the QUIC data packet is a connection establishment data packet or a handshake data packet.
- the Connection ID occupies 64 bits and can be used to characterize a network connection.
- Type-Dependent Fields can store different structures corresponding to the data packets represented by Flags. For example, if Flags is used to indicate that the QUIC data packet is a connection establishment data packet, the Type-Dependent Fields can store the data structure related to the establishment of the connection. Among them, (*) can indicate that Type-Dependent Fields do not necessarily exist in the QUIC data packet.
- Fig. 4 schematically shows a block diagram of a data processing system based on a QUIC protocol stack according to an embodiment of the present application.
- the data processing system 400 based on the QUIC protocol stack may include an acquisition module 410, a first determination module 420, a second determination module 430, and a distribution module 440, where:
- the obtaining module 410 is used to obtain the connection identifier of the data packet.
- the first determining module 420 is used to determine a server program for processing data packets, where the server program includes multiple worker threads, and the worker threads run a QUIC protocol stack.
- the second determining module 430 is configured to determine a corresponding worker thread from multiple worker threads based on the connection identifier.
- the distribution module 440 is configured to distribute the data packet to the corresponding worker thread, so that the QUIC protocol stack on the corresponding worker thread processes the data packet.
- the data processing system based on the QUIC protocol stack divides the server program used to process data packets into multiple different worker threads, and configures a QUIC protocol stack for each worker thread.
- First assign a connection identifier to the data packet and then find the corresponding worker thread through the connection identifier, thereby distributing the data packet to the corresponding worker thread, so that the QUIC protocol stack running on the corresponding worker thread can process The packet.
- each worker thread can independently use its own QUIC protocol stack to process data packets at the same time, making full use of the multi-core characteristics of the CPU and improving the system
- the number of concurrent connections avoids the disadvantages in the prior art that the configuration of a single QUIC protocol stack for the server causes the multi-core feature of the CPU to be underutilized, a certain core of the CPU is overloaded, and the number of concurrent connections is too low.
- the second determining module may include: a first determining unit for determining the number of threads of multiple worker threads; and a second determining unit for determining the number of threads from multiple worker threads based on the connection identifier and the number of threads The corresponding worker thread is determined from the worker thread.
- the second determining unit may include: an arithmetic subunit for performing a modulo operation on the connection identifier and the number of threads to obtain a modulo result; and a first determining subunit for obtaining a modulo result from multiple The worker thread corresponding to the modulo result is determined from the worker thread.
- the second determining module may include: a query unit for querying whether the connection identifier corresponds to any one of the multiple worker threads; and a third determining unit for checking the connection identifier If there is no correspondence with any one of the multiple worker threads, the corresponding worker thread is determined from the multiple worker threads.
- the third determining unit may include: a second determining subunit, configured to determine among the multiple worker threads when the connection identifier does not correspond to any one of the multiple worker threads The number of first data packets corresponding to each working thread is used to obtain the number of multiple first data packets; the third determining subunit is used to determine the number of first data packets with the smallest value from the number of multiple first data packets; and The fourth determining subunit is used to determine the worker thread corresponding to the first data packet quantity with the smallest value from the multiple worker threads.
- the third determining unit may include: an obtaining subunit, which is used to obtain each work of the multiple worker threads when the connection identifier does not correspond to any one of the multiple worker threads.
- the preset weight of the thread obtains multiple preset weights;
- the fifth determining subunit is used to determine the number of second data packets corresponding to each of the multiple work threads to obtain the number of multiple second data packets;
- sixth The determining subunit is used to determine the corresponding worker thread from the multiple worker threads based on multiple preset weights and multiple second data packet quantities.
- the QUIC protocol stack is used to parse or encapsulate data packets according to the QUIC protocol.
- FIG. 5 schematically shows a schematic diagram of the hardware architecture of a computer device suitable for implementing a data processing method based on the QUIC protocol stack according to an embodiment of the present application.
- the computer device 500 is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions.
- it can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of multiple servers).
- the computer device 500 at least includes but is not limited to: a memory 510, a processor 520, and a network interface 530 that can communicate with each other through a system bus. among them:
- the memory 510 includes at least one type of computer-readable storage medium.
- the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), and static random access memory.
- SRAM read only memory
- ROM read only memory
- EEPROM electrically erasable programmable read only memory
- PROM programmable read only memory
- magnetic memory magnetic disk, optical disk, etc.
- the memory 510 may be an internal storage module of the computer device 500, such as a hard disk or memory of the computer device 500.
- the memory 510 may also be an external storage device of the computer device 500, such as a plug-in hard disk equipped on the computer device 500, a smart memory card (Smart Media Card, SMC for short), and a secure digital (Secure Digital) Digital, abbreviated as SD) card, flash card (Flash Card), etc.
- the memory 510 may also include both an internal storage module of the computer device 500 and an external storage device thereof.
- the memory 510 is generally used to store an operating system and various application software installed in the computer device 500, such as program code of a data processing method based on the QUIC protocol stack.
- the memory 510 may also be used to temporarily store various types of data that have been output or will be output.
- the processor 520 may be a central processing unit (Central Processing Unit, CPU for short), a controller, a microcontroller, a microprocessor, or other data processing chips.
- the processor 520 is generally used to control the overall operation of the computer device 500, such as performing data interaction or communication-related control and processing with the computer device 500.
- the processor 520 is configured to run program codes stored in the memory 510 or process data.
- the network interface 530 may include a wireless network interface or a wired network interface, and the network interface 530 is generally used to establish a communication link between the computer device 500 and other computer devices.
- the network interface 530 is used to connect the computer device 500 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 500 and the external terminal.
- the network can be Intranet, Internet, Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network , 5G network, Bluetooth (Bluetooth), Wi-Fi and other wireless or wired networks.
- FIG. 5 only shows a computer device with components 510-530, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
- the data processing method based on the QUIC protocol stack stored in the memory 510 can also be divided into one or more program modules, which are executed by one or more processors (the processor 520 in this embodiment). Execute to complete this application.
- This embodiment also provides a computer-readable storage medium on which computer-readable instructions are stored.
- the computer-readable instructions When the computer-readable instructions are executed by a processor, the following steps are implemented:
- Determining a server program for processing the data packet wherein the server program includes a plurality of worker threads, and the worker threads run a QUIC protocol stack;
- connection identifier Based on the connection identifier, determine a corresponding worker thread from the multiple worker threads.
- the data packet is distributed to the corresponding worker thread, so that the QUIC protocol stack on the corresponding worker thread processes the data packet.
- the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc.
- the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device.
- the computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, referred to as SMC), a secure digital ( Secure Digital, referred to as SD card, Flash Card, etc.
- the computer-readable storage medium may also include both the internal storage unit and the external storage device of the computer device.
- the computer-readable storage medium is generally used to store the operating system and various application software installed in the computer device, such as the program code of the data processing method based on the QUIC protocol stack in the embodiment.
- the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.
- modules or steps of the above-mentioned embodiments of the present application can be implemented by a general computing device, and they can be concentrated on a single computing device or distributed among multiple computing devices.
- they can be implemented with program codes executable by a computing device, so that they can be stored in a storage device for execution by the computing device, and in some cases, can be different from here
- the steps shown or described are performed in the order of, or they are respectively fabricated into individual integrated circuit modules, or multiple modules or steps of them are fabricated into a single integrated circuit module to achieve. In this way, the embodiments of the present application are not limited to any specific hardware and software combination.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Computer And Data Communications (AREA)
Abstract
本申请提供了一种基于QUIC协议栈的数据处理方法,该方法包括:获取数据包的连接标识;确定用于处理数据包的服务端程序,其中,服务端程序包括多个工作线程,工作线程运行有QUIC协议栈;基于连接标识,从多个工作线程中确定出对应的工作线程;以及将数据包分发到对应的工作线程,以使得对应的工作线程上的QUIC协议栈处理数据包。本申请还提供了一种基于QUIC协议栈的数据处理系统、一种计算机设备及一种计算机可读存储介质。
Description
本申请申明2019年01月25日递交的申请号为201910074772.2、名称为“基于QUIC协议栈的数据处理方法、系统、设备及存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。
本申请涉及计算机技术领域,尤其涉及一种基于QUIC协议栈的数据处理方法、系统、计算机设备及计算机可读存储介质。
QUIC(Quic UDP Internet Connections)协议是谷歌制定的一种基于UDP(User Datagram Protocol)的低时延的互联网传输层协议,具有很多的优点,比如减少连接延迟、避免队头阻塞等。基于QUIC协议的诸多优点,现有技术在服务器中配置了一个QUIC协议栈,所有的服务端程序均共享该QUIC协议栈。
然而,在实现本申请构思的过程中,申请人发现相关技术中至少存在如下缺陷:通常服务器中使用的CPU有多个核,现有技术中为服务器配置的单个QUIC协议栈在同一时间处理数据时仅能使用CPU的其中一个核,这样就无法充分利用CPU的多核特性且容易导致CPU的这个核过载;并且在处理数据时,所有的数据均要由该单个QUIC协议栈进行处理,导致并发连接数非常低。
发明内容
本申请的目的是提供一种基于QUIC协议栈的数据处理方法、系统、计算机设备及计算机可读存储介质,用于解决现有技术中为服务器配置单个QUIC协议栈导致未充分利用CPU的多核特性、CPU的某个核过载以及并发连接数过低的缺陷。
本申请的一个方面提供了一种基于QUIC协议栈的数据处理方法,上述方法包括:获取数据包的连接标识;确定用于处理上述数据包的服务端程序,其中,上述服务端程序包括多个工作线程,上述工作线程运行有QUIC协议栈;基于上述连接标识,从上述多个工作线程中确定出对应的工作线程;以及将上述数据包分发到上述对应的工作线程,以使得上述对应的工作线程上的QUIC协议栈处理上述数据包。
根据本申请的实施例,上述基于上述连接标识,从上述多个工作线程中确定出对应的 工作线程,包括:确定上述多个工作线程的线程数量;以及基于上述连接标识和上述线程数量,从上述多个工作线程中确定出上述对应的工作线程。
根据本申请的实施例,上述基于上述连接标识和上述线程数量,从上述多个工作线程中确定出上述对应的工作线程,包括:对上述连接标识和上述线程数量做取模运算,得到取模结果;以及从上述多个工作线程中确定出与上述取模结果对应的工作线程。
根据本申请的实施例,上述基于上述连接标识,从上述多个工作线程中确定出对应的工作线程,包括:查询上述连接标识是否已与上述多个工作线程中的任一工作线程对应;以及若上述连接标识没有与上述多个工作线程中的任一工作线程对应,则从上述多个工作线程中确定出上述对应的工作线程。
根据本申请的实施例,上述若上述连接标识没有与上述多个工作线程中的任一工作线程对应,则从上述多个工作线程中确定出上述对应的工作线程,包括:若上述连接标识没有与上述多个工作线程中的任一工作线程对应,则确定上述多个工作线程中各个工作线程对应的第一数据包数量,得到多个第一数据包数量;从上述多个第一数据包数量中确定出数值最小的第一数据包数量;以及从上述多个工作线程中确定出与上述数值最小的第一数据包数量对应的工作线程。
根据本申请的实施例,上述若上述连接标识没有与上述多个工作线程中的任一工作线程对应,则从上述多个工作线程中确定出上述对应的工作线程,包括:若上述连接标识没有与上述多个工作线程中的任一工作线程对应,则获取上述多个工作线程中各个工作线程的预设权重,得到多个预设权重;确定上述多个工作线程中各个工作线程对应的第二数据包数量,得到多个第二数据包数量;以及基于上述多个预设权重和上述多个第二数据包数量,从上述多个工作线程中确定出上述对应的工作线程。
根据本申请的实施例,上述QUIC协议栈用于按照QUIC协议对上述数据包进行解析或封装。
本申请的另一个方面还提供了一种基于QUIC协议栈的数据处理系统,上述系统包括:获取模块,用于获取数据包的连接标识;第一确定模块,用于确定用于处理上述数据包的服务端程序,其中,上述服务端程序包括多个工作线程,上述工作线程运行有QUIC协议栈;第二确定模块,用于基于上述连接标识,从上述多个工作线程中确定出对应的工作线程;以及分发模块,用于将上述数据包分发到上述对应的工作线程,以使得上述对应的工作线程上的QUIC协议栈处理上述数据包。
本申请的再一个方面提供了一种计算机设备,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时用于实 现以下步骤:获取数据包的连接标识;确定用于处理所述数据包的服务端程序,其中,所述服务端程序包括多个工作线程,所述工作线程运行有QUIC协议栈;基于所述连接标识,从所述多个工作线程中确定出对应的工作线程;以及将所述数据包分发到所述对应的工作线程,以使得所述对应的工作线程上的QUIC协议栈处理所述数据包。
本申请的又一个方面提供了一种计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时用于实现以下步骤:获取数据包的连接标识;确定用于处理所述数据包的服务端程序,其中,所述服务端程序包括多个工作线程,所述工作线程运行有QUIC协议栈;基于所述连接标识,从所述多个工作线程中确定出对应的工作线程;以及将所述数据包分发到所述对应的工作线程,以使得所述对应的工作线程上的QUIC协议栈处理所述数据包。
本申请提供的基于QUIC协议栈的数据处理方法,将用于处理数据包的服务端程序内部划分为多个不同的工作线程,并为每个工作线程配置一个QUIC协议栈,在处理数据包时,先为该数据包分配连接标识,然后通过该连接标识找到对应的工作线程,从而将该数据包分发到该对应的工作线程,以使得该对应的工作线程上的运行的QUIC协议栈可以处理该数据包。由于本申请的实施例为每一个工作线程均配置了一个QUIC协议栈,使得在同一时间内各个工作线程可以独立使用自己的QUIC协议栈处理数据包,充分利用了CPU的多核特性,提高了系统的并发连接数,避免了现有技术中为服务器配置单个QUIC协议栈导致未充分利用CPU的多核特性、CPU的某个核过载以及并发连接数过低的缺陷。
图1示意性示出了根据本申请实施例的基于QUIC协议栈的数据处理方法的流程图;
图2示意性示出了根据本申请实施例的基于QUIC协议栈的数据处理方案的示意图;
图3示意性示出了根据本申请实施例的QUIC数据包的结构图;
图4示意性示出了根据本申请实施例的基于QUIC协议栈的数据处理系统的框图;以及
图5示意性示出了根据本申请实施例的适于实现基于QUIC协议栈的数据处理方法的计算机设备的硬件架构示意图。
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
考虑到现有技术中为服务器配置单个QUIC协议栈导致未充分利用CPU的多核特性、CPU的某个核过载以及并发连接数过低的缺陷。本申请提供的基于QUIC协议栈的数据处理方法,将用于处理数据包的服务端程序内部划分为多个不同的工作线程,并为每个工作线程配置一个QUIC协议栈,在处理数据包时,先为该数据包分配连接标识,然后通过该连接标识找到对应的工作线程,从而将该数据包分发到该对应的工作线程,以使得该对应的工作线程上的运行的QUIC协议栈可以处理该数据包。由于本申请的实施例为每一个工作线程均配置了一个QUIC协议栈,使得在同一时间内各个工作线程可以独立使用自己的QUIC协议栈处理数据包,充分利用了CPU的多核特性,提高了系统的并发连接数。
图1示意性示出了根据本申请实施例的基于QUIC协议栈的数据处理方法的流程图。
如图1所示,该基于QUIC协议栈的数据处理方法可以包括步骤S101~步骤S104,其中:
步骤S101,获取数据包的连接标识。
在本申请的实施例中,数据包可以包括UDP数据包,每个数据包对应一个连接标识,且不同的数据包对应的连接标识可能是相同的。其中,连接标识可以包括CID(Connection ID,又称为连接ID)。
步骤S102,确定用于处理数据包的服务端程序,其中,服务端程序包括多个工作线程,工作线程运行有QUIC协议栈。
根据本申请的实施例,可以预先将服务端程序内部划分为多个不同的工作线程,并为每一个工作线程配置一个QUIC协议栈,其中,QUIC协议栈用于按照QUIC协议对数据包进行解析或封装。
步骤S103,基于连接标识,从多个工作线程中确定出对应的工作线程。
在本申请的实施例中,基于连接标识,从多个工作线程中确定出对应的工作线程可以包括三种策略,具体如下。
第一种策略,又称为固定映射策略,具体为,确定多个工作线程的线程数量;以及基于连接标识和线程数量,从多个工作线程中确定出对应的工作线程。其中,基于连接标识和线程数量,从多个工作线程中确定出对应的工作线程,可以包括:对连接标识和线程数量做取模运算,得到取模结果;以及从多个工作线程中确定出与取模结果对应的工作线程。
例如,连接标识为9,线程数量为10,取模结果为9,则可以将第9个工作线程作为对应的工作线程。
又例如,每个工作线程预设有映射标识,第4个工作线程的映射标识为9,则对于取模结果为9,其与映射标识9正好对应,则可以将第4个工作线程作为对应的工作线程。
由于连接标识是随机分配的,若是连接标识分配不均衡,则采用第一种策略可能会导致有的工作线程负载高、有的工作线程负载低。为了解决上述问题,可以采用第二种策略,又称为负载均衡映射策略。具体为,查询连接标识是否已与多个工作线程中的任一工作线程对应;以及若连接标识没有与多个工作线程中的任一工作线程对应,则从多个工作线程中确定出对应的工作线程。其中,若连接标识没有与多个工作线程中的任一工作线程对应,则从多个工作线程中确定出对应的工作线程,可以包括:若连接标识没有与多个工作线程中的任一工作线程对应,则确定多个工作线程中各个工作线程对应的第一数据包数量,得到多个第一数据包数量;从多个第一数据包数量中确定出数值最小的第一数据包数量;以及从多个工作线程中确定出与数值最小的第一数据包数量对应的工作线程。
需要说明的是,无论哪一种策略,均需要满足一个固定的机制,即对于已经匹配过的连接标识,后续仍要将该连接标识对应的数据包分配到与该连接标识匹配成功的工作线程上。例如,对于连接标识9,之前已经将连接标识9对应的数据包发送到第9个工作线程上,则对于以后出现的连接标识仍为9的数据包,也需要将该数据包分发到第9个工作线程上。如果本申请所述的策略不满足上述机制,则可能会出现将同一连接标识对应的数据包分发到不同的工作线程上,这样势必会导致一些数据包连接失败,从而增加负载和重传比率。而使用本申请所述的机制,则可以避免上述缺陷,降低负载和重传比率。
根据本申请的实施例,若是当前数据包的连接标识之前没有匹配到任何一个工作线程,则可以先确定出每一个工作线程对应的数据包的第一数据包数量,然后找到数值最小的第一数据包数量,并该数值最小的第一数据包数量对应的工作线程作为本次的连接标识对应的工作线程。
例如,一共有3个工作线程,假设连接标识之前未匹配过任何一个工作线程,且第1个工作线程对应的数据包的第一数据包数量为4个,第2个工作线程对应的数据包的第一数据包数量为2个,第3个工作线程对应的数据包的第一数据包数量为5个,则可以将第2个工作线程作为与连接标识对应的工作线程。
第三种策略,作为第二种策略的一个特例,又称为权重映射策略。具体地,第三种策略也可以是先查询连接标识是否已与多个工作线程中的任一工作线程对应;以及若连接标 识没有与多个工作线程中的任一工作线程对应,则从多个工作线程中确定出对应的工作线程。其中,若连接标识没有与多个工作线程中的任一工作线程对应,则从多个工作线程中确定出对应的工作线程,可以包括:若连接标识没有与多个工作线程中的任一工作线程对应,则获取多个工作线程中各个工作线程的预设权重,得到多个预设权重;确定多个工作线程中各个工作线程对应的第二数据包数量,得到多个第二数据包数量;以及基于多个预设权重和多个第二数据包数量,从多个工作线程中确定出对应的工作线程。
例如,一共有3个工作线程,假设连接标识之前未匹配过任何一个工作线程,且第1个工作线程的预设权重为1、对应的数据包的第一数据包数量为3个,第2个工作线程的预设权重为2、对应的数据包的第一数据包数量为4个,第3个工作线程的预设权重为3、对应的数据包的第一数据包数量为6个。为了使得各个工作线程对应的数据包的第一数据包数量的比例可以保持在各自的预设权重的比例,即1:2:3,可以尽量的在除了第1个工作线程以外的工作线程上投放数据包,即可以将第2个工作线程和第3个工作线程中的任意一个作为该连接标识对应的工作线程。
步骤S104,将数据包分发到对应的工作线程,以使得对应的工作线程上的QUIC协议栈处理数据包。
在本申请的实施例中,将数据包分发到对应的工作线程实际上可以是将数据包分发到该工作线程上的QUIC协议站上,以使得QUIC协议栈可以按照QUIC协议对该数据包进行解析或封装,其中,被QUIC协议栈处理后的数据包可以称为QUIC数据包。
本申请提供的基于QUIC协议栈的数据处理方法,将用于处理数据包的服务端程序内部划分为多个不同的工作线程,并为每个工作线程配置一个QUIC协议栈,在处理数据包时,先为该数据包分配连接标识,然后通过该连接标识找到对应的工作线程,从而将该数据包分发到该对应的工作线程,以使得该对应的工作线程上的运行的QUIC协议栈可以处理该数据包。由于本申请的实施例为每一个工作线程均配置了一个QUIC协议栈,使得在同一时间内各个工作线程可以独立使用自己的QUIC协议栈处理数据包,充分利用了CPU的多核特性,提高了系统的并发连接数,避免了现有技术中为服务器配置单个QUIC协议栈导致未充分利用CPU的多核特性、CPU的某个核过载以及并发连接数过低的缺陷。
图2示意性示出了根据本申请实施例的基于QUIC协议栈的数据处理方案的示意图。
如图2所示,本申请的实施例可以通过主线程上的Recvfrom函数从客户端接收数据包(例如UDP数据包),然后将数据包按顺序排列在网络收包FIFO(First Input First Output,又称为先入先出)队列中,进一步通过Worker Manager分配CID,然后通过上述实施例中的任一一种策略确定出对应的工作线程,并将数据包投放到该工作线程上。从图3中可以 看出,每一个工作线程上均运行了HTTP解析器、TLS(Transport Layer Security,又称为传输层安全协议)、QUIC协议栈,其中,HTTP解析器可以提供请求和响应报文的解析功能,TLS的目的是为互联网通信提供安全及数据完整性保障,QUIC协议栈用于按照QUIC协议对所述数据包进行解析或封装。以UDP数据包为例,对于投放过来的UDP数据包,可以先由QUIC协议栈对其进行处理,将其解析成QUIC数据包,然后QUIC数据包经过TLS,最后经由HTTP解析器解析后交由系统内部进行处理。进一步,对于系统需要向外发送的数据,可以依次经过工作线程的HTTP解析器、TLS、QUIC协议栈,被封装成QUIC数据包,然后排队出包,再通过网络发包FIFO队列依次由主线程发送给客户端。
图3示意性示出了根据本申请实施例的QUIC数据包的结构图。
如图3所示,Flags占了8位,可以用于表征QUIC数据包的标志位,例如Flags可以用于表示QUIC数据包为建立连接数据包、或者握手数据包等等。Connection ID占了64位,可以用于表征一个网络连接。Type-Dependent Fields根据Flags表征的数据包可以对应的存储不同的结构,例如,若Flags用于表示QUIC数据包为建立连接数据包,则Type-Dependent Fields中可以存储关于建立连接的数据结构。其中,(*)可以表征Type-Dependent Fields在QUIC数据包中并不是必须存在的。
图4示意性示出了根据本申请实施例的基于QUIC协议栈的数据处理系统的框图。
如图4所示,该基于QUIC协议栈的数据处理系统400可以包括获取模块410、第一确定模块420、第二确定模块430和分发模块440,其中:
获取模块410用于获取数据包的连接标识。
第一确定模块420用于确定用于处理数据包的服务端程序,其中,服务端程序包括多个工作线程,工作线程运行有QUIC协议栈。
第二确定模块430用于基于连接标识,从多个工作线程中确定出对应的工作线程。
分发模块440用于将数据包分发到对应的工作线程,以使得对应的工作线程上的QUIC协议栈处理数据包。
本申请提供的基于QUIC协议栈的数据处理系统,将用于处理数据包的服务端程序内部划分为多个不同的工作线程,并为每个工作线程配置一个QUIC协议栈,在处理数据包时,先为该数据包分配连接标识,然后通过该连接标识找到对应的工作线程,从而将该数据包分发到该对应的工作线程,以使得该对应的工作线程上的运行的QUIC协议栈可以处理该数据包。由于本申请的实施例为每一个工作线程均配置了一个QUIC协议栈,使得在同一时间内各个工作线程可以独立使用自己的QUIC协议栈处理数据包,充分利用了CPU的多核特性,提高了系统的并发连接数,避免了现有技术中为服务器配置单个QUIC 协议栈导致未充分利用CPU的多核特性、CPU的某个核过载以及并发连接数过低的缺陷。
作为一种可选的实施例,第二确定模块可以包括:第一确定单元,用于确定多个工作线程的线程数量;以及第二确定单元,用于基于连接标识和线程数量,从多个工作线程中确定出对应的工作线程。
作为一种可选的实施例,第二确定单元可以包括:运算子单元,用于对连接标识和线程数量做取模运算,得到取模结果;以及第一确定子单元,用于从多个工作线程中确定出与取模结果对应的工作线程。
作为一种可选的实施例,第二确定模块可以包括:查询单元,用于查询连接标识是否已与多个工作线程中的任一工作线程对应;以及第三确定单元,用于在连接标识没有与多个工作线程中的任一工作线程对应的情况下,从多个工作线程中确定出对应的工作线程。
作为一种可选的实施例,第三确定单元可以包括:第二确定子单元,用于在连接标识没有与多个工作线程中的任一工作线程对应的情况下,确定多个工作线程中各个工作线程对应的第一数据包数量,得到多个第一数据包数量;第三确定子单元,用于从多个第一数据包数量中确定出数值最小的第一数据包数量;以及第四确定子单元,用于从多个工作线程中确定出与数值最小的第一数据包数量对应的工作线程。
作为一种可选的实施例,第三确定单元可以包括:获取子单元,用于在连接标识没有与多个工作线程中的任一工作线程对应的情况下,获取多个工作线程中各个工作线程的预设权重,得到多个预设权重;第五确定子单元,用于确定多个工作线程中各个工作线程对应的第二数据包数量,得到多个第二数据包数量;以及第六确定子单元,用于基于多个预设权重和多个第二数据包数量,从多个工作线程中确定出对应的工作线程。
作为一种可选的实施例,QUIC协议栈用于按照QUIC协议对数据包进行解析或封装。
图5示意性示出了根据本申请实施例的适于实现基于QUIC协议栈的数据处理方法的计算机设备的硬件架构示意图。本实施例中,计算机设备500是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。例如,可以是智能手机、平板电脑、笔记本电脑、台式计算机、机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。如图5所示,计算机设备500至少包括但不限于:可通过系统总线相互通信链接存储器510、处理器520、网络接口530。其中:
存储器510至少包括一种类型的计算机可读存储介质,可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、 可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,存储器510可以是计算机设备500的内部存储模块,例如该计算机设备500的硬盘或内存。在另一些实施例中,存储器510也可以是计算机设备500的外部存储设备,例如该计算机设备500上配备的插接式硬盘,智能存储卡(Smart Media Card,简称为SMC),安全数字(Secure Digital,简称为SD)卡,闪存卡(Flash Card)等。当然,存储器510还可以既包括计算机设备500的内部存储模块也包括其外部存储设备。本实施例中,存储器510通常用于存储安装于计算机设备500的操作系统和各类应用软件,例如基于QUIC协议栈的数据处理方法的程序代码等。此外,存储器510还可以用于暂时地存储已经输出或者将要输出的各类数据。
处理器520在一些实施例中可以是中央处理器(Central Processing Unit,简称为CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器520通常用于控制计算机设备500的总体操作,例如执行与计算机设备500进行数据交互或者通信相关的控制和处理等。本实施例中,处理器520用于运行存储器510中存储的程序代码或者处理数据。
网络接口530可包括无线网络接口或有线网络接口,该网络接口530通常用于在计算机设备500与其他计算机设备之间建立通信链接。例如,网络接口530用于通过网络将计算机设备500与外部终端相连,在计算机设备500与外部终端之间的建立数据传输通道和通信链接等。网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,简称为GSM)、宽带码分多址(Wideband Code Division Multiple Access,简称为WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi等无线或有线网络。
需要指出的是,图5仅示出了具有部件510-530的计算机设备,但是应理解的是,并不要求实施所有示出的部件,可以替代的实施更多或者更少的部件。
在本实施例中,存储于存储器510中的基于QUIC协议栈的数据处理方法还可以被分割为一个或者多个程序模块,并由一个或多个处理器(本实施例为处理器520)所执行,以完成本申请。
本实施例还提供一种计算机可读存储介质,计算机可读存储介质其上存储有计算机可读指令,计算机可读指令被处理器执行时实现以下步骤:
获取数据包的连接标识;
确定用于处理所述数据包的服务端程序,其中,所述服务端程序包括多个工作线程,所述工作线程运行有QUIC协议栈;
基于所述连接标识,从所述多个工作线程中确定出对应的工作线程;以及
将所述数据包分发到所述对应的工作线程,以使得所述对应的工作线程上的QUIC协议栈处理所述数据包。
本实施例中,计算机可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,计算机可读存储介质可以是计算机设备的内部存储单元,例如该计算机设备的硬盘或内存。在另一些实施例中,计算机可读存储介质也可以是计算机设备的外部存储设备,例如该计算机设备上配备的插接式硬盘,智能存储卡(Smart Media Card,简称为SMC),安全数字(Secure Digital,简称为SD)卡,闪存卡(Flash Card)等。当然,计算机可读存储介质还可以既包括计算机设备的内部存储单元也包括其外部存储设备。本实施例中,计算机可读存储介质通常用于存储安装于计算机设备的操作系统和各类应用软件,例如实施例中的基于QUIC协议栈的数据处理方法的程序代码等。此外,计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的各类数据。
显然,本领域的技术人员应该明白,上述的本申请实施例的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本申请实施例不限制于任何特定的硬件和软件结合。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。
Claims (20)
- 一种基于QUIC协议栈的数据处理方法,所述方法包括:获取数据包的连接标识;确定用于处理所述数据包的服务端程序,其中,所述服务端程序包括多个工作线程,所述工作线程运行有QUIC协议栈;基于所述连接标识,从所述多个工作线程中确定出对应的工作线程;以及将所述数据包分发到所述对应的工作线程,以使得所述对应的工作线程上的QUIC协议栈处理所述数据包。
- 根据权利要求1所述的方法,所述基于所述连接标识,从所述多个工作线程中确定出对应的工作线程,包括:确定所述多个工作线程的线程数量;以及基于所述连接标识和所述线程数量,从所述多个工作线程中确定出所述对应的工作线程。
- 根据权利要求2所述的方法,所述基于所述连接标识和所述线程数量,从所述多个工作线程中确定出所述对应的工作线程,包括:对所述连接标识和所述线程数量做取模运算,得到取模结果;以及从所述多个工作线程中确定出与所述取模结果对应的工作线程。
- 根据权利要求1所述的方法,所述基于所述连接标识,从所述多个工作线程中确定出对应的工作线程,包括:查询所述连接标识是否已与所述多个工作线程中的任一工作线程对应;以及若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则从所述多个工作线程中确定出所述对应的工作线程。
- 根据权利要求4所述的方法,所述若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则从所述多个工作线程中确定出所述对应的工作线程,包括:若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则确定所述多个工作线程中各个工作线程对应的第一数据包数量,得到多个第一数据包数量;从所述多个第一数据包数量中确定出数值最小的第一数据包数量;以及从所述多个工作线程中确定出与所述数值最小的第一数据包数量对应的工作线程。
- 根据权利要求4所述的方法,所述若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则从所述多个工作线程中确定出所述对应的工作线程,包括:若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则获取所述多个工作线程中各个工作线程的预设权重,得到多个预设权重;确定所述多个工作线程中各个工作线程对应的第二数据包数量,得到多个第二数据包数量;以及基于所述多个预设权重和所述多个第二数据包数量,从所述多个工作线程中确定出所述对应的工作线程。
- 根据权利要求1所述的方法,所述QUIC协议栈用于按照QUIC协议对所述数据包进行解析或封装。
- 一种基于QUIC协议栈的数据处理系统,所述系统包括:获取模块,用于获取数据包的连接标识;第一确定模块,用于确定用于处理所述数据包的服务端程序,其中,所述服务端程序包括多个工作线程,所述工作线程运行有QUIC协议栈;第二确定模块,用于基于所述连接标识,从所述多个工作线程中确定出对应的工作线程;以及分发模块,用于将所述数据包分发到所述对应的工作线程,以使得所述对应的工作线程上的QUIC协议栈处理所述数据包。
- 一种计算机设备,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时用于实现以下步骤:获取数据包的连接标识;确定用于处理所述数据包的服务端程序,其中,所述服务端程序包括多个工作线程,所述工作线程运行有QUIC协议栈;基于所述连接标识,从所述多个工作线程中确定出对应的工作线程;以及将所述数据包分发到所述对应的工作线程,以使得所述对应的工作线程上的QUIC协议栈处理所述数据包。
- 根据权利要求9所述的计算机设备,所述基于所述连接标识,从所述多个工作线程中确定出对应的工作线程,包括:确定所述多个工作线程的线程数量;以及基于所述连接标识和所述线程数量,从所述多个工作线程中确定出所述对应的工作线程。
- 根据权利要求10所述的计算机设备,所述基于所述连接标识和所述线程数量,从所述多个工作线程中确定出所述对应的工作线程,包括:对所述连接标识和所述线程数量做取模运算,得到取模结果;以及从所述多个工作线程中确定出与所述取模结果对应的工作线程。
- 根据权利要求9所述的计算机设备,所述基于所述连接标识,从所述多个工作线程中确定出对应的工作线程,包括:查询所述连接标识是否已与所述多个工作线程中的任一工作线程对应;以及若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则从所述多个工作线程中确定出所述对应的工作线程。
- 根据权利要求12所述的计算机设备,所述若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则从所述多个工作线程中确定出所述对应的工作线程,包括:若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则确定所述多个工作线程中各个工作线程对应的第一数据包数量,得到多个第一数据包数量;从所述多个第一数据包数量中确定出数值最小的第一数据包数量;以及从所述多个工作线程中确定出与所述数值最小的第一数据包数量对应的工作线程。
- 根据权利要求12所述的计算机设备,所述若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则从所述多个工作线程中确定出所述对应的工作线程,包括:若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则获取所述多个工作线程中各个工作线程的预设权重,得到多个预设权重;确定所述多个工作线程中各个工作线程对应的第二数据包数量,得到多个第二数据包数量;以及基于所述多个预设权重和所述多个第二数据包数量,从所述多个工作线程中确定出所述对应的工作线程。
- 一种计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时用于实现以下步骤:获取数据包的连接标识;确定用于处理所述数据包的服务端程序,其中,所述服务端程序包括多个工作线程,所述工作线程运行有QUIC协议栈;基于所述连接标识,从所述多个工作线程中确定出对应的工作线程;以及将所述数据包分发到所述对应的工作线程,以使得所述对应的工作线程上的QUIC协议栈处理所述数据包。
- 根据权利要求15所述的计算机可读存储介质,所述基于所述连接标识,从所述多个工作线程中确定出对应的工作线程,包括:确定所述多个工作线程的线程数量;以及基于所述连接标识和所述线程数量,从所述多个工作线程中确定出所述对应的工作线程。
- 根据权利要求16所述的计算机可读存储介质,所述基于所述连接标识和所述线程数量,从所述多个工作线程中确定出所述对应的工作线程,包括:对所述连接标识和所述线程数量做取模运算,得到取模结果;以及从所述多个工作线程中确定出与所述取模结果对应的工作线程。
- 根据权利要求15所述的计算机可读存储介质,所述基于所述连接标识,从所述多个工作线程中确定出对应的工作线程,包括:查询所述连接标识是否已与所述多个工作线程中的任一工作线程对应;以及若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则从所述多个工作线程中确定出所述对应的工作线程。
- 根据权利要求18所述的计算机可读存储介质,所述若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则从所述多个工作线程中确定出所述对应的工作线程,包括:若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则确定所述多个工作线程中各个工作线程对应的第一数据包数量,得到多个第一数据包数量;从所述多个第一数据包数量中确定出数值最小的第一数据包数量;以及从所述多个工作线程中确定出与所述数值最小的第一数据包数量对应的工作线程。
- 根据权利要求18所述的计算机可读存储介质,所述若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则从所述多个工作线程中确定出所述对应的工作线程,包括:若所述连接标识没有与所述多个工作线程中的任一工作线程对应,则获取所述多个工作线程中各个工作线程的预设权重,得到多个预设权重;确定所述多个工作线程中各个工作线程对应的第二数据包数量,得到多个第二数据包数量;以及基于所述多个预设权重和所述多个第二数据包数量,从所述多个工作线程中确定出所述对应的工作线程。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US17/425,636 US11954530B2 (en) | 2019-01-25 | 2019-12-25 | Method and system of processing data based on QUIC protocol stack, device and storage medium |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910074772.2 | 2019-01-25 | ||
CN201910074772.2A CN111490963B (zh) | 2019-01-25 | 2019-01-25 | 基于quic协议栈的数据处理方法、系统、设备及存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020151449A1 true WO2020151449A1 (zh) | 2020-07-30 |
Family
ID=71736067
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/128464 WO2020151449A1 (zh) | 2019-01-25 | 2019-12-25 | 基于quic协议栈的数据处理方法、系统、设备及存储介质 |
Country Status (3)
Country | Link |
---|---|
US (1) | US11954530B2 (zh) |
CN (1) | CN111490963B (zh) |
WO (1) | WO2020151449A1 (zh) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11570239B2 (en) * | 2020-04-20 | 2023-01-31 | Cisco Technology, Inc. | Distributed resilient load-balancing for multipath transport protocols |
CN112671754B (zh) * | 2020-12-21 | 2023-05-02 | 龙存(成都)科技有限公司 | 一种单流水线处理不同服务端功能的方法、系统 |
CN114697411A (zh) * | 2020-12-29 | 2022-07-01 | 北京达佳互联信息技术有限公司 | 数据处理方法、装置、服务器及存储介质 |
CN113852975B (zh) * | 2021-08-19 | 2024-02-02 | 浙江三维利普维网络有限公司 | 基站的协议栈程序的性能确定方法及装置 |
CN115396528A (zh) * | 2022-08-17 | 2022-11-25 | 上海哔哩哔哩科技有限公司 | 基于协议族的quic数据传输方法及装置 |
CN116156020A (zh) * | 2022-12-05 | 2023-05-23 | 网宿科技股份有限公司 | 数据处理方法、设备及可读存储介质 |
CN115580667B (zh) * | 2022-12-12 | 2023-03-24 | 腾讯科技(深圳)有限公司 | 数据传输方法、装置、设备及存储介质 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017167392A1 (en) * | 2016-04-01 | 2017-10-05 | Nokia Solutions And Networks Oy | Dynamic experience management in communications |
CN107360268A (zh) * | 2017-06-23 | 2017-11-17 | 北京奇艺世纪科技有限公司 | 一种数据包处理方法、装置及设备 |
CN108965359A (zh) * | 2017-05-19 | 2018-12-07 | 北京京东尚科信息技术有限公司 | 通信方法、通信装置、可读介质和电子设备 |
CN109218186A (zh) * | 2017-07-05 | 2019-01-15 | 华为技术有限公司 | 一种多路径数据传输处理方法及网络设备 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8116230B2 (en) * | 2008-07-31 | 2012-02-14 | Motorola Solutions, Inc. | Establishing communication pathways between infrastructure devices in a group communication system implemented over a wide area network |
US8782147B2 (en) * | 2010-09-09 | 2014-07-15 | Red Hat, Inc. | Concurrent delivery for messages from a same sender |
CN102789394B (zh) * | 2011-05-19 | 2014-12-24 | 阿里巴巴集团控股有限公司 | 一种并行处理消息的方法、装置、节点及服务器集群 |
CN104969533B (zh) * | 2013-12-25 | 2018-11-06 | 华为技术有限公司 | 一种数据包处理方法和装置 |
GB2547201B (en) * | 2016-02-09 | 2022-08-31 | Darktrace Holdings Ltd | Cyber security |
US10397085B1 (en) * | 2016-06-30 | 2019-08-27 | Juniper Networks, Inc. | Offloading heartbeat responses message processing to a kernel of a network device |
-
2019
- 2019-01-25 CN CN201910074772.2A patent/CN111490963B/zh active Active
- 2019-12-25 US US17/425,636 patent/US11954530B2/en active Active
- 2019-12-25 WO PCT/CN2019/128464 patent/WO2020151449A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017167392A1 (en) * | 2016-04-01 | 2017-10-05 | Nokia Solutions And Networks Oy | Dynamic experience management in communications |
CN108965359A (zh) * | 2017-05-19 | 2018-12-07 | 北京京东尚科信息技术有限公司 | 通信方法、通信装置、可读介质和电子设备 |
CN107360268A (zh) * | 2017-06-23 | 2017-11-17 | 北京奇艺世纪科技有限公司 | 一种数据包处理方法、装置及设备 |
CN109218186A (zh) * | 2017-07-05 | 2019-01-15 | 华为技术有限公司 | 一种多路径数据传输处理方法及网络设备 |
Also Published As
Publication number | Publication date |
---|---|
US11954530B2 (en) | 2024-04-09 |
CN111490963A (zh) | 2020-08-04 |
CN111490963B (zh) | 2022-07-29 |
US20220091892A1 (en) | 2022-03-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020151449A1 (zh) | 基于quic协议栈的数据处理方法、系统、设备及存储介质 | |
US10169060B1 (en) | Optimization of packet processing by delaying a processor from entering an idle state | |
US6370599B1 (en) | System for ascertaining task off-load capabilities of a device and enabling selected capabilities and when needed selectively and dynamically requesting the device to perform the task | |
CN109768939B (zh) | 一种支持优先级的标签化网络栈方法和系统 | |
WO2017067391A1 (zh) | 虚拟机的数据共享方法及装置 | |
US8462632B1 (en) | Network traffic control | |
US8681821B1 (en) | Streamlined guest networking in a virtualized environment | |
US8635353B2 (en) | Reception according to a data transfer protocol of data directed to any of a plurality of destination entities | |
US9621633B2 (en) | Flow director-based low latency networking | |
CN111490947A (zh) | 数据包发送方法、数据包接收方法、系统、设备及介质 | |
US20150156057A1 (en) | Executable-Based Platform Selection | |
WO2021051881A1 (zh) | Vpp 集群管理方法及装置、计算机设备及存储介质 | |
US9292466B1 (en) | Traffic control for prioritized virtual machines | |
CN111371848A (zh) | 一种请求处理方法、装置、设备及存储介质 | |
US9614900B1 (en) | Multi-process architecture for a split browser | |
US11861386B1 (en) | Application gateways in an on-demand network code execution system | |
CN107426728B (zh) | 高性能接入认证处理方法、系统、控制器设备、组网装置 | |
CN110868364B (zh) | 一种带宽隔离装置及方法 | |
EP3993366A2 (en) | Network load balancer, request message distribution method, program product and system | |
WO2023082609A1 (zh) | 一种数据处理方法以及相关设备 | |
US11188339B2 (en) | System and method for an external processor to access internal registers | |
US20230254727A1 (en) | Methods for profile based management of infrastructure of a cloud used for ran applications | |
US20230060132A1 (en) | Coordinating data packet processing between kernel space and user space | |
CN116599963A (zh) | 批量跨分片访问方法、装置、设备、介质和程序产品 | |
CN115834510A (zh) | 一种基于任务调度的单向数据传输系统和方法 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19911034 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19911034 Country of ref document: EP Kind code of ref document: A1 |