CN109062781B - Message buffer management method and device - Google Patents
Message buffer management method and device Download PDFInfo
- Publication number
- CN109062781B CN109062781B CN201810666218.9A CN201810666218A CN109062781B CN 109062781 B CN109062781 B CN 109062781B CN 201810666218 A CN201810666218 A CN 201810666218A CN 109062781 B CN109062781 B CN 109062781B
- Authority
- CN
- China
- Prior art keywords
- message buffer
- buffer area
- holder information
- message
- total
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 239000000872 buffer Substances 0.000 title claims abstract description 368
- 238000007726 management method Methods 0.000 title abstract description 25
- 238000000034 method Methods 0.000 claims abstract description 118
- 230000008569 process Effects 0.000 claims abstract description 98
- 238000011084 recovery Methods 0.000 claims description 16
- 238000001514 detection method Methods 0.000 claims description 9
- 238000004064 recycling Methods 0.000 claims description 7
- 238000010586 diagram Methods 0.000 description 14
- 238000004590 computer program Methods 0.000 description 5
- 230000007246 mechanism Effects 0.000 description 5
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 238000003491 array Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000002159 abnormal effect Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 238000009825 accumulation Methods 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/366—Software debugging using diagnostics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0706—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
- G06F11/073—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a memory management context, e.g. virtual memory or cache management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5022—Mechanisms to release resources
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Computer Hardware Design (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a message buffer management method, which comprises the following steps: when a service process applies for a message buffer area, allocating an idle message buffer area in a total message buffer area for the service process, updating holder information of the idle message buffer area to an identification ID of the service process, and updating a timestamp of the idle message buffer area to the current latest time; detecting the total message buffer area according to a preset period; and when the holder information of a first message buffer area in the total message buffer area is not preset holder information and the timestamp of the first message buffer area exceeds a first preset time length and is not updated, recovering the first message buffer area. The invention can solve the problem of system abnormity caused by the fact that the message buffer area can not be efficiently recycled in the prior art.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for managing a message buffer.
Background
The message buffer area is a carrier of the message and is a section of memory used for caching message frames received by the network card. The message buffer allocation modes are classified according to allocation time and can be divided into a dynamic allocation mode and a pre-allocation mode. The dynamic allocation mode is that a message buffer area application interface provided by an operating system is used for allocating a buffer area for a receiving descriptor when a next new frame is ready to be received; the allocation is performed when the buffer area is needed, which has the advantage of low memory overhead, but the memory needs to be dynamically allocated, so the CPU overhead is relatively large. The pre-allocation mode is that a certain number of message buffer areas are pre-allocated to be placed in a buffer area pool during network initialization, and when a next new frame is ready to be received, the buffer areas are allocated for receiving descriptors from the buffer pool; in the implementation mode, the memory utilization rate in the startup phase is higher due to the adoption of the mode of reserving the memory, but the allocation performance of the buffer area is better.
The resource leakage of the message buffer area means that the message buffer area is not recycled into the idle buffer area pool or the memory is not recycled after the message buffer area is used up, which is equivalent to memory leakage.
The most common method for managing packet buffer at present is packet buffer management and Data Plane Development Kit (DPDK) in Linux system.
In the Linux message processing, when a driver receives a message, the driver directly calls a skb _ alloc interface, applies for a message buffer from a special buffer, and a mechanism for dynamically distributing the message buffer is adopted. If a socket buffer (SKB) leaks in a Linux forwarding system, system memory leaks, the memory utilization rate rises, and finally, no idle memory is available in the system, so that system exception is caused.
DPDK is a data plane development kit that runs in user space and provides a message buffer management mechanism for the message buffer (mbuf). When the driver of the DPDK receives the data packet, the network card driver overloaded by the DPDK does not inform the CPU through interruption, but directly stores the data packet into the memory corresponding to the mbuf, and the mbuf adopts a pre-allocation mode. In the packet forwarding system implemented based on the DPDK, if the mbuf resource is not recovered in time after being used, so that there is no available mbuf in the mbuf spare pool, the system packet forwarding will be abnormal.
However, no matter the packet buffer management method of the pre-allocation method or the dynamic allocation method, there is no efficient memory recovery technology to prevent the system abnormality caused by the memory leak at present.
Disclosure of Invention
The embodiment of the invention provides a message buffer management method and a message buffer management device, which are used for solving the problem of system abnormity caused by the fact that a message buffer cannot be efficiently recycled in the prior art.
A method of message buffer management, the method comprising:
when a service process applies for a message buffer area, allocating an idle message buffer area in a total message buffer area for the service process, updating holder information of the idle message buffer area to an identification ID of the service process, and updating a timestamp of the idle message buffer area to the current latest time;
detecting the total message buffer area according to a preset period;
and when the holder information of a first message buffer area in the total message buffer area is not preset holder information and the timestamp of the first message buffer area exceeds a first preset time length and is not updated, recovering the first message buffer area.
Further, the method further comprises:
expanding the control information of the total message buffer area and increasing a holder information field and a timestamp field;
initializing the holder information field to preset holder information;
the holder information field is used for recording the service information of the currently held corresponding message buffer area; and the timestamp field is used for recording the timestamp of the message buffer corresponding to the latest update.
Further, the method further comprises:
when the service process releases the message buffer corresponding to the service process, the message buffer corresponding to the service process is recovered, the holder information of the message buffer corresponding to the service process is updated to preset holder information, and the timestamp of the message buffer corresponding to the service process is updated to the current latest time.
Further, the method further comprises:
and displaying the distribution condition of the resources of the total message buffer area according to the holder information of the total message buffer area.
Further, the detecting the total packet buffer according to the preset period includes:
detecting the number of idle message buffers in the total message buffer according to a preset period;
and when the number of the idle message buffers is smaller than a first threshold value, traversing and detecting the holder information and the timestamp of each message buffer in the total message buffer.
Further, when the holder information of the first packet buffer in the total packet buffer is not the preset holder information and the timestamp of the first packet buffer exceeds a first preset duration and is not updated, the recovering the first packet buffer includes:
when the number of the first message buffer areas exceeds a second threshold value, inquiring the holder information of the first message buffer areas;
and when the number of the first message buffer areas with the same owner information exceeds a third threshold value, triggering the business process corresponding to the owner information to restart so as to recycle the first message buffer areas.
A message buffer management apparatus, the apparatus comprising: a distribution unit, a detection unit and a recovery unit; wherein,
the distribution unit is used for distributing an idle message buffer area in a total message buffer area for the service process when the service process applies for the message buffer area, updating holder information of the idle message buffer area to an identification ID of the service process, and updating a timestamp of the idle message buffer area to the current latest time;
the detection unit is used for detecting the total message buffer area according to a preset period;
the recovery unit is configured to recover a first packet buffer area of the total packet buffer area when the owner information of the first packet buffer area is not preset owner information and a timestamp of the first packet buffer area exceeds a first preset duration and is not updated.
Further, the apparatus further comprises: an extension unit, configured to extend the control information of the total packet buffer, and add a holder information field and a timestamp field; initializing the holder information field to preset holder information; the holder information field is used for recording the service information of the currently held corresponding message buffer area; and the timestamp field is used for recording the timestamp of the message buffer corresponding to the latest update.
Further, the recovery unit is further configured to, when the service process releases the packet buffer corresponding to the service process, recover the packet buffer corresponding to the service process, update holder information of the packet buffer corresponding to the service process to preset holder information, and update a timestamp of the packet buffer corresponding to the service process to a current latest time.
Further, the apparatus further comprises: and the display unit is used for displaying the distribution condition of the resources of the total message buffer area according to the holder information of the total message buffer area.
Further, the detecting unit is specifically configured to detect the number of idle packet buffers in the total packet buffer pool according to a preset period; and when the number of the idle message buffers is smaller than a first threshold value, traversing and detecting the holder information and the timestamp of each message buffer in the total message buffer.
Further, the recovery unit is specifically configured to query holder information of the first packet buffer when the number of the first packet buffer exceeds a second threshold;
and when the number of the first message buffer areas with the same owner information exceeds a third threshold value, triggering the business process corresponding to the owner information to restart so as to recycle the first message buffer areas.
The invention has the following beneficial effects:
according to the message buffer management method and device provided by the embodiment of the invention, when the message buffer is allocated to the service process, the holder information of the message buffer is added, and the distribution condition of the message buffer can be presented through the holder information; and adding a timestamp of the message buffer area, determining whether the message buffer area has leakage or not by detecting the holder information and the timestamp, and recovering the leaked message buffer area corresponding to the service process by restarting the service process corresponding to the currently leaked message buffer area when the leakage of the message buffer area is detected, thereby realizing self-recovery and improving the reliability and fault tolerance of the system.
Drawings
FIG. 1 is a flow chart illustrating a message buffer management method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating step 102 of a message buffer management method according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating step 103 of the message buffer management method according to the embodiment of the present invention;
FIG. 4 is a diagram illustrating a pointer array of a pre-allocation mechanism for a packet buffer according to an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating owner information and timestamp updating in a message buffer management method according to an embodiment of the present invention;
fig. 6 is a schematic diagram illustrating a self-recovery process of a message buffer in a message buffer management method according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a message buffer management apparatus according to an embodiment of the present invention.
Detailed Description
Aiming at the problem that a message buffer zone in the prior art cannot be efficiently recycled to cause system abnormity, the message buffer zone management method provided by the embodiment of the invention has the basic principle that the control information of the message buffer zone is expanded, holder information and a timestamp for representing the current held message buffer zone are added, when a service process applies for the message buffer zone, the holder information of the distributed message buffer zone is updated to an identification ID of the service process while the message buffer zone is distributed to the service process, the timestamp is updated to the current latest time, and the distribution condition of message buffer zone resources in the current system can be presented by inquiring the holder information; and whether the current system has the conditions of message buffer resource leakage and the like can be quickly and accurately judged through the timestamp.
The flow of the message buffer management method provided by the embodiment of the invention is shown in fig. 1, and the execution steps are as follows:
102, detecting the total message buffer area according to a preset period;
Here, the preset holder information is used for representing that the message buffer is not held by any service process, namely, is in an idle state; the first preset duration may be set according to memory resources, service requirements, and a message recovery period, and may be generally 15s, and may be revised by a command according to performance of a network device, and the like.
Further, the method further comprises:
expanding the control information of the total message buffer area and increasing a holder information field and a timestamp field;
initializing the owner information to preset owner information;
wherein, the holder information field is a short integer field, which is used to record the service information of the currently held corresponding message buffer, for example, it may be an owner field of a U16 data type; the timestamp field is a long integer field used for recording a timestamp of a packet buffer corresponding to the latest update, and may be, for example, a tstamp field of an unscheduled long data type.
Further, the method further comprises:
when the service process releases the message buffer corresponding to the service process, the message buffer corresponding to the service process is recovered, the holder information of the message buffer corresponding to the service process is updated to preset holder information, and the timestamp of the message buffer corresponding to the service process is updated to the current latest time.
Further, when a user needs to check the distribution condition of the message buffer resources in the current system, the method further comprises the following steps: and displaying the distribution condition of the resources of the total message buffer area according to the holder information of the total message buffer area.
Fig. 2 shows a schematic flow diagram of step 102 in the message buffer management method according to the embodiment of the present invention, as shown in fig. 2, when a pre-allocation mechanism is adopted for the message buffer resources, the total message buffer may include multiple message buffers, and step 102 detects the total message buffer according to a preset period, including:
specifically, by detecting the owner information of the message buffer, when the owner information is the preset owner information, it indicates that the message buffer is in an idle state, that is, the message buffer is available.
Here, the first threshold may be determined according to a total number of the message buffers in the message buffer pool, for example, may be one fourth of the total number, and may specifically be determined according to actual needs.
In the embodiment of the invention, a group of one-dimensional pointer arrays can be defined to record the addresses of the message buffer pools, so that the detection can be realized by traversing the pointer arrays of all the message buffer pools according to the preset period.
Fig. 3 shows a schematic flow diagram of step 103 in the message buffer management method according to the embodiment of the present invention, and as shown in fig. 3, in step 103, when the holder information of the first message buffer in the total message buffer is not the preset holder information and the timestamp of the first message buffer exceeds the first preset duration and is not updated, the recovering the first message buffer includes:
here, when the number of the first buffer areas exceeds the second threshold value, the resource representing the current message buffer area is leaked to an alarm waterline, for example, the resource may be one half of the total number of the message buffer areas in the total message buffer area, which indicates that there are more message buffer areas to be recovered.
It should be understood that if the number of the first packet buffers does not exceed the second threshold, the first packet buffers can be directly recycled.
First message buffers with the same owner information indicate that the first message buffers are all assigned to the same business process. When the number of message buffers with resource leakage in one service process exceeds a third threshold, the service process is abnormal, and the service process can be recovered by restarting the service process; and if the business process is restarted, the message buffer area held by the business process can be released again, so that the message buffer area held by the business process is completely recycled, and the purpose of self-recovery of resource leakage is achieved. Here, the third threshold value may be less than or equal to the second threshold value.
In order to ensure high-performance forwarding of network devices, the following describes in detail a message buffer management method provided in an embodiment of the present invention, by taking an example that a message buffer employs a pre-allocation manner and is applied to a message forwarding system.
In the first embodiment of the present invention, a pre-allocation mechanism is adopted for the message buffer resources, the reserved numbers of the message buffer resources of network devices of different models are often different, the resource reservation often needs to be considered in combination with the actual memory condition of the network device and the overall forwarding bandwidth, and the present embodiment describes the reserved N message buffer resources according to the system.
The address of the message buffer is recorded by defining a one-dimensional array of pointers with a member index of N. Referring specifically to fig. 4, the pointer array records addresses of N packet buffer resources that are pre-applied by the system. The addresses of all message buffer areas are recorded through the array, so that the resources of the message buffer areas can be traversed at any time during the subsequent message buffer area leakage detection.
Step one, when the message buffer area initializes the pre-application to be put into the total message buffer area, the holder information of the message buffer area is uniformly set as SOFT _ BUFF _ POOL, and the owner indicates that the message buffer area is in an idle state.
And step two, the message forwarding system applies for a message buffer area from the total message buffer area, and requires to forcibly transmit the information (holder ID) of the holder, so that the control information of the message buffer area to be distributed can record the information of the holder, and meanwhile, the timestamp of the current message buffer area is updated to be the latest time.
And step three, when the message buffer area is transmitted to the entrance of each service in the message forwarding processing system, updating the holder information to the corresponding service owner id, and updating the timestamp (tstamp) of the message buffer area to the current latest time.
For example, when a packet buffer is delivered to service 1, the holder information of the packet buffer is marked as service 1, and the timestamp tstamp of the packet buffer is updated to be the current time.
And step four, when the message buffer area is released back to the total message buffer area, the holder information of the message buffer area is updated to be SOFT _ BUFF _ POOL again in the release interface. At this time, the message buffer returns to the total message buffer again and is in an idle state, and the timestamp of the current message buffer is updated to the latest time.
The process from the second step to the fourth step can be seen in fig. 5, wherein nic (network interface card) is a hardware network card,indicating the process of applying for a message buffer,representing the process of releasing the message buffer, and "←" representing the process of transferring messages.
And step five, triggering detection every 10 s. If the number of the available message buffers in the total message buffer is less than 1/4 of the total number of the message buffers, the global one-dimensional pointer array of all the message buffer addresses is recorded when the traversal system is initialized.
Step six, if the holder information of a message buffer is not SOFT _ BUFF _ POOL, namely the message buffer resource is already allocated, if the time stamp of the message buffer is not updated for more than 15 seconds at the same time, the message buffer is determined to be leaked.
Step seven, if the message buffer resource of the current system is leaked to a preset alarm waterline, for example, 1/2 (N/2) of the total number of message buffers is set, the leaked message buffer needs to be recovered;
specifically, in the first embodiment, in combination with the holder information, it is detected that 1/3 total message buffers are leaked by the service process 2, that is, N/3 message buffers are leaked by the service process 2; the service M-1 leaks 1/2 total message buffers, namely N/2 message buffers are leaked by the service process M-1; the business process 2 and the M-1 totally leak 5/6 total message buffer areas;
in another embodiment, the second threshold is 1/2, and the third threshold is 1/4, so that the service process corresponding to the leaked message buffers needs to be restarted; after the service processes are restarted, the message buffers held by the restarted service processes are released back to the total message buffer again, so as to implement a self-recovery process, which may specifically refer to fig. 6.
Step eight, because the addresses of all message buffer areas are recorded by the pointer array in the initialization process, the owner information of each message buffer area can be counted and recorded by traversing all the message buffer areas. The distribution of all message buffers in the system can be presented, and the message information in the message buffers can be printed out according to actual needs.
Based on the same inventive concept, an embodiment of the present invention provides a packet buffer management apparatus, which has a structure shown in fig. 7 and includes: a distribution unit 71 and a detection unit 72, and a recovery unit 73; wherein,
the allocating unit 71 is configured to allocate an idle packet buffer area in a total packet buffer area for a service process when the service process applies for a packet buffer area, update holder information of the idle packet buffer area to an identifier ID of the service process, and update a timestamp of the idle packet buffer area to current latest time;
the detecting unit 72 is configured to detect the total packet buffer according to a preset period;
the recycling unit 73 is configured to recycle the first packet buffer when the owner information of the first packet buffer in the total packet buffer is not preset owner information, and the timestamp of the first packet buffer exceeds a first preset duration and is not updated.
Here, the preset holder information is used for representing that the message buffer is not held by any service process, namely, is in an idle state; the first preset duration may be set according to memory resources, service requirements, and a message recovery period, and may be generally 15s, and may be revised by a command according to performance of a network device, and the like.
Further, the apparatus further comprises: an extension unit 74, configured to extend the control information of the total packet buffer, and add a holder information field and a timestamp field; initializing the owner information to preset owner information; wherein, the holder information field is a short integer field for recording the service information of the message buffer currently held, for example, it may be an owner field of a U16 data type; the timestamp field is a long integer field used for recording a timestamp for updating the packet buffer last time, and may be, for example, a tstamp field of an unsigned long data type.
Further, the recycling unit 73 is further configured to recycle the packet buffer corresponding to the service process when the service process releases the packet buffer corresponding to the service process, update holder information of the packet buffer corresponding to the service process to preset holder information, and update a timestamp of the packet buffer corresponding to the service process to a current latest time.
Further, the apparatus further comprises: and a display unit 75, configured to display the distribution of the total message buffer resource according to the holder information of the total message buffer.
Further, the detecting unit 72 is specifically configured to detect the number of idle packet buffers in the total packet buffer according to a preset period; when the number of the idle message buffers is smaller than a first threshold value, traversing and detecting the holder information and the timestamp of each message buffer in the total message buffer; in the embodiment of the present invention, a group of one-dimensional pointer arrays may be defined to record the address of the total packet buffer, and thus, the detection may be implemented by traversing the pointer arrays of the total packet buffer according to a preset period.
Specifically, by detecting the owner information of the packet buffer, when the owner information is the preset owner information, it indicates that the packet buffer is in an idle state, that is, the packet buffer is available, and the first threshold may be determined according to the total number of the total packet buffers, for example, may be one fourth of the total number, and may specifically be determined according to actual needs.
Further, the recycling unit 73 is specifically configured to query holder information of the first packet buffer when the number of the first packet buffer exceeds a second threshold; here, when the number of the first buffer areas exceeds the second threshold value, the resource representing the current message buffer area is leaked to an alarm waterline, for example, may be one half of the total number of the message buffer areas in the total message buffer area, which indicates that there are more message buffer areas to be recovered. It should be understood that if the number of the first packet buffers does not exceed the second threshold, the first packet buffers can be directly recycled.
The recycling unit 73 is specifically configured to, when the number of first packet buffers with the same owner information exceeds a third threshold, trigger a restart of a service process corresponding to the owner information to recycle the first packet buffers. First message buffers with the same owner information indicate that the first message buffers are all assigned to the same business process. When the number of message buffers with resource leakage in one service process exceeds a third threshold, the service process is abnormal, and the service process can be recovered by restarting the service process; and if the service process is restarted, the message buffer area held by the service process can be released again, so that the message buffer area held by the service process is completely recycled, and the purpose of self-recovery of resource leakage is achieved. Here, the third threshold value may be less than or equal to the second threshold value.
It should be understood that the implementation principle and the process of the message buffer management apparatus provided in the embodiment of the present invention are similar to those in fig. 1 to 6 and the embodiments shown above, and are not described herein again.
According to the message buffer management method and device provided by the embodiment of the invention, when the message buffer is allocated to the service process, the holder information of the message buffer is added, and the distribution condition of the message buffer can be presented through the holder information; and adding a timestamp of the message buffer area, determining whether the message buffer area has leakage or not by detecting the holder information and the timestamp, and recovering the message buffer area leaked by the service process by restarting the currently leaked service process when the leakage of the message buffer area is detected, thereby realizing self-recovery and improving the reliability and fault tolerance of the system. When the system has insufficient performance, the distribution condition of the current message buffer area can be checked through the holder information, whether the message accumulation occurs in the service in the system or not is judged, the fault location is rapidly carried out, and the message forwarding performance is ensured.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While alternative embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following appended claims be interpreted as including alternative embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.
Claims (12)
1. A method for managing a message buffer, the method comprising:
when a service process applies for a message buffer area, allocating an idle message buffer area in a total message buffer area for the service process, updating holder information of the idle message buffer area to an identification ID of the service process, and updating a timestamp of the idle message buffer area to the current latest time;
detecting the total message buffer area according to a preset period;
when the holder information of a first message buffer area in the total message buffer area is not preset holder information and the timestamp of the first message buffer area exceeds a first preset time length and is not updated, recovering the first message buffer area;
the initialization information of the holder information field is preset holder information, and the preset holder information is used for representing that the message buffer area is in an idle state.
2. The method of claim 1, further comprising:
expanding the control information of the total message buffer area and increasing a holder information field and a timestamp field;
initializing the holder information field to preset holder information;
the holder information field is used for recording the service information of the currently held corresponding message buffer area; and the timestamp field is used for recording the timestamp of the message buffer corresponding to the latest update.
3. The method of claim 1, further comprising:
when the service process releases the message buffer corresponding to the service process, the message buffer corresponding to the service process is recovered, the holder information of the message buffer corresponding to the service process is updated to preset holder information, and the timestamp of the message buffer corresponding to the service process is updated to the current latest time.
4. The method of claim 1, further comprising:
and displaying the distribution condition of the resources of the total message buffer area according to the holder information of the total message buffer area.
5. The method according to claim 1, wherein the detecting the total packet buffer according to the preset period comprises:
detecting the number of idle message buffers in the total message buffer according to a preset period;
and when the number of the idle message buffers is smaller than a first threshold value, traversing and detecting the holder information and the timestamp of each message buffer in the total message buffer.
6. The method according to any one of claims 1 to 5, wherein when the holder information of a first packet buffer in the total packet buffers is not the preset holder information and the timestamp of the first packet buffer exceeds a first preset duration without being updated, then recycling the first packet buffer comprises:
when the number of the first message buffer areas exceeds a second threshold value, inquiring the holder information of the first message buffer areas;
and when the number of the first message buffer areas with the same owner information exceeds a third threshold value, triggering the business process corresponding to the owner information to restart so as to recycle the first message buffer areas.
7. An apparatus for message buffer management, the apparatus comprising: a distribution unit, a detection unit and a recovery unit; wherein,
the distribution unit is used for distributing an idle message buffer area in a total message buffer area for the service process when the service process applies for the message buffer area, updating holder information of the idle message buffer area to an identification ID of the service process, and updating a timestamp of the idle message buffer area to the current latest time;
the detection unit is used for detecting the total message buffer area according to a preset period;
the recovery unit is configured to recover a first packet buffer area in the total packet buffer area when the holder information of the first packet buffer area is not preset holder information and a timestamp of the first packet buffer area exceeds a first preset duration and is not updated;
the initialization information of the holder information field is preset holder information, and the preset holder information is used for representing that the message buffer area is in an idle state.
8. The apparatus of claim 7, further comprising: an extension unit, configured to extend the control information of the total packet buffer, and add a holder information field and a timestamp field; initializing the holder information field to preset holder information; the holder information field is used for recording the service information of the currently held corresponding message buffer area; and the timestamp field is used for recording the timestamp of the message buffer corresponding to the latest update.
9. The apparatus according to claim 7, wherein the recycling unit is further configured to recycle the packet buffer corresponding to the service process when the service process releases the packet buffer corresponding to the service process, update holder information of the packet buffer corresponding to the service process to preset holder information, and update a timestamp of the packet buffer corresponding to the service process to a current latest time.
10. The apparatus of claim 7, further comprising: and the display unit is used for displaying the distribution condition of the resources of the total message buffer area according to the holder information of the total message buffer area.
11. The apparatus according to claim 7, wherein the detecting unit is specifically configured to detect the number of idle packet buffers in the total packet buffer pool according to a preset period; and when the number of the idle message buffers is smaller than a first threshold value, traversing and detecting the holder information and the timestamp of each message buffer in the total message buffer.
12. The apparatus according to any of the claims 7 to 11, wherein the recycling unit is specifically configured to query holder information of the first packet buffer when the number of the first packet buffer exceeds a second threshold;
and when the number of the first message buffer areas with the same owner information exceeds a third threshold value, triggering the business process corresponding to the owner information to restart so as to recycle the first message buffer areas.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810666218.9A CN109062781B (en) | 2018-06-22 | 2018-06-22 | Message buffer management method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810666218.9A CN109062781B (en) | 2018-06-22 | 2018-06-22 | Message buffer management method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109062781A CN109062781A (en) | 2018-12-21 |
CN109062781B true CN109062781B (en) | 2022-04-26 |
Family
ID=64821568
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810666218.9A Active CN109062781B (en) | 2018-06-22 | 2018-06-22 | Message buffer management method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109062781B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113495832A (en) * | 2020-04-05 | 2021-10-12 | 杭州迪普科技股份有限公司 | Cache region leakage detection system and method thereof |
CN114095426B (en) * | 2021-09-28 | 2023-04-04 | 浪潮软件科技有限公司 | Message processing method and device of VPP platform |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH04124754A (en) * | 1990-09-14 | 1992-04-24 | Nec Corp | Communication message buffer controller |
CN101923517B (en) * | 2009-06-17 | 2013-03-27 | 中兴通讯股份有限公司 | Buffer zone management method and system |
CN104468401B (en) * | 2014-11-20 | 2017-11-17 | 华为技术有限公司 | A kind of message processing method and device |
CN107529695A (en) * | 2016-06-20 | 2018-01-02 | 迈普通信技术股份有限公司 | The localization method and device that a kind of buffering area slowly leaks |
CN107526641A (en) * | 2017-08-28 | 2017-12-29 | 青岛海信移动通信技术股份有限公司 | A kind of method and device for reclaiming internal memory |
-
2018
- 2018-06-22 CN CN201810666218.9A patent/CN109062781B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109062781A (en) | 2018-12-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11586673B2 (en) | Data writing and reading method and apparatus, and cloud storage system | |
CN106708622B (en) | Cluster resource processing method and system and resource processing cluster | |
US10067692B2 (en) | Method and apparatus for backing up and restoring cross-virtual machine application | |
CN109240825B (en) | Elastic task scheduling method, device, equipment and computer readable storage medium | |
JP4684607B2 (en) | Dynamic memory management method and apparatus for object-oriented programs | |
EP2975515A1 (en) | System and method for managing excessive distribution of memory | |
CN107168777B (en) | Method and device for scheduling resources in distributed system | |
US10282120B2 (en) | Method, apparatus and system for inserting disk | |
CN110597635B (en) | Graphics processing resource allocation method, graphics processing resource allocation device, computer equipment and storage medium | |
CN109062781B (en) | Message buffer management method and device | |
CN104539708A (en) | Capacity reduction method, device and system for cloud platform resources | |
CN112291382A (en) | IP address allocation method and device | |
CN113204407A (en) | Memory over-allocation management method and device | |
CN110659104B (en) | Service monitoring method and related equipment | |
JP2024113165A (en) | Data structure, memory means, and device | |
WO2017185263A1 (en) | Memory reclaiming method and apparatus | |
CN112231053B (en) | Load balancing service distribution method and device | |
US20220206836A1 (en) | Method and Apparatus for Processing Virtual Machine Migration, Method and Apparatus for Generating Virtual Machine Migration Strategy, Device and Storage Medium | |
CN111352710B (en) | Process management method and device, computing equipment and storage medium | |
CN105205409A (en) | Method for preventing data leakage during memory multiplexing and computer system | |
CN108595270B (en) | Memory resource recovery method and device | |
CN112346848A (en) | Method, device and terminal for managing memory pool | |
CN112100017B (en) | Memory resource monitoring method and device | |
CN113568581A (en) | Multi-application resource recovery method and system for embedded equipment | |
CN114157717A (en) | Micro-service dynamic current limiting system and method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |