Port resource allocation method and device, equipment and storage medium

By converting IP addresses to each network address to allocate an independent port resource pool and adopting a thread-level competition management mechanism, the problems of low port utilization and insufficient performance in port segmentation management and global management are solved, and efficient port resource management and allocation are achieved, improving the stability and reliability of the system.

CN119814722APending Publication Date: 2025-04-11CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411792101.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the prior art, port segmentation management leads to uneven traffic segments, and port waste and exhaustion may occur; while port global management leads to low performance due to competition among multiple threads, which cannot improve port utilization, resulting in traffic interruption.

Method used

By converting IP addresses to each network address, allocating an independent port resource pool and adopting a thread-level competition management mechanism, efficient port resource management and allocation can be achieved. When the port resources of the first business thread are insufficient, the port resources of the second business thread are dynamically borrowed to ensure that the service traffic request is processed in a timely manner.

Benefits of technology

It improves the processing capacity and resource utilization of network equipment, enhances the stability and reliability of the system, and avoids port waste and traffic interruption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119814722A_ABST
    Figure CN119814722A_ABST
Patent Text Reader

Abstract

The invention provides a port resource allocation method and device, equipment and a storage medium, and the method comprises the steps: obtaining a network address translation (IP) address corresponding to a service flow request when the service flow request is received, and the IP address comprises port resources allocated according to different service threads; when the service flow request is in the first service thread, determining whether a target port exists in a port resource pool of the first service thread of a network address translation (IP) address; and if not, borrowing a target port in the port resource pool of the second service thread of the network address translation IP address, and processing the service flow request through the target port of the second service thread. According to the embodiment of the invention, an independent port resource pool is allocated to each network address translation (IP) address, and a thread-level competition management mechanism is adopted, so that efficient port resource management and allocation are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of port technology, and in particular, to a port resource allocation method, apparatus, device and storage medium. Background Art

[0002] With the development of computer networks, almost all walks of life have important connections with computer networks. Whether it is corporate office, commercial product promotion, or leisure life, they are all closely related to computer networks. The same is true in cloud computing scenarios. Cloud computing provides various services for external access, and cloud hosts can also be used as office computers to access external networks. In order to implement various cloud service-related businesses, multiple network elements are required to provide different traffic processing functions, such as stateless network elements providing EIP product services and stateful network elements providing NAT service product services.

[0003] Stateful network elements need to record access information by flow for NAT services, which is used to modify and restore NAT data. For example, when the client sends a request in the outbound direction, the network element creates a six-tuple of information for the outbound session record access, and creates an inbound session record for restoring NAT information. The return traffic is sent to the client, and finally forward and reverse access of the traffic is achieved. The six-tuple information in the outbound session includes sip, dip, sport, dport, protocol, and vni. Taking snat as an example, sip is the public network IP used for NAT, and sport is a target port on this public network IP. There are generally two solutions to obtain available sport information, port segmentation management and port global management. Port segmentation management is to evenly distribute the target ports of an IP according to the number of business threads. When a business thread creates a session, it can take one of the ports from the target port pool of the current thread. Port global management is to manage all the target ports of an IP in a unified manner, and each thread applies from the global port pool when applying.

[0004] However, in the above two methods, the utilization rate of port segment management is low. When the traffic distribution is uneven, port waste and port exhaustion may occur. The global port management performance is low, and there is performance loss caused by competition among multiple threads, which makes it impossible to improve port utilization and leads to traffic interruption. Summary of the invention

[0005] Embodiments of the present application provide a port resource allocation method, device, system, electronic device, and computer-readable storage medium.

[0006] In a first aspect, an embodiment of the present application provides a port resource allocation method, which is applied to a stateful network element, and the method includes:

[0007] When a service traffic request is received, a network address translation IP address corresponding to the service traffic request is obtained, wherein the network address translation IP address includes port resources allocated according to different service threads;

[0008] When the service traffic request is in the first service thread, determining whether there is a target port in the port resource pool of the first service thread of the network address translation IP address;

[0009] If not, the target port in the port resource pool of the second service thread of the network address translation IP address is borrowed, and the service traffic request is processed through the target port of the second service thread.

[0010] Optionally, when receiving a service traffic request, obtaining a network address translation IP address corresponding to the service traffic request includes:

[0011] When a service flow request is received, query the configuration information corresponding to the service flow request;

[0012] According to the configuration information, a network address translation IP address corresponding to the service traffic request is obtained.

[0013] Optionally, the borrowing the target port in the port resource pool of the second service thread of the network address translation IP address and processing the service traffic request through the target port of the second service thread includes:

[0014] Searching whether the target port exists in the port resource pool of the second service thread of the network address translation IP address;

[0015] If so, the service traffic request is processed through the target port of the second service thread.

[0016] Optionally, searching for the target port in a port resource pool of the second service thread of the network address translation IP address includes:

[0017] If yes, locking the critical section when accessing the port resource pool of the second service thread;

[0018] A search is performed to determine whether the target port exists in the port resource pool of the second service thread of the network address translation IP address.

[0019] Optionally, the processing the service traffic request through the target port of the second service thread includes:

[0020] For the target port, a corresponding unused bit in the bitmap data structure is set to a position;

[0021] The service traffic request is processed through the target port of the second service thread.

[0022] Optionally, after the step of determining whether there is a target port in the port resource pool of the first service thread of the network address translation IP address when the service traffic request is in the first service thread, the method includes:

[0023] If so, the service traffic request is processed through the target port of the first service thread.

[0024] Optionally, the processing the service traffic request through the target port of the first service thread includes:

[0025] For the target port, a corresponding unused bit in the bitmap data structure is set to a position;

[0026] The service traffic request is processed through the target port of the first service thread.

[0027] In a second aspect, an embodiment of the present application provides a port resource allocation device, the device comprising:

[0028] An acquisition module, configured to acquire, when receiving a service flow request, a network address translation IP address corresponding to the service flow request, wherein the network address translation IP address includes port resources allocated according to different service threads;

[0029] A determination module, used for determining whether there is a target port in the port resource pool of the first service thread of the network address translation IP address when the service traffic request is in the first service thread;

[0030] The processing module is used for, if not, borrowing the target port in the port resource pool of the second service thread of the network address translation IP address, and processing the service traffic request through the target port of the second service thread.

[0031] Optionally, the acquisition module includes:

[0032] A first acquisition submodule is used to query the configuration information corresponding to the service flow request when a service flow request is received;

[0033] The second acquisition submodule is used to acquire the network address translation IP address corresponding to the service traffic request according to the configuration information.

[0034] Optionally, the processing module includes:

[0035] A first processing submodule is used to search whether the target port exists in the port resource pool of the second service thread of the network address translation IP address;

[0036] The second processing submodule is used to, if yes, process the service traffic request through the target port of the second service thread.

[0037] Optionally, the first processing submodule includes:

[0038] a first processing unit, configured to lock a critical section when accessing the port resource pool of the second service thread;

[0039] The second processing unit is used to search whether the target port exists from the port resource pool of the second service thread of the network address translation IP address.

[0040] Optionally, the second processing submodule includes:

[0041] A third processing unit, configured to set an unused bit position corresponding to the target port in the bitmap data structure;

[0042] A fourth processing unit is used to process the service traffic request through the target port of the second service thread.

[0043] Optionally, the device comprises:

[0044] The first module is used to process the service traffic request through the target port of the first service thread if yes.

[0045] Optionally, the first module includes:

[0046] A first submodule is used to position an unused bit corresponding to the target port in a bitmap data structure;

[0047] The second submodule is used to process the service traffic request through the target port of the first service thread.

[0048] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor, wherein the processor is configured to execute the instructions to implement any of the port resource allocation methods described above.

[0049] In a fourth aspect, an embodiment of the present application further provides a storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute any of the port resource allocation methods described above.

[0050] In an embodiment of the present application, when a service traffic request is received, the network address translation IP address corresponding to the service traffic request is obtained, and the network address translation IP address includes port resources allocated according to different service threads; when the service traffic request is in the first service thread, it is determined whether there is a target port in the port resource pool of the first service thread of the network address translation IP address; if not, the target port in the port resource pool of the second service thread of the network address translation IP address is borrowed, and the service traffic request is processed through the target port of the second service thread. That is, the embodiment of the present application realizes efficient port resource management and allocation by allocating an independent port resource pool to each network address translation IP address and adopting a thread-level competition management mechanism. When the port resources of the first service thread are insufficient, the port resources of the second service thread can be dynamically borrowed to ensure that the service traffic request is processed in a timely manner, thereby improving the processing capacity and resource utilization of the network equipment and enhancing the stability and reliability of the system.

[0051] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0053] Figure 1 It is a flow chart of the steps of a port resource allocation method provided by an embodiment of the present application;

[0054] Figure 2 is a device block diagram of a port resource allocation device provided in an embodiment of the present application;

[0055] Figure 3 is a structural diagram of an electronic device provided in an embodiment of the present application;

[0056] Figure 4 This is a schematic diagram of an exemplary port segmentation module provided in an embodiment of the present application.

[0057] Figure 5 is a schematic diagram of an exemplary port contention management module provided in an embodiment of the present application;

[0058] Figure 6 is a schematic diagram of an exemplary port borrowing module provided in an embodiment of the present application;

[0059] Figure 7 It is a schematic diagram of an exemplary business processing flow provided in an embodiment of the present application. DETAILED DESCRIPTION

[0060] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0061] It should be noted that in the embodiments of the present application, reference is made to Figure 4 , 5 , 6. Port segmentation module, competition management module, and port borrowing module.

[0062] In addition, there is a port mapping module, that is, a port management solution that combines the advantages of global port management and port segmentation management in the embodiment of the present application, mainly including a port segmentation module, a port mapping module, a competition management module, and a port borrowing module. The four modules work together to fully utilize the NAT port.

[0063] Among them, refer to Figure 4 , port segmentation module, each NAT IP has 1-65535 available port resources, and the port segmentation module evenly distributes port resources according to the number of business threads, ensuring that the segment resources of each thread are basically consistent and the ports are continuous.

[0064] For example, if there are three business threads, the segmentation results are: thread 1 port segment: 1 to 21845; thread 2 port segment: 21846 to 43690; thread 3 port segment: 43691 to 65535.

[0065] Port mapping module, each thread has its own port mapping space, using bitmap mode. After the port application is completed, the corresponding bit is set, and the bit is cleared after the port is released. The bitmap offset of each thread starts from 0 to avoid memory waste. If the available bit applied by thread 1 is 0, the available port after mapping is 1 (the port range of thread 1 is 1-21845).

[0066] Therefore, the starting port of the thread plus the bit offset equals the actual available port.

[0067] Reference Figure 5,Content management module, each NAT IP has a thread-level contention management structure, which uses a spin lock mechanism to handle the port resource competition relationship within the thread. When accessing other thread port resources, the target thread port resources are locked, and the critical section resources are released after the access is completed.

[0068] When the resource is released, the target thread port resource continues to be locked, and the critical section resource is released after the access is completed.

[0069] Reference Figure 6 The port borrowing module only uses the port resources in the current thread when the port resources in the current thread are available. When the port resources in the thread are exhausted, the port borrowing function is automatically enabled to borrow ports from other available threads. After the port is released, it is recycled to the original thread. After the port borrowing mode is enabled, it cooperates with the competition management module to lock the critical area resources and realize multi-thread competition access control.

[0070] Therefore, based on the above four modules, the network element can process the service request, refer to Figure 7 During this period, the port allocation, management and use are carried out, please refer to the following explanation for details.

[0071] Figure 1 is a flow chart of the steps of a port resource allocation method provided by an embodiment of the present application, such as Figure 1 As shown, the method may include:

[0072] Step 101, when a service flow request is received, obtaining a network address translation IP address corresponding to the service flow request, wherein the network address translation IP address includes port resources allocated according to different service threads;

[0073] Further, when receiving a service traffic request, obtaining a network address translation IP address corresponding to the service traffic request includes:

[0074] When a service flow request is received, query the configuration information corresponding to the service flow request;

[0075] According to the configuration information, a network address translation IP address corresponding to the service traffic request is obtained.

[0076] It should be noted that in the embodiment of the present application, when a service traffic request is received, the system will first obtain the network address translation IP address (NAT IP address) corresponding to the request, which is not only used to identify the source or target of the request, but also includes port resources allocated according to different service threads. These port resources are used for port mapping during the NAT process to ensure that each service thread can independently manage and use its port resources, thereby achieving efficient network address translation and traffic processing.

[0077] Specifically, when a service traffic request is received, the system will first query the configuration information corresponding to the request. This configuration information may include NAT rules, port mapping policies, etc. Based on the queried configuration information, the system can obtain the network address translation IP address (NAT IP address) corresponding to the service traffic request. This NAT IP address is used to identify the source or destination of the request and is key information for port mapping during the NAT process. In this way, the system can ensure that each service traffic request can be correctly network-addressed, thereby achieving efficient traffic processing.

[0078] Step 102, when the service traffic request is in the first service thread, determining whether there is a target port in the port resource pool of the first service thread of the network address translation IP address;

[0079] It should be noted that in an embodiment of the present application, when a service flow request is in the first service thread, the system will first determine the network address translation IP address (NAT IP address) corresponding to the request. Then, the system will check the port resource pool of the first service thread of the NAT IP address to determine whether there is a target port therein. This process is to ensure that when processing a service flow request, an available port can be found for port mapping, thereby achieving network address translation. If the target port exists in the port resource pool, the system will use the port for subsequent processing; if not, the system will take other measures (such as borrowing port resources from other threads) to meet the request.

[0080] Step 103: If not, borrow the target port in the port resource pool of the second service thread of the network address translation IP address, and process the service traffic request through the target port of the second service thread.

[0081] If the target port does not exist in the port resource pool of the first business thread, the system will adopt a borrowing strategy. Specifically, the system will borrow the target port in the port resource pool of the second business thread associated with the network address translation IP address (NAT IP address). In this way, the system can ensure that business traffic requests are processed in a timely manner, even if the port resources of the first business thread are insufficient. After borrowing the port, the system will use the target port of the second business thread to process the business traffic request, thereby achieving efficient network address translation and traffic processing. This mechanism can improve resource utilization and ensure that the system can still run stably in high concurrency scenarios.

[0082] It should be noted that the second service thread may be any thread in the port segmentation module except the first thread, and is not limited to a specific thread.

[0083] Further, the borrowing of the target port in the port resource pool of the second service thread of the network address translation IP address and processing the service traffic request through the target port of the second service thread includes:

[0084] Searching whether the target port exists in the port resource pool of the second service thread of the network address translation IP address;

[0085] If so, the service traffic request is processed through the target port of the second service thread.

[0086] Further, searching for the target port in the port resource pool of the second service thread of the network address translation IP address includes:

[0087] If yes, locking the critical section when accessing the port resource pool of the second service thread;

[0088] A search is performed to determine whether the target port exists in the port resource pool of the second service thread of the network address translation IP address.

[0089] It should be noted that, for example, the first business thread of the port needs to access the port resources of the second business thread, the first business thread obtains the spin lock of the second business thread, locks the port resources of the second business thread, the first business thread checks the port resource pool of the second business thread, finds an available port resource, the first business thread uses the port resource and records it in the NAT table, the first business thread releases the spin lock of the second business thread, and allows other threads to access the port resources of the second business thread.

[0090] In addition, when the port resources are released, the first business thread releases a used port resource, the first business thread obtains the spin lock of the second business thread, locks the port resources of the second business thread, and the first business thread calculates the corresponding bit offset according to the port number, clears the corresponding bit (sets it to 0), indicating that the port has been released, and the first business thread releases the spin lock of the second business thread, allowing other threads to access the port of the second business thread.

[0091] Further, the processing of the service traffic request through the target port of the second service thread includes:

[0092] Setting an unused bit corresponding to the target port in a bitmap data structure;

[0093] The service traffic request is processed through the target port of the second service thread.

[0094] It should be noted that in the embodiment of the present application, when the network element receives a service flow request, it queries the relevant configuration and finds the relevant NAT IP to apply for port resources. When the port resources of this thread are available, it enters the port mapping module to apply for the port. When the port resources are not available, it enters the port borrowing module to query whether other threads have available resources. If available, it enters the contention management module, locks the thread critical section, and handles thread contention. Then it continues to perform port mapping of the borrowed thread and apply for an available port.

[0095] Therefore, in the process of applying for available ports, port mapping needs to be performed through the port mapping module.

[0096] Specifically, each thread has its own port mapping space, which means that each thread can manage and allocate port resources independently without interfering with each other. The port mapping space uses a bitmap data structure to represent the usage of the port. Each bit represents the state of a port (used or unused). For example, if the port range of a thread is 1 to 21845, the size of the bitmap will be 21845 bits.

[0097] Therefore, when a thread applies for a port, the port mapping module will find an unused bit in the bitmap and set it (to 1), indicating that the port is occupied. When the port is released, the corresponding bit will be cleared (set to 0), indicating that the port has been released.

[0098] In addition, in the embodiment of the present application, the bitmap offset of each thread starts from 0, which means that the first bit of the bitmap corresponds to the first port of the thread, and the calculation formula of the actual available port is the following formula 1:

[0099] Actual available port = thread start port + bit offset (Formula 1)

[0100] For example, if the starting port of thread 1 is 1 and the available bit requested is 0, then the actual available port is 1 (i.e. 1+0).

[0101] Further, after step 102, that is, after the step of determining whether there is a target port in the port resource pool of the first service thread of the network address translation IP address when the service traffic request is in the first service thread, the method includes:

[0102] If so, the service traffic request is processed through the target port of the first service thread.

[0103] Further, processing the service traffic request through the target port of the first service thread includes:

[0104] Setting an unused bit corresponding to the target port in a bitmap data structure;

[0105] The service traffic request is processed through the target port of the first service thread.

[0106] It should be noted that if the port resource corresponding to the current thread is available at the beginning, you can directly enter the port mapping module to apply for the port.

[0107] In addition, in an embodiment of the present application, the first-level distribution module inside the network element receives the service message data, and distributes it to the target service thread for service processing according to the five-tuple information or port segment information. After receiving the message, the service thread queries the service configuration according to the target IP, target port and other information, and performs basic data inspection. After the inspection is completed, the inbound and outbound session records are created. The port applied for in the outbound session record is completed by the port segmentation module, the port mapping module, the contention management module, and the port borrowing module. Finally, the outbound traffic performs the NAT service, and the return traffic returns to the client through the query session and reverse NAT recovery. Finally, normal traffic access is achieved.

[0108] In an embodiment of the present application, when a service traffic request is received, the network address translation IP address corresponding to the service traffic request is obtained, and the network address translation IP address includes port resources allocated according to different service threads; when the service traffic request is in the first service thread, it is determined whether there is a target port in the port resource pool of the first service thread of the network address translation IP address; if not, the target port in the port resource pool of the second service thread of the network address translation IP address is borrowed, and the service traffic request is processed through the target port of the second service thread. That is, the embodiment of the present application realizes efficient port resource management and allocation by allocating an independent port resource pool to each network address translation IP address and adopting a thread-level competition management mechanism. When the port resources of the first service thread are insufficient, the port resources of the second service thread can be dynamically borrowed to ensure that the service traffic request is processed in a timely manner, thereby improving the processing capacity and resource utilization of the network equipment and enhancing the stability and reliability of the system.

[0109] Corresponding to the method provided in the above-mentioned embodiment of the port resource allocation method of the present application, see Figure 2 The present application also provides a device block diagram of a port resource allocation device. In this embodiment, the device includes:

[0110] The acquisition module 201 is used to acquire the network address translation IP address corresponding to the service flow request when receiving the service flow request, wherein the network address translation IP address includes port resources allocated according to different service threads;

[0111] A determination module 202 is used to determine whether there is a target port in the port resource pool of the first service thread of the network address translation IP address when the service traffic request is in the first service thread;

[0112] The processing module 203 is used to, if not, borrow the target port in the port resource pool of the second service thread of the network address translation IP address, and process the service traffic request through the target port of the second service thread.

[0113] Optionally, the acquisition module includes:

[0114] A first acquisition submodule is used to query the configuration information corresponding to the service flow request when a service flow request is received;

[0115] The second acquisition submodule is used to acquire the network address translation IP address corresponding to the service traffic request according to the configuration information.

[0116] Optionally, the processing module includes:

[0117] A first processing submodule is used to search whether the target port exists in the port resource pool of the second service thread of the network address translation IP address;

[0118] The second processing submodule is used to, if yes, process the service traffic request through the target port of the second service thread.

[0119] Optionally, the first processing submodule includes:

[0120] a first processing unit, configured to lock a critical section when accessing the port resource pool of the second service thread;

[0121] The second processing unit is used to search whether the target port exists from the port resource pool of the second service thread of the network address translation IP address.

[0122] Optionally, the second processing submodule includes:

[0123] A third processing unit, configured to set an unused bit position corresponding to the target port in the bitmap data structure;

[0124] A fourth processing unit is used to process the service traffic request through the target port of the second service thread.

[0125] Optionally, the device comprises:

[0126] The first module is used to process the service traffic request through the target port of the first service thread if yes.

[0127] Optionally, the first module includes:

[0128] A first submodule is used to position an unused bit corresponding to the target port in a bitmap data structure;

[0129] The second submodule is used to process the service traffic request through the target port of the first service thread.

[0130] In summary, a port resource allocation device provided by an embodiment of the present application, when receiving a service traffic request, obtains the network address translation IP address corresponding to the service traffic request, and the network address translation IP address includes port resources allocated according to different service threads; when the service traffic request is in the first service thread, determines whether there is a target port in the port resource pool of the first service thread of the network address translation IP address; if not, borrows the target port in the port resource pool of the second service thread of the network address translation IP address, and processes the service traffic request through the target port of the second service thread. That is, the embodiment of the present application realizes efficient port resource management and allocation by allocating an independent port resource pool to each network address translation IP address and adopting a thread-level competition management mechanism. When the port resources of the first service thread are insufficient, the port resources of the second service thread can be dynamically borrowed to ensure that the service traffic request is processed in a timely manner, thereby improving the processing capacity and resource utilization of the network equipment and enhancing the stability and reliability of the system.

[0131] Figure 3 This is a structural diagram of an electronic device M00 provided in an embodiment of the present application. In the figure, the electronic device M00 includes a processor M01 and a memory M02. The electronic device includes: a processor; a memory for storing instructions executable by the processor, wherein the processor is configured to execute the instructions to implement any of the port resource allocation methods described above, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0132] In an embodiment of the present application, the memory M02 can be used to store software programs and various data. The memory M02 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory M02 may include a volatile memory or a non-volatile memory, or the memory x09 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory M02 in the embodiment of the present application includes but is not limited to these and any other suitable types of memories.

[0133] The processor M01 may include one or more processing units; optionally, the processor M01 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor M01.

[0134] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned port resource allocation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0135] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0136] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned port resource allocation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0137] It should be understood that the chip involved in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0138] An embodiment of the present application further provides a storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute any of the port resource allocation methods described above.

[0139] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned port resource allocation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0140] An embodiment of the present application further provides a vehicle, wherein the vehicle includes the port resource allocation device as described above.

[0141] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0142] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0143] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A port resource allocation method, characterized in that: Applied to a stateful network element, the method comprises: When a service traffic request is received, a network address translation IP address corresponding to the service traffic request is obtained, wherein the network address translation IP address includes port resources allocated according to different service threads; When the service traffic request is in the first service thread, determining whether there is a target port in the port resource pool of the first service thread of the network address translation IP address; If not, the target port in the port resource pool of the second service thread of the network address translation IP address is borrowed, and the service traffic request is processed through the target port of the second service thread.

2. The method according to claim 1, characterized in that When receiving a service traffic request, obtaining a network address translation IP address corresponding to the service traffic request includes: When a service flow request is received, query the configuration information corresponding to the service flow request; According to the configuration information, a network address translation IP address corresponding to the service traffic request is obtained.

3. The method according to claim 1, characterized in that The step of borrowing the target port in the port resource pool of the second service thread of the network address translation IP address and processing the service traffic request through the target port of the second service thread includes: Searching whether the target port exists in the port resource pool of the second service thread of the network address translation IP address; If so, the service traffic request is processed through the target port of the second service thread.

4. The method according to claim 3, characterized in that The searching for the target port in the port resource pool of the second service thread of the network address translation IP address comprises: If yes, locking the critical section when accessing the port resource pool of the second service thread; A search is performed to determine whether the target port exists in the port resource pool of the second service thread of the network address translation IP address.

5. The method according to claim 3, characterized in that: The processing of the service traffic request through the target port of the second service thread includes: Setting an unused bit corresponding to the target port in a bitmap data structure; The service traffic request is processed through the target port of the second service thread.

6. The method according to claim 1, characterized in that After the step of determining whether there is a target port in the port resource pool of the first service thread of the network address translation IP address when the service traffic request is in the first service thread, the method includes: If so, the service traffic request is processed through the target port of the first service thread.

7. The method according to claim 6, characterized in that The processing of the service traffic request through the target port of the first service thread includes: Setting an unused bit corresponding to the target port in a bitmap data structure; The service traffic request is processed through the target port of the first service thread.

8. A port resource allocation device, characterized in that: The device comprises: An acquisition module, configured to acquire, when receiving a service flow request, a network address translation IP address corresponding to the service flow request, wherein the network address translation IP address includes port resources allocated according to different service threads; A determination module, used for determining whether there is a target port in the port resource pool of the first service thread of the network address translation IP address when the service traffic request is in the first service thread; The processing module is used for, if not, borrowing the target port in the port resource pool of the second service thread of the network address translation IP address, and processing the service traffic request through the target port of the second service thread.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the port resource allocation method according to any one of claims 1 to 7.

10. A computer storage medium, a readable storage medium, for storing a program, characterized in that: When the program is executed by a processor, the port resource allocation method as claimed in any one of claims 1 to 7 is implemented.