CN103530239A - Method for improving performance of communication server by using memory pool - Google Patents

Method for improving performance of communication server by using memory pool Download PDF

Info

Publication number
CN103530239A
CN103530239A CN201310490032.XA CN201310490032A CN103530239A CN 103530239 A CN103530239 A CN 103530239A CN 201310490032 A CN201310490032 A CN 201310490032A CN 103530239 A CN103530239 A CN 103530239A
Authority
CN
China
Prior art keywords
communication server
memory pool
memory
memory block
service request
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.)
Pending
Application number
CN201310490032.XA
Other languages
Chinese (zh)
Inventor
张方玉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHENZHEN NEW GREENNET TECHNOLOGIES Co Ltd
Original Assignee
SHENZHEN NEW GREENNET TECHNOLOGIES Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by SHENZHEN NEW GREENNET TECHNOLOGIES Co Ltd filed Critical SHENZHEN NEW GREENNET TECHNOLOGIES Co Ltd
Priority to CN201310490032.XA priority Critical patent/CN103530239A/en
Publication of CN103530239A publication Critical patent/CN103530239A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a method for improving performance of a communication server by using a memory pool. The method comprises the steps that the number of concurrent processing of the communication server is obtained from a designated configuration file; a memory block for processing interaction messages of the communication server is applied for in a one-off mode according to the number of concurrent processing; memory is applied for and destroyed according to a service request of the communication server through the management method of the memory pool, so that the response time of the communication server is shortened, and the performance of the server is improved. The configuration file is based on the concurrent processing capability of the communication server. According to the method, the number of current processing is obtained according to the configuration file, the management mechanism of the memory pool is achieved, the response speed of the communication server is increased, the stability of the server is improved, and the service experience of a user or the loyalty index of the user for a service product is promoted.

Description

A kind of method of using memory pool to promote communication server performance
Technical field
The present invention relates to computer communication network technology and server technical field, relate in particular to a kind of method of using memory pool to promote communication server performance.
Background technology
The communication server, refers to that a management resource in computer communication network externally provides the high-performance computer of business service.They intercept in computer communication network the service request from client, and service request is responded and processed, and are different business service, have enriched network application.Under operating system, dynamic memory management is very consuming time, large especially to effectiveness affects, yet in actual application process, but inevitably often will use the internal memory in heap.But there is birth defect in the Memory Allocation of being undertaken by malloc function or new function etc.: (1) utilizes the memory management function of acquiescence to distribute on heap and releasing memory needs the expensive time; (2) As time goes on, on heap, can form many memory fragmentations, in application program, carrying out internal memory application operation will be subject to larger impact, causes the operation of application program more and more slower.
When application program need to be applied for internal memory regularly to the object of fixed size, often can adopt memory pool (Memory Pool) technology to improve memory management efficiency.Classical memory pool way is the identical fritter internal memories of a large amount of sizes of disposable distribution, by this technology, can greatly accelerate Memory Allocation/dispose procedure.Memory pool technique is applied for internal memory by batch, has reduced internal memory request times, thereby makes operation save the time.When having reduced memory fragmentation generation, the lifting of performance is had to significant help.
Summary of the invention
Fundamental purpose of the present invention is to provide a kind of method of using memory pool to promote communication server performance, thereby improves communication server performance, promotes user's business experience or the loyalty to business service product.
For achieving the above object, the present invention proposes a kind of method of using memory pool to promote communication server performance, and the communication server is pre-created the idle stand-by memory block of limited quantity; In communication server operational process, by according to the service request receiving, by internal memory pool managing method, and the idle stand-by memory block of distribution gives this service request use configuration state for using; After this service request processing execution completes, configuration state is idle again, follow-up for the communication server; Described internal memory pool managing method comprises the following steps:
A, the communication server obtain concurrent number initialization thread pond from configuration file;
B, judge whether current time has service request; If so, perform step C; If not performing step F;
C, judge in current time memory pool, whether there is the still memory block in idle condition; If so, perform step D; If not performing step E;
D, internal memory pool managing method distribute a free memory block to use to service request thread; After standby service request is finished dealing with; Internal memory pool managing method reclaims the memory block for this service request; Then perform step F;
E, record that internal memory pool managing method distributes less than memory block; And send service request and process mistake;
F, after time delay Δ t, return to step B.
G, the communication server exit, internal memory pool managing method releasing memory.
By internal memory pool managing method, can improve communication server performance, thereby improve client Operational Visit speed.
Described in step D, the distribution of internal memory pool managing method comprises the following steps:
1), traversal memory pool; If there is free memory block, perform step 2); If there is no free memory block, performs step 3);
2), the state of free memory block in traversal memory pool is set to use; Free counter is done and is subtracted an operation; Usage counter is done and is added an operation; And return to the first address of this memory block.
3), return to null pointer;
Described in step D, internal memory pool managing method reclaims and comprises the following steps:
1) will use the state of memory block to put the free time;
2) free counter is done and is added an operation; Usage counter is done and is subtracted an operation.
Further improvement of the present invention is: step D is used internal memory pool managing method to go to distribute and regain memory block, described internal memory pool managing method to distribute and comprises the steps:
1), traversal memory pool; If there is free memory block, perform step
2), if there is no free memory block, perform step 3);
3), the state of free memory block in traversal memory pool is set to use; Free counter is done and is subtracted an operation; Usage counter is done and is added an operation; And return to the first address of this memory block.
The idle stand-by memory headroom that the described communication server is pre-created limited quantity is specially, and when the communication server starts operation, according to configuration file, obtains concurrent number, creates the idle stand-by memory block of concurrent several fixed sizes.
By configuration file, obtain concurrent number, by concurrent number, carry out the size in specified memory pond.
In described step F, the span of time delay Δ t is 10-100ms.
The invention has the beneficial effects as follows: the present invention by obtaining server concurrent number in specified configuration file; According to the mutual message memory headroom of the disposable application server process of concurrent number, by internal memory pool managing method, realize and will apply for and destroy internal memory to communication server service request, thereby shorten communication server response time improving performance of server, aspect following two, embodied, improved communication server response speed, strengthen the stability of server, promoted user's business experience or the loyalty to business service product: 1) shortened the Memory Allocation time.Because memory pool is to use the front disposable memory block of having applied for, when the communication server is processed service request, do not need to apply for internal memory, thereby saved the internal memory application time.2) reduced memory fragmentation.Because memory pool is to use the front disposable memory block of having applied for, when the communication server is processed repeatedly service request, avoided repeating the possibility of application and destruction internal memory, thereby improved the utilization factor of internal memory.
Feature of the present invention and advantage will be elaborated by reference to the accompanying drawings by embodiment.
Accompanying drawing explanation
Fig. 1 represents communication server internal memory pool managing method structural representation of the present invention.
Fig. 2 represents communication server internal memory pool managing method flow diagram of the present invention.
Embodiment
The present invention by obtaining server concurrent number in specified configuration file; According to the mutual message memory headroom of the disposable application server process of concurrent number, by internal memory pool managing method, realize and will apply for and destroy internal memory to communication server service request, thereby shorten communication server response time improving performance of server.
Below by embodiment, effect of the present invention is described further.
As shown in Figure 1, be one embodiment of the present of invention:
Step 1 is in configuration file, to obtain the information of concurrent number, i.e. initialization before communication server operation.
Step 2 is according to concurrent number and the unified application of mutual guarantor's literary composition size memory headroom, the i.e. initialization of memory pool.
Step 3 is to distribute and recovery required memory, the i.e. management of memory pool by internal memory pool managing mechanism.
Step 4 is to destroy internal memory, the i.e. destruction of memory pool by internal memory pool managing mechanism.
As shown in Figure 2, be internal memory pool managing method flow diagram of the present invention, comprise the following steps:
A, the communication server obtain concurrent number initialization thread pond from configuration file;
B, judge whether current time has service request; If so, perform step C; If not performing step F;
C, judge in current time memory pool, whether there is the still memory block in idle condition; If so, perform step D; If not performing step E;
D, internal memory pool managing method distribute a free memory block to use to service request thread; After standby service request is finished dealing with; Internal memory pool managing method reclaims the memory block for this service request; Then perform step F;
E, record that internal memory pool managing method distributes less than memory block; And send service request and process mistake;
F, after time delay Δ t, return to step B.
G, the communication server exit, internal memory pool managing method releasing memory.
By internal memory pool managing method, can improve communication server performance, thereby improve client Operational Visit speed.
Described in step D, the distribution of internal memory pool managing method comprises the following steps:
1), traversal memory pool; If there is free memory block, perform step 2); If there is no free memory block, performs step 3);
2), the state of free memory block in traversal memory pool is set to use; Free counter is done and is subtracted an operation; Usage counter is done and is added an operation; And return to the first address of this memory block.
3), return to null pointer;
Described in step D, internal memory pool managing method reclaims and comprises the following steps:
1) will use the state of memory block to put the free time;
2) free counter is done and is added an operation; Usage counter is done and is subtracted an operation.
The present invention makes the communication server speed of response faster, has strengthened stability and the high efficiency of server.
 
Although described by reference to the accompanying drawings embodiments of the present invention; but those skilled in the art can make various distortion or modification within the scope of the appended claims; as long as be no more than the described protection domain of claim of the present invention, all should be within protection scope of the present invention.

Claims (6)

1. use memory pool to promote a method for communication server performance, it is characterized in that: the communication server is pre-created the idle stand-by memory block of limited quantity; In communication server operational process, by according to the service request receiving, by internal memory pool managing method, and the idle stand-by memory block of distribution gives this service request use configuration state for using; After this service request processing execution completes, configuration state is idle again, follow-up for the communication server; Described internal memory pool managing method specifically comprises that step is as follows:
A, the communication server obtain concurrent number initialization thread pond from configuration file;
B, judge whether current time has service request; If so, perform step C; If not performing step F;
C, judge in current time memory pool, whether there is the still memory block in idle condition; If so, perform step D; If not performing step E;
D, internal memory pool managing method distribute a free memory block to use to service request thread; After standby service request is finished dealing with; Internal memory pool managing method reclaims the memory block for this service request; Then perform step F;
E, record that internal memory pool managing method distributes less than memory block; And send service request and process mistake;
F, after time delay Δ t, return to step B;
G, the communication server exit, internal memory pool managing method releasing memory.
2. a kind of method of using memory pool to promote communication server performance as claimed in claim 1, is characterized in that: the internal memory pool managing method described in step C is distributed and comprised the following steps:
1) traversal memory pool; If there is free memory block, perform step 2); If there is no free memory block, performs step 3);
2) state of free memory block in traversal memory pool is set to use; Free counter is done and is subtracted an operation; Usage counter is done and is added an operation, and returns to the first address of this memory block;
3) return to null pointer.
3. a kind of method of using memory pool to promote communication server performance as claimed in claim 1, is characterized in that: the internal memory pool managing method described in step C reclaims and comprises the following steps:
1) will use the state of memory block to put the free time;
2) free counter is done and is added an operation; Usage counter is done and is subtracted an operation.
4. a kind of method of using memory pool to promote communication server performance as claimed in claim 1, it is characterized in that: the idle stand-by memory headroom that the described communication server is pre-created limited quantity is specially, when the communication server starts operation, according to configuration file, obtain concurrent number, create the idle stand-by memory block of concurrent several fixed sizes.
5. a kind of method of using memory pool to promote communication server performance as described in claim 1 or 4, is characterized in that: by configuration file, obtain concurrent number, carry out the size in specified memory pond by concurrent number.
6. a kind of method of using memory pool to promote communication server performance as described in claim 1, is characterized in that, in described step F, the span of time delay Δ t is 10-100ms.
CN201310490032.XA 2013-10-18 2013-10-18 Method for improving performance of communication server by using memory pool Pending CN103530239A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310490032.XA CN103530239A (en) 2013-10-18 2013-10-18 Method for improving performance of communication server by using memory pool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310490032.XA CN103530239A (en) 2013-10-18 2013-10-18 Method for improving performance of communication server by using memory pool

Publications (1)

Publication Number Publication Date
CN103530239A true CN103530239A (en) 2014-01-22

Family

ID=49932268

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310490032.XA Pending CN103530239A (en) 2013-10-18 2013-10-18 Method for improving performance of communication server by using memory pool

Country Status (1)

Country Link
CN (1) CN103530239A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108111522A (en) * 2017-12-28 2018-06-01 武汉长光科技有限公司 It is a kind of that the method for stablizing safe universal service protocol frame is realized on onu
CN108958952A (en) * 2018-06-26 2018-12-07 郑州云海信息技术有限公司 Message communication method, device, equipment and readable storage medium storing program for executing
CN109918203A (en) * 2019-03-18 2019-06-21 深圳市网心科技有限公司 Access server memory management optimization method, access server and communication system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020199069A1 (en) * 2001-06-07 2002-12-26 Joseph Anish Pulikottil Method of memory management in a multi-threaded environment and program storage device
CN1703041A (en) * 2005-06-08 2005-11-30 武汉虹信通信技术有限责任公司 Method for parallel processing big quantities of data in a communication server
CN101055533A (en) * 2007-05-28 2007-10-17 中兴通讯股份有限公司 Multithreading processor dynamic EMS memory management system and method
CN102915276A (en) * 2012-09-25 2013-02-06 武汉邮电科学研究院 Memory control method for embedded systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020199069A1 (en) * 2001-06-07 2002-12-26 Joseph Anish Pulikottil Method of memory management in a multi-threaded environment and program storage device
CN1703041A (en) * 2005-06-08 2005-11-30 武汉虹信通信技术有限责任公司 Method for parallel processing big quantities of data in a communication server
CN101055533A (en) * 2007-05-28 2007-10-17 中兴通讯股份有限公司 Multithreading processor dynamic EMS memory management system and method
CN102915276A (en) * 2012-09-25 2013-02-06 武汉邮电科学研究院 Memory control method for embedded systems

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108111522A (en) * 2017-12-28 2018-06-01 武汉长光科技有限公司 It is a kind of that the method for stablizing safe universal service protocol frame is realized on onu
CN108958952A (en) * 2018-06-26 2018-12-07 郑州云海信息技术有限公司 Message communication method, device, equipment and readable storage medium storing program for executing
CN109918203A (en) * 2019-03-18 2019-06-21 深圳市网心科技有限公司 Access server memory management optimization method, access server and communication system

Similar Documents

Publication Publication Date Title
EP3073374B1 (en) Thread creation method, service request processing method and related device
CN108848039B (en) Server, message distribution method and storage medium
WO2018076759A1 (en) Block chain-based multi-chain management method and system, electronic device, and storage medium
JP5510556B2 (en) Method and system for managing virtual machine storage space and physical hosts
CN102917052A (en) Method for distributing resources in cloud computing system
CN103064797B (en) Data processing method and virtual machine management platform
CN103248696B (en) Dynamic configuration method for virtual resource under a kind of cloud computing environment
CN104461698A (en) Dynamic virtual disk mounting method, virtual disk management device and distributed storage system
CN104951352A (en) Method and equipment for migrating data flow
CN103309745A (en) Method and device for distributing virtual resource in cloud architecture
CN106502875A (en) A kind of daily record generation method and system based on cloud computing
CN109992566A (en) A kind of file access method, device, equipment and readable storage medium storing program for executing
CN112685499A (en) Method, device and equipment for synchronizing process data of work service flow
CN110471769B (en) Resource management method and device for virtual machine
CN104461404A (en) Metadata storage method, device and system
CN103530239A (en) Method for improving performance of communication server by using memory pool
US11886225B2 (en) Message processing method and apparatus in distributed system
CN103218254B (en) A kind of AFC (Automatic Fare Collection) data processing method of many queues
CN109271247A (en) Memory Optimize Method, device, computer installation and storage medium
Xu et al. Building a high-performance key–value cache as an energy-efficient appliance
CN108696559B (en) Stream processing method and device
CN113254445A (en) Real-time data storage method and device, computer equipment and storage medium
WO2023071576A1 (en) Container cluster construction method and system
CN104714923A (en) Method and device for achieving equipment sharing
CN111209263A (en) Data storage method, device, equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20140122