CN101719872A - Zero-copy mode based method and device for sending and receiving multi-queue messages - Google Patents
Zero-copy mode based method and device for sending and receiving multi-queue messages Download PDFInfo
- Publication number
- CN101719872A CN101719872A CN200910242314A CN200910242314A CN101719872A CN 101719872 A CN101719872 A CN 101719872A CN 200910242314 A CN200910242314 A CN 200910242314A CN 200910242314 A CN200910242314 A CN 200910242314A CN 101719872 A CN101719872 A CN 101719872A
- Authority
- CN
- China
- Prior art keywords
- message
- copy mode
- zero
- sending
- message buffer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Computer And Data Communications (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention provides zero-copy mode based method and device for sending and receiving multi-queue messages. The method comprises the steps of: driving a program to apply a plurality of message buffer zone queues for sending and receiving messages by a network card; when the network card receives the messages, receiving the messages by adopting the zero-copy mode, storing the received messages into corresponding message buffer zone queues in the plurality of message buffer zone queues; and when the network card sends the messages, appointing the messages to be stored into a specific message buffer zone queue in the plurality of message buffer zone queues, then sending the messages by adopting the zero-copy mode. The invention fully utilizes the processing capacity of a multi-core CPU, ensures that messages received by a plurality of application programs are homoclinic and homologic without adopting mutual exclusion operation, and improves the processing efficiency of the messages.
Description
Technical field
The present invention relates to the communications field, relate in particular to a kind of many formations message method of sending and receiving method and apparatus based on Zero-copy mode.
Background technology
At present, correlation technique carries out that message sends and there is following shortcoming in the method that receives:
(1) can only carry out message in the individual data formation based on Zero-copy mode and send, receive operation;
(2) carry out the message transmission simultaneously, when receiving operation, need to adopt mutually exclusive operation when a plurality of application programs, safeguard the synchronous of buffering area formation;
(3) can't make full use of the disposal ability of multi-core CPU;
(4) application program utilizes the TCP/IP network protocol stack to carry out the message reception, can't guarantee the homology chummage (identical source, purpose IP address or rightabout message) of message.
Summary of the invention
At exist in the correlation technique problem, the object of the present invention is to provide a kind of, with in addressing the above problem one of at least.
For achieving the above object, according to an aspect of the present invention, provide a kind of many formations message method of sending and receiving based on Zero-copy mode, this method comprises: the NIC driver application is used to send and receive a plurality of message buffer formations of message; When network interface card receives message, adopt Zero-copy mode to receive message, and the message that is received is stored in a plurality of message buffer formations in the corresponding message buffer formation; And when network interface card sends message, specify message to store in which message buffer formation in a plurality of message buffer formations, adopt Zero-copy mode to carry out message then and send.
Preferably, when network interface card receives message, carry out Hash operation according to source IP address in the heading that is received and purpose IP address.
Preferably, when network interface card sends message, can move one or more application programs simultaneously and carry out transmit operation, each application program is used different message buffer formations.
For achieving the above object, according to an aspect of the present invention, a kind of many formations message sending and receiving device based on Zero-copy mode is provided, and this device comprises: formation application module is used to apply for being used to send and receive a plurality of message buffer formations of message; The message receiver module is used for when network interface card receives message, adopts Zero-copy mode to receive message, and the message that is received is stored in a plurality of message buffer formations in the corresponding message buffer formation; And the message sending module, when network interface card sends message, specify message to store in which message buffer formation in a plurality of message buffer formations, adopt Zero-copy mode to carry out message then and send.
Preferably, when receiving message, the message receiver module carries out Hash operation according to source IP address in the heading that is received and purpose IP address.
Preferably, when sending message, move one or more application programs simultaneously and carry out transmit operation, each application program is used different message buffer formations.
By above-mentioned at least one technical scheme of the present invention, carry out message and send and receive operation by applying for a plurality of message buffer formations, the present invention has made full use of the disposal ability of multi-core CPU, all homology chummages of message that a plurality of application programs receive have been guaranteed, do not adopt mutually exclusive operation, improved the treatment effeciency of message.
Description of drawings
Fig. 1 is the flow chart according to the many formations message method of sending and receiving based on Zero-copy mode of the present invention; And
Fig. 2 is the block diagram according to the many formations message method of sending and receiving based on Zero-copy mode of the present invention.
Embodiment
Functional overview
Consider exist in the correlation technique problem, the present invention proposes a kind of many formations message method of sending and receiving and device based on Zero-copy mode.
Under the normal condition, a message queue is respectively used in the transmission of message, reception.Like this, when a plurality of application programs are carried out the transmission of message simultaneously or received operation, just need carry out mutually exclusive operation to message queue.For head it off, we create a plurality of message queues, and each application program is determined employed message queue number by parameter.Like this, each application program can be used the message queue of oneself simultaneously.Concerning each application program, except needing the specified queue extra when the function call, the situation of other aspects during fully with a message queue is identical.
Send and receive operation by applying for a plurality of message buffer formations and adopting Zero-copy mode to carry out message, made full use of the disposal ability of multi-core CPU, guarantee all homology chummages of message that a plurality of application programs receive, do not adopted mutually exclusive operation, improved the treatment effeciency of message.
Fig. 1 is the flow chart according to the many formations message method of sending and receiving based on Zero-copy mode of the present invention.As shown in Figure 1, the many formations message method of sending and receiving based on Zero-copy mode according to the present invention comprises:
Step S102, the NIC driver application is used to send and receive a plurality of message buffer formations of message;
Step S 104, when network interface card receives message, adopt Zero-copy mode to receive message, and the message that is received is stored in a plurality of message buffer formations in the corresponding message buffer formation; And when network interface card sends message, specify message to store in which message buffer formation in a plurality of message buffer formations, adopt Zero-copy mode to carry out message then and send.
Wherein, when network interface card receives message, can carry out Hash operation, carry out the storage of message then, to guarantee the homology chummage of message according to source IP address in the heading that is received and purpose IP address.
Wherein, hash algorithm is exactly the binary number that extracts fixed position, fixed qty at first respectively from 32 bits of source IP address, purpose IP address, such as 12 to 20 totally 9 figure places, then this group number is carried out xor operation, and get the remainder operation according to number of queues.Like this, just different messages can be stored in the different message queues, also guarantee the homology chummage of message simultaneously.
Wherein, when network interface card sends message, can move one or more application programs simultaneously and carry out transmit operation, each application program is used different message buffer formations.
Fig. 2 is according to the many formations message sending and receiving device based on Zero-copy mode of the present invention.As shown in Figure 2, the many formations message sending and receiving device 200 based on Zero-copy mode according to the present invention comprises: formation application module 202 is used to apply for being used to send and receive a plurality of message buffer formations of message; Message receiver module 204 is used for when network interface card receives message, adopts Zero-copy mode to receive message, and the message that is received is stored in a plurality of message buffer formations in the corresponding message buffer formation; And message sending module 206, when network interface card sends message, specify message to store in which message buffer formation in a plurality of message buffer formations, adopt Zero-copy mode to carry out message then and send.
Wherein, when receiving message, the message receiver module carries out Hash operation according to source IP address in the heading that is received and purpose IP address.When sending message, to move one or more application programs simultaneously and carry out transmit operation, each application program is used different message buffer formations, like this, does not need to carry out mutually exclusive operation.
In sum, by above-mentioned at least one technical scheme of the present invention, by by applying for a plurality of message buffer formations and adopt Zero-copy mode to carry out message to send and receive operation, the present invention has made full use of the disposal ability of multi-core CPU, all homology chummages of message that a plurality of application programs receive have been guaranteed, do not adopt mutually exclusive operation, improved the treatment effeciency of message.。
Obviously, those skilled in the art should be understood that, above-mentioned each module of the present invention or each step can realize with the general calculation device, they can concentrate on the single calculation element, perhaps be distributed on the network that a plurality of calculation element forms, alternatively, they can be realized with the executable program code of calculation element, thereby, they can be stored in the storage device and carry out by calculation element, perhaps they are made into each integrated circuit modules respectively, perhaps a plurality of modules in them or step are made into the single integrated circuit module and realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.
Claims (6)
1. many formations message method of sending and receiving based on Zero-copy mode is characterized in that described method comprises:
The NIC driver application is used to send and receive a plurality of message buffer formations of message;
When network interface card receives message, adopt Zero-copy mode to receive message, and the message that is received is stored in described a plurality of message buffer formation in the corresponding message buffer formation; And
When network interface card sends message, specify described message to store in which message buffer formation in described a plurality of message buffer formation, adopt Zero-copy mode to carry out message then and send.
2. method according to claim 1 is characterized in that, when described network interface card receives message, carries out Hash operation according to source IP address in the heading that is received and purpose IP address.
3. method according to claim 1 is characterized in that, when described network interface card sends message, can move one or more application programs simultaneously and carry out transmit operation, and each described application program is used different message buffer formations.
4. many formations message sending and receiving device based on Zero-copy mode is characterized in that described device comprises:
Formation application module is used to apply for being used to send and receive a plurality of message buffer formations of message;
The message receiver module is used for when network interface card receives message, adopts Zero-copy mode to receive message, and the message that is received is stored in described a plurality of message buffer formation in the corresponding message buffer formation; And
The message sending module when network interface card sends message, specifies described message to store in which message buffer formation in described a plurality of message buffer formation, adopts Zero-copy mode to carry out message then and sends.
5. device according to claim 4 is characterized in that, when receiving message, described message receiver module carries out Hash operation according to source IP address in the heading that is received and purpose IP address.
6. device according to claim 4 is characterized in that, when sending message, moves one or more application programs simultaneously and carries out transmit operation, and each described application program is used different message buffer formations.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009102423141A CN101719872B (en) | 2009-12-11 | 2009-12-11 | Zero-copy mode based method and device for sending and receiving multi-queue messages |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009102423141A CN101719872B (en) | 2009-12-11 | 2009-12-11 | Zero-copy mode based method and device for sending and receiving multi-queue messages |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101719872A true CN101719872A (en) | 2010-06-02 |
CN101719872B CN101719872B (en) | 2012-06-06 |
Family
ID=42434391
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009102423141A Active CN101719872B (en) | 2009-12-11 | 2009-12-11 | Zero-copy mode based method and device for sending and receiving multi-queue messages |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101719872B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102185770A (en) * | 2011-05-05 | 2011-09-14 | 汉柏科技有限公司 | Multi-core-architecture-based batch message transmitting and receiving method |
CN102497322A (en) * | 2011-12-19 | 2012-06-13 | 曙光信息产业(北京)有限公司 | High-speed packet filtering device and method realized based on shunting network card and multi-core CPU (Central Processing Unit) |
CN102523164A (en) * | 2011-12-19 | 2012-06-27 | 曙光信息产业(北京)有限公司 | System and method for implementing complex homologous and homoclinic flow division in network card |
CN102567226A (en) * | 2011-12-31 | 2012-07-11 | 曙光信息产业股份有限公司 | Data access implementation method and data access implementation device |
CN102970244A (en) * | 2012-11-23 | 2013-03-13 | 上海寰创通信科技股份有限公司 | Network message processing method of multi-CPU (Central Processing Unit) inter-core load balance |
CN106656863A (en) * | 2016-12-31 | 2017-05-10 | 广东欧珀移动通信有限公司 | Business monitoring method and apparatus, and computer device |
CN109783250A (en) * | 2018-12-18 | 2019-05-21 | 中兴通讯股份有限公司 | A kind of message forwarding method and the network equipment |
-
2009
- 2009-12-11 CN CN2009102423141A patent/CN101719872B/en active Active
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102185770A (en) * | 2011-05-05 | 2011-09-14 | 汉柏科技有限公司 | Multi-core-architecture-based batch message transmitting and receiving method |
CN102497322A (en) * | 2011-12-19 | 2012-06-13 | 曙光信息产业(北京)有限公司 | High-speed packet filtering device and method realized based on shunting network card and multi-core CPU (Central Processing Unit) |
CN102523164A (en) * | 2011-12-19 | 2012-06-27 | 曙光信息产业(北京)有限公司 | System and method for implementing complex homologous and homoclinic flow division in network card |
CN102523164B (en) * | 2011-12-19 | 2015-09-23 | 曙光信息产业(北京)有限公司 | A kind of system realizing the shunting of complex homologous chummage in network interface card |
CN102567226A (en) * | 2011-12-31 | 2012-07-11 | 曙光信息产业股份有限公司 | Data access implementation method and data access implementation device |
CN102970244A (en) * | 2012-11-23 | 2013-03-13 | 上海寰创通信科技股份有限公司 | Network message processing method of multi-CPU (Central Processing Unit) inter-core load balance |
CN102970244B (en) * | 2012-11-23 | 2018-04-13 | 上海寰创通信科技股份有限公司 | A kind of network message processing method of multi -CPU inter-core load equilibrium |
CN106656863A (en) * | 2016-12-31 | 2017-05-10 | 广东欧珀移动通信有限公司 | Business monitoring method and apparatus, and computer device |
CN109783250A (en) * | 2018-12-18 | 2019-05-21 | 中兴通讯股份有限公司 | A kind of message forwarding method and the network equipment |
CN109783250B (en) * | 2018-12-18 | 2021-04-09 | 中兴通讯股份有限公司 | Message forwarding method and network equipment |
Also Published As
Publication number | Publication date |
---|---|
CN101719872B (en) | 2012-06-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101719872B (en) | Zero-copy mode based method and device for sending and receiving multi-queue messages | |
EP3068087B1 (en) | Method and system for transmitting data parallelly on wireless link and wired link | |
US7756990B2 (en) | Configurable protocol engine | |
CN102761905B (en) | Message treatment method, equipment and system | |
WO2011137783A1 (en) | Data processing method, apparatus and system | |
US7213045B2 (en) | Apparatus and method for transmit transport protocol termination | |
CN111541749B (en) | Data communication method and system of embedded equipment and related equipment | |
CN110506403A (en) | Flow control for wireless device | |
CN111817826A (en) | Side link information transmission method, terminal and control node | |
CN110661840A (en) | Management delegation of transmission and acknowledgement of frames | |
CN102137441B (en) | method, device and system for data transmission | |
WO2017045501A1 (en) | Packet scheduling method and apparatus, and storage medium | |
US20180083777A1 (en) | Methods, systems, apparatuses, and devices for securing network communications using multiple security protocols | |
CN104012162A (en) | Location privacy in communication networks | |
CN102348203A (en) | Method for realizing encryption synchronization | |
CN109067506A (en) | A kind of lightweight asynchronous message implementation method concurrent based on multi-slide-windows mouth | |
CN102427452A (en) | Synchronize (SYN) message transmitting method and device and network equipment | |
US8270288B2 (en) | Method of parallel wireless communication | |
CN102694727A (en) | Method and device for realizing transmission acceleration of network data packets | |
CN105591975A (en) | Message processing method and apparatus | |
CN109274467A (en) | A kind of data retransmission processing method, RLC entity and MAC entity | |
CN112512031A (en) | Data acquisition method applied to 5G network and 5G network | |
CN1856956A (en) | Data encryption method and apparatus | |
CN104836674B (en) | For ensuring the more multicast network systems and method of reliability | |
CN110915179B (en) | Processing device, communication device and corresponding method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20220722 Address after: 100193 No. 36 Building, No. 8 Hospital, Wangxi Road, Haidian District, Beijing Patentee after: Dawning Information Industry (Beijing) Co.,Ltd. Patentee after: DAWNING INFORMATION INDUSTRY Co.,Ltd. Address before: 100084 No. 6 South Road, Zhongguancun Academy of Sciences, Beijing, Haidian District Patentee before: Dawning Information Industry (Beijing) Co.,Ltd. |