A service processing method and apparatus
By using software-managed buffers and threads with good business processing capabilities or hardware-managed buffers to process packets in network communication, the CPU flow control problem caused by insufficient processing capacity of fragment reassembly threads is solved, and the CPU processing efficiency is improved.
Patent Information
- Application Number
- CN201910327734.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-23
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2040-01-27
AI Technical Summary
In network communication, when the processing capacity of fragment reassembly threads is insufficient, it can cause CPU flow control issues, affecting the normal processing of other services.
Received packets are buffered using a software-managed buffer and processed by threads with good business processing capabilities, or packets are deleted when the hardware-managed buffer is full, thus avoiding the generation of flow control signals.
This reduces or eliminates the impact on the business processing of other threads on the same CPU, improves the CPU's processing capacity, and avoids the occurrence of flow control phenomena.
Smart Images

Figure CN111831403B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The embodiment of the present application relates to, but is not limited to, the field of network communication equipment, in particular to a service processing method and device. BACKGROUND
[0002] In network application, when the length of a message is greater than a maximum transmission unit (MTU, Maximum Transmission Unit), the message needs to be fragmented, and reassembly is a reverse process of fragmentation, which restores several fragmented packets belonging to the same message into the original message, and determines whether the fragmented packets belong to the same original message according to whether the source IP address, the destination IP address, the message ID and the protocol number in the Internet Protocol (IP, Internet Protocol) header are the same. Generally, reassembly is performed on a device (destination node) that terminates the message, and the intermediate node does not need to perform the fragmented packet reassembly operation. However, according to the Carrier Grade Network Address Translation (CGN, Carrier Grade Network Address Translation (NAT, Network Address Translation)) service attribute, when the NAT44 conversion is performed, if the Port Address Translation (PAT, Port Address Translation) is performed, the message is incorrect after the conversion because there is no Port information in the fragmented message, so the PAT needs to be performed after the reassembly, and therefore the CGN service generally has a function related to the fragmentation reassembly. Generally, the message that needs to be fragmented and reassembled is less in the network and occupies more CPU resources, so a thread is generally opened in the CGN service process for the fragmentation reassembly service.
[0003] However, in the existing network, a large number of fragmented messages that need to be reassembled often appear, which causes the CPU to generate flow control when the processing capacity of the thread for fragmentation reassembly is insufficient, and directly affects the normal processing of other services such as the CGN message on the same CPU. SUMMARY
[0004] The embodiment of the present application provides a service processing method and device, which can reduce or even eliminate the influence on the service processing of other threads on the same CPU when the service processing capacity of a certain thread is insufficient.
[0005] The embodiment of the present application provides a service processing method, which comprises the following steps:
[0006] For each received message, when it is determined that there is a free cache in the first cache area, the message is cached in the free cache in the first cache area; wherein the first cache area is a software-managed cache area;
[0007] The second thread processes the messages in the first cache area.
[0008] The embodiment of the present application provides a service processing device, comprising:
[0009] The packet cache module is configured to, for each received packet, cache the packet into a free cache in the first cache area when it is determined that there is a free cache in the first cache area; wherein the first cache area is a software managed cache area.
[0010] The packet processing module is configured to perform service processing on the packets in the first cache area through the second thread.
[0011] The embodiment of the present application provides a service processing device, comprising a processor and a computer readable storage medium, and the computer readable storage medium stores instructions, and when the instructions are executed by the processor, the above-mentioned any service processing method is implemented.
[0012] The embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned any service processing method are implemented.
[0013] The embodiment of the present application comprises: for each received packet, when it is determined that there is a free cache in the first cache area, the packet is cached into the free cache in the first cache area; wherein the first cache area is a software managed cache area; and service processing is performed on the packets in the first cache area through the second thread. The embodiment of the present application realizes the caching of the packet through the software managed first cache area, and since the software managed first cache area does not generate a flow control signal when it is full, the influence on the service processing of other threads on the same CPU as the second thread is reduced or even eliminated when the service processing capability of the second thread is insufficient.
[0014] In another embodiment, when there is no free cache in the first cache area, the method further comprises discarding the packet. The embodiment of the present application releases the cache in the first cache area as soon as possible when the service processing capability is insufficient, and further reduces or even eliminates the influence on the service processing of other threads on the same CPU as the second thread when the service processing capability of the second thread is insufficient.
[0015] In another embodiment, before determining, by one of the N first threads, that there is a free cache in the first cache area corresponding to the one of the N first threads or the message type, the method further comprises: caching the message in a second cache area corresponding to the one of the N first threads; wherein the second cache area is a hardware-managed cache area; and after caching, by the one of the N first threads, the message in the free cache in the first cache area corresponding to the one of the N first threads or the message type, the method further comprises: deleting, by the one of the N first threads, the message in the second cache area. In the embodiment of the present application, the message is cached in the second cache area of the first thread. Since the second cache area is a hardware-managed cache area, once the second cache area is full, a flow control signal will be generated. Therefore, after the message is cached in the free cache in the first cache area, the message in the second cache area needs to be deleted, so as not to affect the second cache area, and further reduce or even eliminate the impact on the service processing of other threads on the same CPU as the second thread when the service processing capability of the second thread is insufficient.
[0016] In another embodiment, before determining, by one of the N first threads, that there is a free cache in the first cache area corresponding to the one of the N first threads or the message type, the method further comprises: caching the message in a second cache area corresponding to the one of the N first threads; wherein the second cache area is a hardware-managed cache area; and after caching, by the one of the N first threads, the message in the free cache in the first cache area corresponding to the one of the N first threads or the message type, the method further comprises: deleting, by the one of the N first threads, the message in the second cache area. In the embodiment of the present application, the message is cached in the second cache area of the first thread. Since the second cache area is a hardware-managed cache area, once the second cache area is full, a flow control signal will be generated. Therefore, after the message is cached in the free cache in the first cache area, the message in the second cache area needs to be deleted, so as not to affect the second cache area, and further reduce or even eliminate the impact on the service processing of other threads on the same CPU as the second thread when the service processing capability of the second thread is insufficient.
[0017] Other features and advantages of the embodiments of the present application will be set forth in the following description, and in part will become apparent from the description, or can be learned by practice of the embodiments of the present application. The objects and other advantages of the embodiments of the present application will be realized and achieved by means specified in the description, claims and drawings. BRIEF DESCRIPTION OF DRAWINGS
[0018] The accompanying drawings are included to provide a further understanding of the technical solutions of the embodiments of the present application, and constitute a part of the specification, and are used to explain the technical solutions of the embodiments of the present application together with the embodiments of the present application, and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0019] Figure 1 A flowchart of a service processing method according to an embodiment of the present application;
[0020] Figure 2(a) is a schematic diagram of a service processing procedure according to an embodiment of the present application Figure 1 ;
[0021] Figure 2(b) is a schematic diagram of a service processing procedure according to another embodiment of the present application
[0022] Figure 3 Figure 3 is a schematic diagram of a service processing device according to another embodiment of the present application DETAILED DESCRIPTION
[0023] The embodiments of the present application will be described in detail hereinafter with reference to the drawings. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0024] The steps shown in the flowcharts of the drawings can be executed in a computer system such as a set of computer executable instructions. Moreover, although the logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0025] Referring to Figure 1 , one embodiment of the present application provides a service processing method, comprising:
[0026] Step 100, for each received packet, when it is determined that there is a free cache in the first cache area, the packet is cached in the free cache in the first cache area; wherein the first cache area is a software managed cache area.
[0027] In the embodiment of the present application, whether there is a free cache in the first cache area can be determined by applying for a cache from a cache manager. The cache manager manages the caches in the first cache area at the software level.
[0028] In the embodiment of the present application, the first cache area can be any one of the following: a circular queue, a sequential queue, etc. Of course, the first cache area can also be other data structures, and the embodiments of the present application do not limit this, and the specific data structure form does not limit the protection scope of the embodiments of the present application.
[0029] Step 101, performing service processing on the packets in the first cache area by the second thread.
[0030] In the embodiment of the present application, the second thread is a thread in which service processing capability is insufficient. For example, the second thread can include at least one of a fragmentation reassembly thread, a CGN thread, an Internet Protocol Security (IPSec) thread, and a thread for processing the same service. Of course, the embodiment of the present application is not limited to the fragmentation reassembly thread, the NAT thread, the IPSec thread, and the thread for processing the same service, and any thread in which service processing capability is insufficient is within the protection scope of the embodiment of the present application.
[0031] In the embodiment of the present application, when the second thread is a fragmentation reassembly thread, before determining that the first cache area corresponding to the message type of the message has free cache, the method further includes determining that the message is a message that needs fragmentation reassembly.
[0032] In another embodiment of the present application, when the message is not a message that needs fragmentation reassembly, the method further includes processing the message according to another processing flow.
[0033] In the embodiment of the present application, whether the message is a message that needs fragmentation reassembly can be determined by analyzing the message type.
[0034] The embodiment of the present application realizes message caching through the software-managed first cache area. When the software-managed first cache area is full, no flow control signal is generated, and when the service processing capability of the second thread is insufficient, the influence on the service processing of other threads on the same CPU as the second thread is reduced or even eliminated.
[0035] In the embodiment of the present application, step 100 can be performed by one of the N first threads. That is, determining that the first cache area has free cache includes:
[0036] Determining, by one of the N first threads, that the first cache area corresponding to the message type of the message has free cache; wherein N is an integer greater than or equal to 1, and the first thread is a thread with better service processing capability;
[0037] Alternatively, determining, by the one first thread, that the first cache area corresponding to the one first thread has free cache;
[0038] The step of caching the message into the free cache in the first cache area includes:
[0039] Caching, by one of the N first threads, the message into the free cache in the first cache area corresponding to the message type;
[0040] Or, the message is cached into the space of the first cache area corresponding to the one first thread by the one first thread.
[0041] When the step 100 is performed by one first thread of the N first threads, the message is cached by the thread with better service processing capability, the service processing capability of the second thread is shared, and the influence on the service processing of other threads on the same CPU as the second thread is further reduced or even eliminated when the service processing capability of the second thread is insufficient.
[0042] In another embodiment of the present application, before the message type or the idle cache in the first cache area corresponding to the one first thread is determined by the one first thread of the N first threads, the method further comprises:
[0043] The message is cached into the second cache area corresponding to the one first thread of the N first threads; wherein the second cache area is a hardware-managed cache area.
[0044] After the message is cached into the idle cache in the first cache area corresponding to the one first thread of the N first threads, the method further comprises: the message in the second cache area is deleted by the one first thread of the N first threads.
[0045] In the embodiment of the present application, different messages can be cached into the second cache area corresponding to different first threads of the N first threads; and / or different messages can also be cached into the second cache area corresponding to the same first thread of the N first threads.
[0046] In the embodiment of the present application, the N first threads comprise at least one of the following: a service thread processed by a multi-thread, a service thread processed by a single thread.
[0047] The service thread comprises at least one of the following: a main service thread, a secondary service thread.
[0048] That is, the first thread can be any other thread with better service processing capability than the second thread, such as a NAT thread.
[0049] In the embodiment of the present application, the message is cached by the second cache area of the first thread. Since the second cache area is a hardware-managed cache area, once the second cache area is full, a flow control signal will be generated. Therefore, after the message is cached into the idle cache in the first cache area, the message in the second cache area needs to be deleted, so as not to affect the second cache area, and further reduce or even eliminate the influence on the service processing of other threads on the same CPU as the second thread when the service processing capability of the second thread is insufficient.
[0050] In the embodiments of the present application, the first cache area satisfies at least one of the following conditions:
[0051] The N first threads correspond to one first cache area;
[0052] M second threads correspond to one first cache area; in this case, the M second threads can be used to process services of the same service type (or message type);
[0053] The N first threads correspond to N first cache areas;
[0054] M second threads correspond to M first cache areas;
[0055] One first thread corresponds to one first cache area; in this case, a first cache area is created between each first thread and second thread, and therefore, there are N first cache areas in total;
[0056] One second thread corresponds to one first cache area; in this case, a first cache area is created between each second thread and first thread, and therefore, there are M first cache areas in total, and different second threads can be used to process services of different service types (or message types).
[0057] In the embodiments of the present application, when the N first threads correspond to N first cache areas, or one second thread corresponds to one first cache area, the messages can be cached in the N first cache areas corresponding to the N first threads by polling or other methods during caching.
[0058] When the N first threads correspond to N first cache areas, or one first thread corresponds to one first cache area, the second thread can use a polling method or other methods to process the messages in the N first cache areas.
[0059] In the embodiments of the present application, the cache size of the first cache area can be configured according to the actual processing capacity of the second thread.
[0060] In another embodiment of the present application, when there is no idle cache in the first cache area, the method further comprises discarding the message. That is, when the caches in the first cache area are exhausted, the message is discarded directly without being sent to the second thread, so that the generation of the flow control signal of the virtual central processing unit (VCPU, Virtual CPU) of the second thread is controlled, thereby reducing or even eliminating the influence on the service processing of other threads on the same CPU as the second thread.
[0061] For example, as shown in Fig. 2(a), in the CGN service process, normally, there are less packets of fragmentation reassembly service, so 40 NAT threads and 1 fragmentation reassembly thread are allocated. Then a ring is created between each NAT thread and fragmentation reassembly thread, and there are 40 rings in total, each of which contains 128 buffers for buffering packets.
[0062] After receiving the packet, the packet distribution engine fcm distributes the packet to the buffer area (i.e. the second buffer area) of the VCPU (i.e. the CGN VCPU in Fig. 2(a)) of each NAT thread according to the polling method. The NAT thread analyzes the type of the packet and finds that the packet is a packet of fragmentation reassembly service, and then applies for a buffer from the ring manager (i.e. the POPQ in Fig. 2). If there is a free buffer, the buffer area of the VCPU of the NAT thread is replaced with the applied buffer (i.e. the packet stored in the buffer area of the VCPU of the NAT thread is buffered in the applied buffer, and the packet stored in the buffer area of the VCPU of the NAT thread is deleted). If the ring is full and the free buffer cannot be applied, the packet is directly discarded.
[0063] The fragmentation reassembly thread processes the packet in the ring according to the polling method, and at most 10 buffers are read from the ring at one time to ensure the reassembly of the message.
[0064] For example, as shown in Fig. 2(b), there are multiple service threads (including fragmentation reassembly thread, NAT thread and IPSec thread) that affect each other, and a service distribution thread is used to distribute packets of different services. There is a ring buffer between the VCPU of each service and the service distribution VCPU. The service distribution thread buffers the packet in the corresponding ring buffer according to the type of the packet, and the service thread processes the packet in the ring buffer.
[0065] The size of the ring buffer can be configured according to the actual processing capacity of the service thread, so that the processing capacity of each service thread will not affect other VCPUs.
[0066] Referring to Figure 3 , another embodiment of the present application provides a service processing device, comprising:
[0067] The packet buffering module 301 is configured to, for each received packet, buffer the packet in the free buffer in the first buffer area when it is determined that there is a free buffer in the first buffer area; wherein the first buffer area is a software-managed buffer area.
[0068] The message processing module 302 is configured to perform service processing on the message in the first cache area through the second thread.
[0069] In the embodiment of the present application, the message cache module 301 can determine whether there is a free cache in the first cache area by applying for a cache from a cache manager. The cache manager manages the caches in the first cache area at a software level.
[0070] In the embodiment of the present application, the first cache area can be any one of a circular queue, a sequential queue, etc. Of course, the first cache area can also be other data structures, and the embodiment of the present application does not limit the specific data structure form, and the specific data structure form does not limit the protection scope of the embodiment of the present application.
[0071] In the embodiment of the present application, the second thread is a thread in a case where service processing capability is insufficient. For example, the second thread can include at least one of a fragmentation reassembly thread, a CGN thread, an Internet Protocol Security (IPSec) thread, and a thread for processing the same service. Of course, the embodiment of the present application does not limit the second thread to the fragmentation reassembly thread, the NAT thread, the IPSec thread, and the thread for processing the same service, but any thread in a case where service processing capability is insufficient is within the protection scope of the embodiment of the present application.
[0072] In the embodiment of the present application, when the second thread is a fragmentation reassembly thread, the message cache module 301 is further configured to determine that the message is a message that needs fragmentation reassembly.
[0073] In another embodiment of the present application, the message cache module 301 is further configured to perform service processing on the message according to another processing flow when the message is not a message that needs fragmentation reassembly.
[0074] In the embodiment of the present application, the message cache module 301 can determine whether the message is a message that needs fragmentation reassembly by analyzing the message type.
[0075] The embodiment of the present application realizes message caching through the software-managed first cache area. When the software-managed first cache area is full, no flow control signal is generated, and when the service processing capability of the second thread is insufficient, the influence on the service processing of other threads on the same CPU as the second thread is reduced or even eliminated.
[0076] In the embodiment of the present application, the message cache module 301 can execute step 100 through one of the N first threads. That is, the message cache module 301 is specifically configured to:
[0077] determining, by one of the N first threads, that there is a free cache in the first cache area corresponding to the message type of the message; wherein N is an integer greater than or equal to 1, and the first thread is a thread with better service processing capability; and caching, by the one of the N first threads, the message into the free cache in the first cache area corresponding to the message type of the message.
[0078] Alternatively, determining, by the one first thread, that there is a free cache in the first cache area corresponding to the one first thread; and caching, by the one first thread, the message into the free cache in the first cache area corresponding to the one first thread.
[0079] When step 100 is performed by one of the N first threads, the caching of the message is implemented by a thread with better service processing capability, thereby sharing the service processing capability of the second thread, and further reducing or even eliminating the impact on the service processing of other threads on the same CPU as the second thread when the service processing capability of the second thread is insufficient.
[0080] In another embodiment of the present application, the message caching module 301 is further configured to:
[0081] cache the message into a second cache area corresponding to one of the N first threads; wherein the second cache area is a hardware-managed cache area.
[0082] After the message is cached into the free cache in the first cache area by one of the N first threads, the message in the second cache area is deleted by one of the N first threads.
[0083] In an embodiment of the present application, different messages can be cached into second cache areas corresponding to different first threads of the N first threads; and / or different messages can also be cached into a second cache area corresponding to the same first thread of the N first threads.
[0084] In an embodiment of the present application, the N first threads include at least one of the following: a multi-threaded service thread, a single-threaded service thread.
[0085] The service thread includes at least one of the following: a main service thread, a secondary service thread.
[0086] That is, the first thread can be any other thread with better service processing capability than the second thread, such as a NAT thread.
[0087] The embodiment of the present application caches the packet through the second cache area of the first thread. Since the second cache area is a hardware managed cache area, once the second cache area is full, a flow control signal will be generated. Therefore, after the packet is cached in the idle cache of the first cache area, the packet in the second cache area needs to be deleted, so as to not affect the second cache area, and further reduce or even eliminate the impact on the service processing of other threads on the same CPU as the second thread when the service processing capability of the second thread is insufficient.
[0088] In the embodiment of the present application, the first cache area satisfies at least one of the following:
[0089] The N first threads correspond to one first cache area;
[0090] The M second threads correspond to one first cache area; in this case, the M second threads can be used to process services of the same service type (or packet type);
[0091] The N first threads correspond to N first cache areas;
[0092] The M second threads correspond to M first cache areas;
[0093] One first thread corresponds to one first cache area; in this case, a first cache area is created between each first thread and second thread, and therefore, there are N first cache areas in total;
[0094] One second thread corresponds to one first cache area; in this case, a first cache area is created between each second thread and first thread, and therefore, there are M first cache areas in total, and different second threads can be used to process services of different service types (or packet types).
[0095] In the embodiment of the present application, when the N first threads correspond to N first cache areas, or one second thread corresponds to one first cache area, the packet can be cached in the N second cache areas corresponding to the N first threads through polling or other methods during caching.
[0096] When the N first threads correspond to N first cache areas, or one first thread corresponds to one first cache area, the second thread can use polling or other methods to process the packets in the N first cache areas.
[0097] In the embodiment of the present application, the cache size of the first cache area can be configured according to the actual processing capability of the second thread.
[0098] In another embodiment of the present application, the packet buffering module 301 is further configured to discard the packet when there is no free buffer in the first buffer area. That is, when the buffers in the first buffer area are exhausted, the packet is discarded directly without being sent to the second thread, so that the generation of the flow control signal of the virtual CPU (VCPU, Virtual CPU) of the second thread is controlled, thereby reducing or even eliminating the impact on the service processing of other threads on the same CPU as the second thread.
[0099] In another embodiment of the present application, a service processing apparatus is provided, which comprises a processor and a computer readable storage medium, and the computer readable storage medium stores instructions which, when executed by the processor, implement any of the above service processing methods.
[0100] In another embodiment of the present application, a computer readable storage medium is provided, which stores a computer program, and the computer program, when executed by a processor, implements the steps of any of the above service processing methods.
[0101] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the functional modules / units in the system and the apparatus can be implemented as software, firmware, hardware or appropriate combination thereof. In the hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component can have multiple functions, or one function or step can be performed by several physical components in cooperation. Some or all of the components can be implemented as software executed by a processor such as a digital signal processor or a microprocessor, or as hardware, or as an integrated circuit such as an application specific integrated circuit. Such software can be distributed on a computer readable medium, which can include computer storage media (or non-transitory media) and communication media (or transitory media). As known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, as known to those skilled in the art, communication media typically includes computer readable instructions, data structures, program modules or other data in modulated data signals such as carrier waves or other transport mechanisms, and can include any information delivery medium.
[0102] Although the embodiments of the present application have been disclosed with reference to the above embodiments, the above description is merely used to understand the embodiments of the present application and is not used to limit the embodiments of the present application. Any modification and change in the form and details of the embodiments of the present application, which is made by any person skilled in the art without departing from the spirit and scope of the embodiments of the present application, should be considered as within the scope of the embodiments of the present application. The patent protection scope of the embodiments of the present application should be subject to the scope defined by the claims.
Claims
1. A service processing method, comprising: storing each received packet into a second buffer area corresponding to a first thread, wherein the second buffer area is a hardware-managed buffer area; when determining, by the first thread, that there is a free buffer in a first buffer area, storing, by the first thread, the packet processed by a second thread into the free buffer in the first buffer area and deleting the packet in the second buffer area which has been stored into the first buffer area, wherein the first buffer area is a software-managed buffer area, the second thread is a thread in a case of insufficient service processing capacity, and the first thread is a thread other than the second thread and having better service processing capacity; processing, by the second thread, the packet in the first buffer area.
2. The method of claim 1, wherein, when there is no free buffer in the first buffer area, the method further comprises discarding the packet.
3. The method according to claim 1 or 2, characterized in that, wherein the determining, by the first thread, that there is a free buffer in the first buffer area comprises: determining, by one of N first threads, that there is a free buffer in the first buffer area corresponding to a packet type of the packet, wherein N is an integer greater than or equal to 1; or determining, by the one of the first threads, that there is a free buffer in the first buffer area corresponding to the one of the first threads. the storing, by the first thread, the packet processed by the second thread into the free buffer in the first buffer area comprises: storing, by one of N first threads, the packet processed by a second thread into a free buffer in the first buffer area corresponding to a packet type of the packet; or storing, by the one of the first threads, the packet processed by the second thread into a free buffer in the first buffer area corresponding to the one of the first threads.
4. The method of claim 3, wherein, wherein the first buffer area satisfies at least one of the following: the N first threads correspond to one first buffer area; M second threads correspond to one first buffer area; the N first threads correspond to N first buffer areas; M second threads correspond to M first buffer areas; one first thread corresponds to one first buffer area; and one second thread corresponds to one first buffer area.
5. The method of claim 3, wherein, wherein different packets are stored into different second buffer areas corresponding to different first threads of the N first threads; and / or different packets are stored into the second buffer area corresponding to the same first thread of the N first threads.
6. The method of claim 3, wherein, wherein the N first threads comprise at least one of the following: a multi-thread service thread and a single-thread service thread. wherein the service thread comprises at least one of the following: a main service thread and a secondary service thread.
7. The method of claim 1, wherein, wherein the second thread comprises at least one of the following: a fragmentation and reassembly thread, a network address translation (NAT) thread, an internet protocol security (IPSec) thread, and a thread for processing the same service.
8. The method of claim 7, wherein, when the second thread is the fragmentation and reassembly thread, the method further comprises, before determining that there is a free buffer in the first buffer area corresponding to a packet type of the packet, determining that the packet is a packet requiring fragmentation and reassembly.
9. The method of claim 1 or 2, wherein, The first cache area includes any one of the following: a ring queue, a sequential queue.
10. A service processing apparatus, comprising: a packet cache module, configured to cache each received packet into a second cache area corresponding to a first thread; wherein the second cache area is a hardware-managed cache area; when it is determined by the first thread that there is a free cache in a first cache area, the first thread caches the packet processed by a second thread into the free cache in the first cache area and deletes the packet in the second cache area which has been cached into the first cache area; wherein the first cache area is a software-managed cache area, the second thread is a thread in a case where service processing capability is insufficient, and the first thread is another thread which has better service processing capability than the second thread; a packet processing module, configured to process the packet in the first cache area by the second thread.
11. A service processing apparatus comprising a processor and a computer readable storage medium having stored therein instructions, wherein, When the instructions are executed by the processor, the service processing method according to any one of claims 1-9 is implemented.
12. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the service processing method according to any one of claims 1-9.
Citation Information
Patent Citations
Message distributing method and device of multi-core system
CN102148757A
Data processing method and device
CN103166845A
Message processing method, device, switch device and storage medium
CN109495404A