Message processing method, device and equipment and computer readable storage medium
Patent Information
- Application Number
- CN202211295080.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-21
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2042-10-21
AI Technical Summary
[0006]2、当应用特别多时,接收包转向表中需要修改的表项会很多,也会影响报文处理性能
[0052] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the methods according to the first and/or second aspects of this disclosure.
Smart Images

Figure CN117917882B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of information processing, and more particularly to the field of message processing technology. Background Technology
[0002] Currently, to improve processing capabilities, many devices are equipped with multiple processors (CPUs, central processing units). Different applications on these devices may run on different processors to achieve load balancing. In this case, upon receiving a message from another device, to achieve efficient message processing, the corresponding uploading processor is first selected and designated as the message processor. This message processor buffers the message, thereby determining the corresponding receiving application. The message processor then enables the receiving application to retrieve the message, allowing devices with multiple processors to quickly transmit and process it.
[0003] However, in reality, due to various reasons, the selected message processor and the processor where the receiving application resides may not be the same processor. In this case, the processor where the receiving application resides needs to buffer the message again before the receiving application can obtain the message. This increases the number of message buffering operations, thus significantly impacting the device's high-speed buffering and affecting packet reception performance. Therefore, to improve packet reception performance, it is necessary to update the receive packet redirection table (e.g., ...). Figure 1 The SOCK_RPS entry shown, where RPS stands for Receive Packet Steering and SOCK stands for Socket, updates the packet handler in the receive packet steering table corresponding to that packet to the handler where the receiving application (APP) resides. Figure 1 As shown, this is done to ensure that when a similar message is received, the processor selected by the receive packet redirection table is the same as the processor where the application resides, thereby making full use of the device's high-speed buffer to achieve the best optimization effect.
[0004] This leads to the following problems:
[0005] 1. If different applications are interested in the same packets, and these applications run on different processors, it will lead to frequent modifications to the receive packet redirection table, such as... Figure 2 As shown, if both APP1 (application 1) and APP2 (application 2) are interested in the message, and both APP1 and APP2 find that their processors are inconsistent with the message processor selected through the table entry, then the receive packet redirection table needs to be modified twice. In this case, the message processing performance will not improve or may even deteriorate.
[0006] 2. When there are a lot of applications, many entries in the receive packet redirection table need to be modified, which will also affect the packet processing performance. Summary of the Invention
[0007] This disclosure provides a message processing method, apparatus, device, storage medium, and vehicle.
[0008] According to a first aspect of this disclosure, a message processing method is provided. The method includes:
[0009] A message to be processed is received, the message containing message attributes;
[0010] Based on the received packet redirection table, select the packet processor corresponding to the message to be processed from multiple processors;
[0011] Read the message attributes from the message to be processed;
[0012] Based on the message attributes of the message to be processed, determine the receiving application corresponding to the message to be processed from multiple applications;
[0013] If the processor where the receiving application resides is different from the message processor, then the priority of the receiving application is confirmed.
[0014] Compare the priority with the preset priority;
[0015] If the priority is greater than the preset priority, the receive packet redirection table is updated; otherwise, the receive packet redirection table is not updated. The receive packet redirection table stores the correspondence between packets and processors and is used to select the packet processor.
[0016] In addition to the aspects and any possible implementations described above, a further implementation is provided in which, after selecting the message processor corresponding to the message to be processed, the method further includes:
[0017] Add the identifier of the message processor to the message to be processed; and
[0018] The identifier of the processor in which the receiving application resides is determined;
[0019] If the processor where the receiving application resides is different from the message processor, then the priority of the receiving application is confirmed, including:
[0020] If the identifier of the processor determined by the receiving application is inconsistent with the identifier of the message processor added to the message to be processed, then the priority of the receiving application is confirmed.
[0021] In addition to the aspects and any possible implementations described above, an implementation is further provided in which the preset priority includes: an application priority threshold or the priority of the application that last received a message of the same type as the message to be processed;
[0022] The step of updating the receive packet redirection table if the priority is greater than the preset priority includes:
[0023] If the priority is greater than the application priority threshold, then update the receive packet redirection table;
[0024] or
[0025] If the priority is greater than the priority of the application that last received a message of the same type as the message to be processed, then the receive packet redirection table is updated.
[0026] In addition to the aspects and any possible implementations described above, an implementation is further provided in which the preset priority includes: an application priority threshold and the priority of the application that last received a message of the same type as the message to be processed;
[0027] The step of updating the receive packet redirection table if the priority of the receiving application is greater than the preset priority includes:
[0028] If the priority of the receiving application is greater than the application priority threshold, then the priority of the receiving application is compared with the priority of the application that last received a message of the same type as the message to be processed.
[0029] If the priority of the receiving application is higher than the priority of the application that last received a message of the same type as the message to be processed, then the receiving packet redirection table is updated.
[0030] As described above and in any possible implementation, a further implementation is provided in which updating the received packet redirection table includes:
[0031] Update the message processor corresponding to the message to be processed recorded in the received packet redirection table to the processor where the receiving application is located.
[0032] In addition to the aspects described above and any possible implementations, a further implementation is provided in which the receive packet redirection table includes a first receive packet redirection table and a second receive packet redirection table, wherein,
[0033] The query level of the first receive packet redirection table is higher than the query level of the second receive packet redirection table;
[0034] The step of updating the packet processor corresponding to the message to be processed recorded in the received packet redirection table to the processor where the receiving application resides includes:
[0035] The message processor corresponding to the message to be processed recorded in the first receive packet redirection table is updated to the processor where the receiving application is located. The correspondence between messages and processors stored in the second receive packet redirection table is different from the correspondence between messages and processors stored in the first receive packet redirection table.
[0036] As described above and in any possible implementation, a further implementation is provided, wherein selecting the message processor corresponding to the message to be processed from a plurality of processors based on a received packet redirection table includes:
[0037] Based on the first received packet redirection table and the message to be processed, the message processor is selected from the plurality of processors;
[0038] If the message processor is not found in the first receive packet redirection table, then the message processor is selected from the plurality of processors according to the second receive packet redirection table and the message to be processed;
[0039] If the message processor is not found in the second receive packet redirection table, the message processor is randomly selected from the plurality of processors.
[0040] In addition to the aspects and any possible implementations described above, a further implementation is provided, wherein determining the receiving application of the message to be processed from multiple applications according to the message attributes of the message to be processed includes:
[0041] Obtain the message attributes corresponding to each of the pre-recorded applications;
[0042] Based on the message attributes and the message attributes corresponding to each of the multiple applications, the receiving application is selected from the multiple applications.
[0043] According to a second aspect of this disclosure, a message processing apparatus is provided. The apparatus includes:
[0044] The receiving module is used to receive a message to be processed, the message containing message attributes;
[0045] The selection module is used to select the message processor corresponding to the message to be processed from multiple processors according to the received packet redirection table;
[0046] A reading module is used to read the message attributes from the message to be processed;
[0047] The first determining module is used to determine the receiving application corresponding to the message to be processed from multiple applications according to the message attributes of the message to be processed;
[0048] The second determining module is used to determine the priority of the receiving application if the processor where the receiving application is located is different from the message processor.
[0049] The comparison module is used to compare the priority with a preset priority;
[0050] An update module is used to update the receive packet redirection table if the priority is greater than the preset priority, and otherwise not update the receive packet redirection table. The receive packet redirection table stores the correspondence between packets and processors and is used to select the packet processor.
[0051] According to a third aspect of this disclosure, an electronic device is provided. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method described above.
[0052] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the methods according to the first and / or second aspects of this disclosure.
[0053] According to a fifth aspect of this disclosure, a vehicle is provided, the vehicle including a message processing apparatus as described in the second aspect and / or electronic equipment as described in the third aspect.
[0054] In this disclosure, after receiving a message to be processed, a message processor can be selected from multiple processors according to the receive packet redirection table. Then, the message attributes are read from the message to be processed. Based on the message attributes, the receiving application corresponding to the message to be processed is determined from multiple applications. Then, it is confirmed whether the processor where the receiving application is located is consistent with the message processor. If they are inconsistent, the priority of the receiving application is confirmed. Then, the priority is compared with a preset priority. If the priority of the receiving application is greater than the preset priority, the receive packet redirection table is updated. Otherwise, the receive packet redirection table is not updated. In this way, if it is confirmed that some receiving applications have low priorities, the receive packet redirection table will not be updated because of these low-priority receiving applications, but only because of high-priority receiving applications. This reduces the modification frequency of the receive packet redirection table, and the number of entries that need to be modified in the receive packet redirection table will naturally decrease, thereby improving message processing performance.
[0055] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0056] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. The drawings are provided for a better understanding of the invention and are not intended to limit the scope of this disclosure. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0057] Figure 1 A flowchart of a message processing method in the prior art is shown;
[0058] Figure 2 A flowchart of another message processing method in the prior art is shown;
[0059] Figure 3 A flowchart of a message processing method according to an embodiment of the present disclosure is shown;
[0060] Figure 4 A flowchart of another message processing method according to an embodiment of the present disclosure is shown;
[0061] Figure 5 A flowchart of yet another message processing method according to an embodiment of the present disclosure is shown;
[0062] Figure 6 A flowchart of another message processing method according to an embodiment of the present disclosure is shown;
[0063] Figure 7 A flowchart of another message processing method according to an embodiment of the present disclosure is shown;
[0064] Figure 8 A block diagram of a message processing apparatus according to an embodiment of the present disclosure is shown;
[0065] Figure 9 A block diagram of an exemplary electronic device capable of implementing embodiments of the present disclosure is shown. Detailed Implementation
[0066] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0067] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0068] Figure 3 A flowchart of a message processing method 300 according to an embodiment of the present disclosure is shown. Method 300 is applicable to the operating systems of various terminals having multiple processors, such as vehicles, and may include:
[0069] Step 310: Receive a message to be processed, the message containing message attributes;
[0070] The messages to be processed can come from other devices.
[0071] Step 320: Select the message processor corresponding to the message to be processed from multiple processors according to the received packet redirection table;
[0072] A packet forwarding table is a table, in formats including but not limited to Excel, that records the correspondence between packets and processors. This table is used to select a packet processor. Specifically, the packet forwarding table may record the correspondence between packet types and processor identifiers, so that the corresponding packet processor can be determined by querying the packet forwarding table based on the type of the packet to be processed. The packet type includes, but is not limited to, packet attributes or hash values calculated based on the packet attributes.
[0073] For example, a packet forwarding table can store the correspondence between the hash value of a message and the identifier of the processor (such as number, model, name or a combination thereof). This hash value can be calculated using a quadruple (source IP, source port number, destination IP, destination port number), where IP stands for Internet Protocol Address.
[0074] Preferably, if there is a packet forwarding table and the type of the message to be processed can be found in the packet forwarding table, then the processor should be determined as the message processor to process (buffer, forward) the message to be processed based on the packet forwarding table and the type of the message to be processed.
[0075] If there is no receive packet redirection table, or if there is a receive packet redirection table but the type of the message to be processed cannot be found from it, a processor is randomly selected from multiple processors as the message processor to process (buffer, forward) the message to be processed. Then, a receive packet redirection table is created or updated according to the identifier of the randomly selected processor and the type of the message to be processed.
[0076] Step 330: Read the message attributes from the message to be processed;
[0077] Step 340: Determine the receiving application corresponding to the message to be processed from multiple applications according to the message attributes of the message to be processed;
[0078] Step 350: If the processor where the receiving application is located is different from the message processor, then the priority of the receiving application is confirmed.
[0079] The receiving application refers to the application that will ultimately receive and respond to the message.
[0080] The processor on which the receiving application runs is the processor on which the receiving application resides.
[0081] The fact that the processor where the receiving application is located is different from the message processor means that the processor where the receiving application is located and the message processor are not the same processor.
[0082] Step 360: Compare the priority with the preset priority;
[0083] The priorities of each application are pre-defined and can be determined by the receiving application based on the importance of the business it handles, and then fed back to the operating system. Additionally, the priorities of each application can be stored in any file, such as a priority table. For example, the priority levels can be divided into five levels: L1, L2, L3, L4, and L5, with the priorities increasing sequentially from L1 to L5.
[0084] The preset priority includes: the application priority threshold or the priority of the application that last received a message of the same type as the message to be processed;
[0085] The application priority threshold is a global priority that will not change due to changes in the priority of a particular application. If it is used, then in order to update the receive packet redirection table based on the priority of a particular application, the priority of the application must be greater than the application priority threshold.
[0086] The application priority threshold can be determined based on the priority of each application, and can be taken as an average. For example, the application priority threshold can be L3.
[0087] The priority of the application that last received a message of the same type as the message to be processed is the priority of the application that last received a message of the same type. The type of message to be processed can be determined according to the message attributes (message attributes include but are not limited to: IP address, port number, protocol type, message service type, etc.), or since the message attributes can determine the receiving application in great detail, it can be determined according to some attributes in the message attributes (such as the four elements of source IP, source port number, destination IP, and destination port number, or the three elements of source IP, source port number, and destination IP).
[0088] Step 370: If the priority is greater than the preset priority, then update the receive packet redirection table; otherwise, do not update the receive packet redirection table. The receive packet redirection table stores the correspondence between packets and processors and is used to select the packet processor.
[0089] After receiving a message to be processed, a message processor can be selected from multiple processors based on the receive packet redirection table. Then, the message attributes are read from the message to be processed. Based on the message attributes, the receiving application corresponding to the message to be processed is determined from multiple applications. It is then confirmed whether the processor where the receiving application is located is consistent with the message processor. If they are inconsistent, the priority of the receiving application is determined. Then, the priority of the application is compared with a preset priority. If the priority of the receiving application is greater than the preset priority, the receive packet redirection table is updated; otherwise, the receive packet redirection table is not updated. In this way, if some receiving applications are found to have low priorities, the receive packet redirection table will not be updated for these low-priority receiving applications, but only for high-priority receiving applications. This reduces the modification frequency of the receive packet redirection table, and the number of entries that need to be modified in the receive packet redirection table will naturally decrease, thereby improving message processing performance.
[0090] The packet forwarding table, more precisely, stores the correspondence between the hash value of the packet and the identifier of the processor. This hash value can be calculated using a four-tuple (source IP, source port number, destination IP, destination port number), where IP stands for Internet Protocol Address.
[0091] After updating the receive packet redirection table, if a newly received message has the same four-tuple as the message to be processed, it is considered a similar (same type) message. The receive packet redirection table can then be used to correctly identify the message processor corresponding to the message, ensuring that the message processor is the same as the processor of the receiving application corresponding to the new message. This avoids secondary buffering of messages, fully utilizing the device's high-speed buffer and improving message processing efficiency.
[0092] In some embodiments, after selecting the message processor corresponding to the message to be processed, the method further includes:
[0093] Add the identifier of the message processor to the message to be processed; the identifier includes, but is not limited to, name, number, etc.
[0094] The identifier of the processor in which the receiving application resides is determined;
[0095] Since each application retrieves various data from its own processor, it can accurately determine which processor it is on during the data reading process.
[0096] If the processor where the receiving application resides is different from the message processor, then the priority of the receiving application is confirmed, including:
[0097] If the identifier of the processor determined by the receiving application is inconsistent with the identifier of the message processor added to the message to be processed, then the priority of the receiving application is confirmed.
[0098] After confirming the message processor, the message processor's identifier can be added to the message to be processed, and the message can be cached using the message processor. At the same time, the receiving application will be notified to read the message from the cache of its own processor. After receiving the notification, the receiving application can check from the read message whether the identifier of its own processor is consistent with the identifier of the message processor added to the message to be processed. If they are inconsistent, the priority of the receiving application needs to be confirmed so that the priority comparison can be used to determine whether to update the receiving packet redirection table.
[0099] Of course, if they are inconsistent, it means that the processor where the receiving application is located read the message from the message processor's cache again and buffered the message again.
[0100] In some embodiments, the preset priority includes: an application priority threshold or the priority of the application that last received a message of the same type as the message to be processed;
[0101] The step of updating the receive packet redirection table if the priority is greater than the preset priority includes:
[0102] If the priority is greater than the application priority threshold, then update the receive packet redirection table; or
[0103] If the priority is greater than the priority of the application that last received a message of the same type as the message to be processed, then the receive packet redirection table is updated.
[0104] The application priority threshold is a global priority that will not change due to changes in the priority of a particular application. If it is used, then in order to update the receive packet redirection table based on the priority of a particular application, the priority of the application must be greater than the application priority threshold.
[0105] The application priority threshold can be determined based on the priority of each application, and can be taken as an average. For example, the application priority threshold can be L3.
[0106] The priority of the application that last received a message of the same type as the message to be processed is the priority of the application that last received a message of the same type. The type of message to be processed can be determined based on message attributes or some of the attributes in the message attributes.
[0107] Specifically, the priority of the application that last received a message of the same type as the message to be processed refers to the priority of the application that processed the message when it last received the same type of message. If the priority of the receiving application is greater than the application priority threshold or greater than the priority of the application that last received a message of the same type as the message to be processed, it means that the receiving application has a high priority. Therefore, the receive packet redirection table can be updated according to the receiving application. This avoids modifying the receive packet redirection table due to applications with low priority, thus reducing the modification frequency of the receive packet redirection table and naturally reducing the number of entries that need to be modified in the receive packet redirection table, thereby improving message processing performance.
[0108] In some embodiments, the preset priority includes: an application priority threshold and the priority of the application that last received a message of the same type as the message to be processed;
[0109] The step of updating the receive packet redirection table if the priority is greater than the preset priority includes:
[0110] If the priority is greater than the application priority threshold, then the priority is compared with the priority of the application that last received a message of the same type as the message to be processed.
[0111] If the priority is greater than the priority of the application that last received a message of the same type as the message to be processed, then update the receive packet redirection table.
[0112] If the priority of the receiving application is greater than the application priority threshold, the priority of the receiving application can be further compared with the priority of the application that previously received a message of the same type as the message to be processed. If the priority of the receiving application is greater than the priority of the application that previously received a message of the same type as the message to be processed, it can be fully indicated that the priority of the receiving application is very high. Therefore, the receiving packet redirection table can be updated according to the receiving application. This avoids modifying the receiving packet redirection table due to applications with low priority. In this way, the modification frequency of the receiving packet redirection table is reduced, and the number of entries that need to be modified in the receiving packet redirection table will naturally be reduced, which improves the message processing performance.
[0113] In some embodiments, updating the received packet redirection table includes:
[0114] The packet processor corresponding to the message to be processed, recorded in the receive packet redirection table, is updated to the processor where the receiving application resides. Specifically, the identifier of the packet processor corresponding to the type of the message to be processed, recorded in the receive packet redirection table, is updated to the identifier of the processor where the receiving application resides. This way, when the same type of message is received again, the processor where the receiving application resides can be used as the packet processor, thereby improving the processor's buffer hit rate.
[0115] The process of updating the receive packet redirection table involves updating the packet processor recorded in the receive packet redirection table corresponding to the message to be processed to the processor where the receiving application resides. In this way, the packet processor recorded in the receive packet redirection table corresponding to the message to be processed can be updated due to the application with higher priority. Thus, when a similar (same type) message is received again, the correct packet processor can be selected, thereby improving the buffer hit rate of the processor and thus improving the message processing efficiency and performance.
[0116] Of course, if the packet handler corresponding to the message to be processed is not recorded in the packet forwarding table, then the processor where the receiving application is located is determined as the packet handler corresponding to the message to be processed, and recorded in the packet forwarding table.
[0117] In some embodiments, the packet redirection table includes a first packet redirection table and a second packet redirection table, wherein the query level of the first packet redirection table is higher than the query level of the second packet redirection table.
[0118] The query level refers to the query priority. The query level of the first receive packet redirection table is higher than that of the second receive packet redirection table. This means that the first receive packet redirection table is queried first. If the first receive packet redirection table cannot find out which processor is the packet processor, then the second receive packet redirection table is queried.
[0119] The step of updating the packet processor corresponding to the message to be processed recorded in the received packet redirection table to the processor where the receiving application resides includes:
[0120] The message processor corresponding to the message to be processed recorded in the first receive packet redirection table is updated to the processor where the receiving application is located. The correspondence between messages and processors stored in the second receive packet redirection table is different from the correspondence between messages and processors stored in the first receive packet redirection table. The second receive packet redirection table cannot be updated according to the priority.
[0121] The query level of the first packet forwarding table is higher than that of the second packet forwarding table. Therefore, when updating the packet forwarding table, the first packet forwarding table is also updated.
[0122] The first packet redirection table is the SOCK_RPS entry, where SOCK stands for Socket.
[0123] The second receive packet redirection table is the RPS entry;
[0124] The second packet redirection table records the pre-defined correspondence between messages and processors, automatically generated according to certain principles, such as prioritizing the allocation of messages to idle processors or to processors with higher configurations. The correspondence between messages and processors stored in the second packet redirection table differs from that in the first packet redirection table. Specifically, the second packet redirection table records the processors required to process a certain type of message when it is first received. When the same type of message is received again, if the processor corresponding to that type of message needs to be updated, it needs to be updated in the first packet redirection table, but not in the second. Therefore, the correspondence between messages and processors stored in the second packet redirection table differs from that in the first packet redirection table. The second packet redirection table only updates itself when the number of recorded message-processor correspondences reaches its limit, deleting those that exceed the limit and were generated earlier, based on their generation time.
[0125] In addition, the priority of the application that last received a message of the same type as the message to be processed, as mentioned above, can be recorded in the first receive packet redirection table or other positions, but it is not appropriate to record it in the second receive packet redirection table because the query level of the second receive packet redirection table is low and it is not suitable for recording.
[0126] The correspondence between messages and processors recorded in the first receive packet redirection table is modified according to the processor where the receiving application is located when the processor where the receiving application is located is different from the processor where the message is processed. It has high accuracy and can better ensure that the selected processor is the same as the processor where the receiving application is located. Therefore, the query level of the first receive packet redirection table is higher than that of the second receive packet redirection table.
[0127] In some embodiments, selecting the message processor corresponding to the message to be processed from a plurality of processors according to a received packet redirection table includes:
[0128] Based on the first received packet redirection table and the message to be processed, the message processor is selected from the plurality of processors;
[0129] When selecting, the message processor corresponding to the type of the message to be processed can be automatically selected from multiple processors based on the type of the message to be processed and the message type and processor identifier recorded in the first receive packet redirection table.
[0130] If the message processor is not found in the first receive packet redirection table, then the message processor is selected from the plurality of processors according to the second receive packet redirection table and the message to be processed;
[0131] The principle of selecting a message processor in the second receive packet redirection table is the same as above, and will not be repeated here.
[0132] If the message processor is not found in the second receive packet redirection table, the message processor is randomly selected from the plurality of processors.
[0133] Since the first packet forwarding table has a higher priority than the second packet forwarding table (meaning the processors corresponding to the messages recorded in the first packet forwarding table are more accurate than those recorded in the second packet forwarding table), the message processor can be selected from the plurality of processors based on the first packet forwarding table and the message to be processed. If the message processor is not found in the first packet forwarding table, it can be selected from the plurality of processors based on the second packet forwarding table and the message to be processed. If the message processor is also not found in the second packet forwarding table, it can be randomly selected from the plurality of processors.
[0134] Of course, if there is a first receive packet redirection table and a second receive packet redirection table, but no processor corresponding to the message to be processed is found in the first receive packet redirection table and the second receive packet redirection table, and a processor is randomly selected as the message processor, the first receive packet redirection table needs to be updated according to the randomly selected message processor and the message to be processed.
[0135] It should be noted that there is a special case: if there is no first receive packet redirection table and no second receive packet redirection table, then after receiving the message to be processed, it is also necessary to randomly select a message processor from multiple processors, and then create a second receive packet redirection table based on the randomly selected message processor and the message to be processed. However, this special case is not the focus of this disclosure.
[0136] In some embodiments, determining the receiving application of the message to be processed from multiple applications according to the message attributes of the message to be processed includes:
[0137] Retrieve the message attributes corresponding to each of the multiple pre-recorded applications;
[0138] The message attributes of the message to be received include, but are not limited to, the IP address, port number, protocol type, and service type of the message to be processed.
[0139] The message attributes corresponding to each application are the attributes of the messages that each application is concerned with. These message attributes include, but are not limited to, IP address, port number, protocol type, and message service type.
[0140] Based on the message attributes and the message attributes corresponding to each of the multiple applications, the receiving application is selected from the multiple applications.
[0141] By automatically matching message attributes with the message attributes corresponding to multiple pre-recorded applications, the receiving application can be automatically selected from multiple applications, thereby improving the accuracy of the receiving application selection.
[0142] The following will combine Figure 4 and Figure 5 Further details of the technical solution disclosed herein:
[0143] like Figure 4 As shown, when the network card receives a data packet, it selects a CPU by querying the SOCK_RPS table. If there is no SOCK_RPS table entry, it continues to query the RPS table. If there is no RPS table entry, it randomly selects a CPU from multiple CPUs to send the packet. The sending CPU buffers the packet and puts it into the APP message queue. At the same time, the operating system confirms the receiving APP corresponding to the packet (assuming the receiving APP includes APP1 and APP2) and notifies the receiving APP. Of course, there are no entries in the initial state.
[0144] Upon receiving the notification, the receiving app retrieves the message. Based on the identifier of the sending CPU carried in the message, it confirms whether it matches the CPU it resides on. If they do not match, both APP1 and APP2 within the receiving app compare their own priorities with the application priority threshold (e.g., ...). Figure 5 As shown in the figure, assuming that the priority of APP1 is higher than the application priority threshold, while the priority of APP2 is lower than the application priority threshold, then APP1 can report to the operating system to update the selected CPU corresponding to the message in the SOCK_RPS table to the priority of APP1. However, since the priority of APP2 is low, APP2 does not need to report, and therefore does not need to update the SOCK_RPS table.
[0145] and Figure 6 and Figure 7 process and Figure 4 and Figure 5 Similar to the previous method, the priority comparison process not only compares the application priority with the application priority threshold, but also with the priority of the application that last received a message of the same type as the message to be processed. This ensures that only applications with sufficiently high priority affect the SOCK_RPS table entry, avoiding excessively frequent modification of the SOCK_RPS table entry and thus affecting message processing performance.
[0146] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, because according to this disclosure, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this disclosure.
[0147] The above is an introduction to the method embodiments. The following describes the solution described in this disclosure further through device embodiments.
[0148] Figure 8 A block diagram of a message processing apparatus 800 according to an embodiment of the present disclosure is shown. Figure 8 As shown, the device 800 includes:
[0149] The receiving module 810 is used to receive a message to be processed, the message containing message attributes;
[0150] Selection module 820 is used to select the message processor corresponding to the message to be processed from multiple processors according to the received packet redirection table;
[0151] The reading module 830 is used to read the message attributes from the message to be processed;
[0152] The first determining module 840 is used to determine the receiving application corresponding to the message to be processed from multiple applications according to the message attributes of the message to be processed;
[0153] The second determining module 850 is used to determine the priority of the receiving application if the processor where the receiving application is located is different from the message processor.
[0154] Comparison module 860 is used to compare the priority with a preset priority;
[0155] The update module 870 is used to update the receive packet redirection table if the priority is greater than the preset priority, otherwise, the receive packet redirection table is not updated. The receive packet redirection table stores the correspondence between packets and processors and is used to select the packet processor.
[0156] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the described module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0157] According to embodiments of this disclosure, this disclosure also provides an electronic device, including:
[0158] At least one processor; and
[0159] A memory communicatively connected to the at least one processor; wherein,
[0160] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform any of the above method embodiments.
[0161] According to embodiments of this disclosure, this disclosure also provides a vehicle, including: a message processing apparatus as described in the above embodiments or an electronic device as described in the above embodiments.
[0162] According to embodiments of this disclosure, this disclosure also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform any of the method embodiments described above.
[0163] Figure 9A schematic block diagram of an electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0164] Device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 902 or a computer program loaded into random access memory (RAM) 903 from storage unit 908. The RAM 903 may also store various programs and data required for the operation of device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. An input / output (I / O) interface 905 is also connected to bus 904.
[0165] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0166] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as method 300. For example, in some embodiments, method 300 may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of method 300 described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform method 300 by any other suitable means (e.g., by means of firmware).
[0167] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0168] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0169] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0170] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0171] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0172] Computing systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0173] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0174] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A message processing method, characterized in that, include: A message to be processed is received, the message containing message attributes; Based on the received packet redirection table, select the packet processor corresponding to the message to be processed from multiple processors; Read the message attributes from the message to be processed; Based on the message attributes of the message to be processed, determine the receiving application corresponding to the message to be processed from multiple applications; If the processor where the receiving application resides is different from the message processor, then the priority of the receiving application is confirmed. Compare the priority with the preset priority; If the priority is greater than the preset priority, the receive packet redirection table is updated; otherwise, the receive packet redirection table is not updated. The receive packet redirection table stores the correspondence between packets and processors and is used to select the packet processor.
2. The method according to claim 1, characterized in that, After selecting the message processor corresponding to the message to be processed, the method further includes: Add the identifier of the message processor to the message to be processed; and The identifier of the processor in which the receiving application resides is determined; If the processor where the receiving application resides is different from the message processor, then the priority of the receiving application is confirmed, including: If the identifier of the processor determined by the receiving application is inconsistent with the identifier of the message processor added to the message to be processed, then the priority of the receiving application is confirmed.
3. The method according to claim 1, characterized in that, The preset priority includes: the application priority threshold or the priority of the application that last received a message of the same type as the message to be processed; The step of updating the receive packet redirection table if the priority is greater than the preset priority includes: If the priority is greater than the application priority threshold, then update the receive packet redirection table; or If the priority is greater than the priority of the application that last received a message of the same type as the message to be processed, then the receive packet redirection table is updated.
4. The method according to claim 1, characterized in that, The preset priority includes: the application priority threshold and the priority of the application that last received a message of the same type as the message to be processed; The step of updating the receive packet redirection table if the priority is greater than the preset priority includes: If the priority is greater than the application priority threshold, then the priority is compared with the priority of the application that last received a message of the same type as the message to be processed. If the priority of the receiving application is higher than the priority of the application that last received a message of the same type as the message to be processed, then the receiving packet redirection table is updated.
5. The method according to claim 1, characterized in that, The update of the received packet redirection table includes: Update the message processor corresponding to the message to be processed recorded in the received packet redirection table to the processor where the receiving application is located.
6. The method according to claim 5, characterized in that, The packet redirection table includes a first packet redirection table and a second packet redirection table, wherein... The query level of the first receive packet redirection table is higher than the query level of the second receive packet redirection table; The step of updating the packet processor corresponding to the message to be processed recorded in the received packet redirection table to the processor where the receiving application resides includes: The message processor corresponding to the message to be processed recorded in the first receive packet redirection table is updated to the processor where the receiving application is located. The correspondence between messages and processors stored in the second receive packet redirection table is different from the correspondence between messages and processors stored in the first receive packet redirection table.
7. The method according to claim 6, characterized in that, The step of selecting the message processor corresponding to the message to be processed from multiple processors based on the received packet redirection table includes: Based on the first received packet redirection table and the message to be processed, the message processor is selected from the plurality of processors; If the message processor is not found in the first receive packet redirection table, then the message processor is selected from the plurality of processors according to the second receive packet redirection table and the message to be processed; If the message processor is not found in the second receive packet redirection table, the message processor is randomly selected from the plurality of processors.
8. The method according to any one of claims 1 to 7, characterized in that, The step of determining the receiving application of the message to be processed from multiple applications according to the message attributes of the message to be processed includes: Obtain the message attributes corresponding to each of the pre-recorded applications; Based on the message attributes and the message attributes corresponding to each of the multiple applications, the receiving application is selected from the multiple applications.
9. A message processing apparatus, characterized in that, include: The receiving module is used to receive a message to be processed, the message containing message attributes; The selection module is used to select the message processor corresponding to the message to be processed from multiple processors according to the received packet redirection table; A reading module is used to read the message attributes from the message to be processed; The first determining module is used to determine the receiving application corresponding to the message to be processed from multiple applications according to the message attributes of the message to be processed; The second determining module is used to determine the priority of the receiving application if the processor where the receiving application is located is different from the message processor. The comparison module is used to compare the priority with a preset priority; An update module is used to update the receive packet redirection table if the priority is greater than the preset priority, and otherwise not update the receive packet redirection table. The receive packet redirection table stores the correspondence between packets and processors and is used to select the packet processor.
10. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
11. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-8.
12. A vehicle, characterized in that, include: The message processing apparatus of claim 9, and / or the electronic device of claim 10, and / or the non-transitory computer-readable storage medium of claim 11.
Citation Information
Patent Citations
Method and apparatus for secure data transfer permission handling
CN104050421A
Information processing apparatus, content reproducing device, connection management method, program, information processing system
JP2010281989A