Business processing method and device, electronic equipment and storage medium

By pre-applying for the use of shared memory pools and lock mechanisms, frequent applications and releases in memory management in switches are solved, the stability and mutual exclusion of the system are ensured, and the impact of memory fragmentation and memory exhaustion is avoided.

CN119088598APending Publication Date: 2024-12-06ZIGUANG HENGYUE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411307313.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

Data sorting and memory management of MAC hardware table entries in the switch lead to frequent application and release of memory, resulting in memory fragmentation and affecting system stability.

Method used

By applying for a shared memory pool in advance, multiple services are allowed to access, avoid dynamically applying for memory during use, and use lock mechanism to achieve mutually exclusive access, ensuring memory stability and maintainability.

Benefits of technology

It minimizes the impact of system memory exhaustion, avoids memory fragmentation problems, and ensures system maintainability and mutual exclusion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088598A_ABST
    Figure CN119088598A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a service processing method and device, electronic equipment and a storage medium. The method comprises the steps that a service request sent by a client terminal is acquired; according to the embodiment of the invention, the shared memory pool is applied in advance, multi-service access is allowed, and the memory does not need to be dynamically applied to the system during use, so that the memory is reserved in advance and is not occupied by other services in the switch, and when the memory of the system is used up, the service request is processed by the memory when the system is used up. And the maintainability of the system is not influenced to the greatest extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a business processing method, device, electronic device and storage medium. Background Art

[0002] With the continuous increase of business, the requirements for switches are getting higher and higher, and the requirements for switch memory are also getting higher and higher. If the switch fails, the business cannot be carried out normally. The switch stores the MAC hardware table items of the switch. Due to the large specifications of the hardware table items, the data structure needs to be converted before displaying to perform operations such as data sorting. 96k MAC hardware table items require 96k software nodes. When frequent requests from client terminals are received, malloc needs to be used to frequently apply for memory, which will cause a large number of small memories, frequent applications, and frequent releases, which may cause memory fragmentation. How to manage memory and maintain memory stability is an urgent problem to be solved. Summary of the invention

[0003] The purpose of some embodiments of the present application is to provide a business processing method, device, electronic device and storage medium. Through the technical solution of the embodiments of the present application, a business request is sent by obtaining a client terminal; the business request is processed using a pre-applied memory. The embodiments of the present application pre-apply for a shared memory pool to allow multi-business access, and there is no need to dynamically apply for memory from the system when using it. In this way, it is reserved in advance and will not be occupied by other businesses in the switch. When the system memory is exhausted, the system maintainability is not affected to the greatest extent.

[0004] In a first aspect, some embodiments of the present application provide a service processing method, including:

[0005] Obtain the service request sent by the client terminal;

[0006] The business request is processed using the pre-applied memory.

[0007] The embodiment of the present application allows multi-service access by applying for a shared memory pool in advance, and there is no need to dynamically apply for memory from the system when using it. In this way, the memory is reserved in advance and will not be occupied by other services in the switch. When the system memory is exhausted, the system maintainability is not affected to the greatest extent.

[0008] Optionally, the using the pre-applied memory to process the service request includes:

[0009] The pre-set public interface is used to call the pre-applied memory to process the service request.

[0010] Some embodiments of the present application provide a common interface for memory access. After receiving multiple service requests, the common interface can be used to allow multiple modules to mutually exclude each other from using shared memory, and a lock mechanism can be used to achieve mutual exclusion.

[0011] Optionally, the method further comprises:

[0012] In the case of receiving service requests sent by multiple client terminals, using the pre-applied memory to process a first service request sent by a first client terminal;

[0013] After the first service request is executed, the pre-applied memory is used to process a second service request sent by a second client terminal.

[0014] In some embodiments of the present application, when one service uses shared memory, other services cannot use the shared memory, thereby ensuring mutual exclusivity of access.

[0015] Optionally, the method further comprises:

[0016] After the first service request is executed, the pre-applied memory is released.

[0017] In some embodiments of the present application, when a service uses a shared memory, other services cannot use the shared memory. Only when the service is executed and the shared memory is released, other services can use the shared memory.

[0018] Optionally, the method further comprises:

[0019] Before executing the business, apply for a preset amount of memory in advance.

[0020] In some embodiments of the present application, before executing a service, a fixed value of memory may be applied for executing the preset service without being affected by other services.

[0021] Optionally, the method further comprises:

[0022] Before the service is executed, the memory corresponding to the service volume is determined according to the size of the service volume.

[0023] Some embodiments of the present application may also apply for a memory of a corresponding size according to the size of the business volume, thereby avoiding waste of memory application.

[0024] In a second aspect, some embodiments of the present application provide a service processing device, including:

[0025] An acquisition module is used to acquire a service request sent by a client terminal;

[0026] The processing module is used to process the service request using the pre-applied memory.

[0027] The embodiment of the present application allows multi-service access by applying for a shared memory pool in advance, and there is no need to dynamically apply for memory from the system when using it. In this way, the memory is reserved in advance and will not be occupied by other services in the switch. When the system memory is exhausted, the system maintainability is not affected to the greatest extent.

[0028] Optionally, the processing module is used to:

[0029] The pre-set public interface is used to call the pre-applied memory to process the service request.

[0030] Some embodiments of the present application provide a common interface for memory access. After receiving multiple service requests, the common interface can be used to allow multiple modules to mutually exclude each other from using shared memory, and a lock mechanism can be used to achieve mutual exclusion.

[0031] Optionally, the processing module is used to:

[0032] In the case of receiving service requests sent by multiple client terminals, using the pre-applied memory to process a first service request sent by a first client terminal;

[0033] After the first service request is executed, the pre-applied memory is used to process a second service request sent by a second client terminal.

[0034] In some embodiments of the present application, when one service uses shared memory, other services cannot use the shared memory, thereby ensuring mutual exclusivity of access.

[0035] Optionally, the processing module is used to:

[0036] After the first service request is executed, the pre-applied memory is released.

[0037] In some embodiments of the present application, when a service uses a shared memory, other services cannot use the shared memory. Only when the service is executed and the shared memory is released, other services can use the shared memory.

[0038] Optionally, the processing module is used to:

[0039] Before executing the business, apply for a preset amount of memory in advance.

[0040] In some embodiments of the present application, before executing a service, a fixed value of memory may be applied for executing the preset service without being affected by other services.

[0041] Optionally, the processing module is used to:

[0042] Before the service is executed, the memory corresponding to the service volume is determined according to the size of the service volume.

[0043] Some embodiments of the present application may also apply for a memory of a corresponding size according to the size of the business volume, thereby avoiding waste of memory application.

[0044] In a third aspect, some embodiments of the present application provide an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the business processing method as described in any embodiment of the first aspect can be implemented.

[0045] In a fourth aspect, some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the business processing method as described in any embodiment of the first aspect.

[0046] In a fifth aspect, some embodiments of the present application provide a computer program product, wherein the computer program product includes a computer program, wherein when the computer program is executed by a processor, it can implement the business processing method as described in any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions of some embodiments of the present application, the drawings required for use in some embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 A flowchart of a business processing method provided in an embodiment of the present application;

[0049] Figure 2 A flowchart of another business processing method provided in an embodiment of the present application;

[0050] Figure 3 A schematic diagram of the structure of a service processing device provided in an embodiment of the present application;

[0051] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The technical solutions in some embodiments of the present application will be described below in conjunction with the drawings in some embodiments of the present application.

[0053] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0054] With the continuous increase of business, the requirements for switches are getting higher and higher, and the requirements for switch memory are also getting higher and higher. If the switch fails, the business cannot be carried out normally. In the switch, the MAC hardware table items of the switch are stored. Due to the large specifications of the hardware table items, the data structure needs to be converted before display to perform data sorting and other operations. 96k MAC hardware table items require 96k software nodes. When frequent requests from client terminals are received, it is necessary to use malloc to frequently apply for memory, which will cause a large number of small memories, frequent applications, and frequent releases. Memory fragmentation may occur. How to manage memory and maintain memory stability is an urgent problem to be solved. In view of this, some embodiments of the present application provide a business processing method, which includes obtaining a business request sent by a client terminal; using pre-applied memory to process the business request. The embodiments of the present application pre-apply for a shared memory pool to allow multi-business access, and do not need to dynamically apply for memory from the system when using it. In this way, it is reserved in advance and will not be occupied by other businesses in the switch. When the system memory is exhausted, it will not affect the maintainability of the system to the greatest extent.

[0055] like Figure 1 As shown, an embodiment of the present application provides a service processing method, the method comprising:

[0056] S101, obtaining a service request sent by a client terminal;

[0057] Specifically, the terminal device receives a service request sent by a client terminal, which may be one client terminal or multiple client terminals, which is not specifically limited in the embodiments of the present application.

[0058] The terminal device can be a general terminal or a server.

[0059] S102: Use the pre-applied memory to process the service request.

[0060] Specifically, the terminal device can pre-apply for a fixed amount of memory, or pre-apply for memory based on the volume of business;

[0061] Among them, memory is an important part of the computer, also known as internal memory and main memory. It is used to temporarily store the calculation data in the CPU and the data exchanged with external memory such as hard disk. It is a bridge for communication between external memory and CPU. All programs in the computer are run in the memory. The strength of memory performance affects the overall performance of the computer. As long as the computer starts running, the operating system will transfer the data to be calculated from the memory to the CPU for calculation. When the calculation is completed, the CPU will transmit the result. The memory bar is composed of memory chips, circuit boards, gold fingers and other parts.

[0062] There are many types of memory. According to its use, it can be divided into main memory and auxiliary memory. The main memory is also called internal memory (abbreviated as memory, called memory).

[0063] Memory, also known as main memory, is a storage space that the CPU can directly address and is made of semiconductor devices. It is characterized by fast access speed. Memory is the main component in a computer, relative to external memory. Programs that are commonly used, such as Windows operating system, typing software, game software, etc. are generally installed on external memory such as hard disks, but their functions cannot be used only by this. They must be transferred to memory to run in order to truly use their functions. Usually, large amounts of data to be permanently saved are stored in external memory, and some temporary or small amounts of data and programs are placed in memory. Of course, the quality of memory will directly affect the running speed of the computer. Memory is a place to temporarily store programs and data. When using WPS to process documents, when you type characters on the keyboard, it is stored in memory. When you choose to save, the data in memory will be stored in the hard (magnetic) disk.

[0064] After receiving the service request sent by the client terminal, the terminal device calls the public interface and uses the pre-applied memory to process the service request. In this way, by processing the service through the pre-applied memory, there is no need to frequently apply for memory, thus avoiding memory fragmentation and minimizing the impact on system maintainability.

[0065] The embodiment of the present application allows multi-service access by applying for a shared memory pool in advance, and there is no need to dynamically apply for memory from the system when using it. In this way, the memory is reserved in advance and will not be occupied by other services in the switch. When the system memory is exhausted, the system maintainability is not affected to the greatest extent.

[0066] Another embodiment of the present application further supplements the service processing method provided in the above embodiment.

[0067] Optionally, the service request is processed using the pre-applied memory, including:

[0068] Use the pre-set public interface to call the pre-applied memory to process the business request.

[0069] Specifically, a public interface module is installed on the terminal device, and the public interface module is used to provide a public interface for memory access, and can undertake the mutual exclusion of multiple modules using shared memory, and can adopt a lock mechanism to achieve mutual exclusion.

[0070] Some embodiments of the present application provide a common interface for memory access. After receiving multiple service requests, the common interface can be used to allow multiple modules to mutually exclude each other from using shared memory, and a lock mechanism can be used to achieve mutual exclusion.

[0071] Optionally, the method further comprises:

[0072] In the case of receiving service requests sent by multiple client terminals, using the pre-applied memory to process a first service request sent by a first client terminal;

[0073] After the first service request is executed, the pre-applied memory is used to process the second service request sent by the second client terminal.

[0074] In some embodiments of the present application, when one service uses shared memory, other services cannot use the shared memory, thereby ensuring mutual exclusivity of access.

[0075] Optionally, the method further comprises:

[0076] After the first service request is executed, the pre-applied memory is released.

[0077] In some embodiments of the present application, when a service uses a shared memory, other services cannot use the shared memory. Only when the service is executed and the shared memory is released, other services can use the shared memory.

[0078] Optionally, the method further comprises:

[0079] Before executing the business, apply for a preset amount of memory in advance.

[0080] Specifically, a shared memory pool module is provided on the terminal device. When the terminal device is started, a fixed-size memory is applied for in advance, which is specially used for system maintenance.

[0081] In some embodiments of the present application, before executing a service, a fixed value of memory may be applied for executing the preset service without being affected by other services.

[0082] Optionally, the method further comprises:

[0083] Before the business is executed, the memory corresponding to the business volume is determined according to the size of the business volume.

[0084] Some embodiments of the present application may also apply for a memory of a corresponding size according to the size of the business volume, thereby avoiding waste of memory application.

[0085] Figure 2 A flow chart of another service processing method provided by the embodiment of the present application, when the terminal device is initialized, a shared memory pool is applied to allow multi-service access, and there is no need to dynamically apply for memory from the system when in use. In this way, it is reserved in advance and will not be occupied by other services in the switch. When the system memory is exhausted, the maintainability of the system is not affected to the greatest extent. This shared memory is specifically used for maintainable temporary application memory use. After the service module is used up, it needs to be released for use by other modules.

[0086] Specifically include:

[0087] (1) When the terminal device starts, a fixed amount of memory is requested (pre-requested) specifically for maintainability.

[0088] (2) The software provides a public interface for memory access, which can support the mutual exclusion of multiple modules using shared memory, and can use a lock mechanism to achieve mutual exclusion.

[0089] (3) When business module module1 needs a small temporary memory, it applies for a memory node through the public interface provided in step (2). After use, it releases the memory through the public interface provided in step (2). If module2 also needs temporary memory, it also calls the public interface to apply for a memory node:

[0090] If this business module module1 is using shared memory, the public interface will return that the memory is unavailable. Module2 can continue to access it only after module1 releases the memory access lock, thus ensuring mutual exclusivity of access.

[0091] If no other business uses the shared memory at this time, module2 uses the memory pool normally.

[0092] The embodiment of the present application pre-applies for a certain size of memory to execute corresponding services, which will not be occupied by other services, thereby enhancing maintainable stability and avoiding the problem of system memory fragmentation caused by frequent application and release of small memories.

[0093] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any manner without conflict, and this application is not limited thereto.

[0094] Another embodiment of the present application provides a service processing device, which is used to execute the service processing method provided in the above embodiment.

[0095] like Figure 3FIG. 3 is a schematic diagram of the structure of a service processing device provided in an embodiment of the present application. The service processing device includes an acquisition module 301 and a processing module 302, wherein:

[0096] The acquisition module 301 is used to acquire the service request sent by the client terminal;

[0097] The processing module 302 is used to process the service request using the pre-applied memory.

[0098] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0099] The embodiment of the present application allows multi-service access by applying for a shared memory pool in advance, and there is no need to dynamically apply for memory from the system when using it. In this way, the memory is reserved in advance and will not be occupied by other services in the switch. When the system memory is exhausted, the system maintainability is not affected to the greatest extent.

[0100] Another embodiment of the present application further supplements the service processing device provided in the above embodiment.

[0101] Optionally, the processing module is used to:

[0102] Use the pre-set public interface to call the pre-applied memory to process the business request.

[0103] Some embodiments of the present application provide a common interface for memory access. After receiving multiple service requests, the common interface can be used to allow multiple modules to mutually exclude each other from using shared memory, and a lock mechanism can be used to achieve mutual exclusion.

[0104] Optionally, the processing module is used to:

[0105] In the case of receiving service requests sent by multiple client terminals, using the pre-applied memory to process a first service request sent by a first client terminal;

[0106] After the first service request is executed, the pre-applied memory is used to process the second service request sent by the second client terminal.

[0107] In some embodiments of the present application, when one service uses shared memory, other services cannot use the shared memory, thereby ensuring mutual exclusivity of access.

[0108] Optionally, the processing module is used to:

[0109] After the first service request is executed, the pre-applied memory is released.

[0110] In some embodiments of the present application, when a service uses a shared memory, other services cannot use the shared memory. Only when the service is executed and the shared memory is released, other services can use the shared memory.

[0111] Optionally, the processing module is used to:

[0112] Before executing the business, apply for a preset amount of memory in advance.

[0113] In some embodiments of the present application, before executing a service, a fixed value of memory may be applied for executing the preset service without being affected by other services.

[0114] Optionally, the processing module is used to:

[0115] Before the business is executed, the memory corresponding to the business volume is determined according to the size of the business volume.

[0116] Some embodiments of the present application may also apply for a memory of a corresponding size according to the size of the business volume, thereby avoiding waste of memory application.

[0117] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0118] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any combination without conflict, and this application is not limited thereto.

[0119] The embodiments of the present application also provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the operation of the method corresponding to any embodiment of the business processing method provided in the above embodiments can be implemented.

[0120] An embodiment of the present application further provides a computer program product, wherein the computer program product includes a computer program, wherein when the computer program is executed by a processor, it can implement the operations of the method corresponding to any embodiment of the business processing method provided in the above embodiments.

[0121] like Figure 4 As shown, some embodiments of the present application provide an electronic device 400, which includes: a memory 410, a processor 420, and a computer program stored in the memory 410 and executable on the processor 420, wherein the processor 420 can implement a method of any embodiment included in the above-mentioned business processing method when reading the program from the memory 410 through a bus 430 and executing the program.

[0122] Processor 420 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 420 can be a microprocessor.

[0123] The memory 410 may be used to store instructions executed by the processor 420 or data related to the execution of instructions. These instructions and / or data may include codes for implementing some or all functions of one or more modules described in the embodiments of the present application. The processor 420 of the disclosed embodiment may be used to execute instructions in the memory 410 to implement the method shown above. The memory 410 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory, or other memory known to those skilled in the art.

[0124] The above are only embodiments of the present application and are not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0125] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0126] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also 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 a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A business processing method, characterized in that: The method comprises: Obtain the service request sent by the client terminal; The business request is processed using the pre-applied memory.

2. The service processing method according to claim 1, characterized in that: The using the pre-applied memory to process the service request includes: The pre-set public interface is used to call the pre-applied memory to process the service request.

3. The service processing method according to claim 1, characterized in that: The method further comprises: In the case of receiving service requests sent by multiple client terminals, using the pre-applied memory to process a first service request sent by a first client terminal; After the first service request is executed, the pre-applied memory is used to process a second service request sent by a second client terminal.

4. The service processing method according to claim 3, characterized in that: The method further comprises: After the first service request is executed, the pre-applied memory is released.

5. The service processing method according to claim 1, characterized in that: The method further comprises: Before executing the business, apply for a preset amount of memory in advance.

6. The service processing method according to claim 1, characterized in that: The method further comprises: Before the service is executed, the memory corresponding to the service volume is determined according to the size of the service volume.

7. A service processing device, characterized in that: The device comprises: An acquisition module is used to acquire a service request sent by a client terminal; The processing module is used to process the service request using the pre-applied memory.

8. The service processing device according to claim 7, characterized in that: The processing module is used to: The pre-set public interface is used to call the pre-applied memory to process the service request.

9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor can implement the business processing method described in any one of claims 1 to 6 when executing the program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the program, when executed by a processor, can implement the business processing method described in any one of claims 1 to 6.