Summary of the invention
The application is intended to solve one of technical matters in correlation technique at least to a certain extent.
For this reason, first object of the application is to propose a kind of method preventing internal memory from exhausting, the method cocoa sends the warning message of releasing memory in time to managerial personnel, managerial personnel are facilitated to discharge in time, avoid application server to occur the situation that internal memory exhausts, and then stability and the robustness of server can be improved.
Second object of the application is to propose a kind of device preventing internal memory from exhausting.
For reaching above-mentioned purpose, the application's first aspect embodiment proposes a kind of method preventing internal memory from exhausting, and comprising: when monitoring the operation of Query Database, tackles the operation of described Query Database; And for tackling behavior at every turn, judge whether the returning results of query manipulation of tackling is default object, if preset object, then obtain the size of element in described default object, and determine the rank of corresponding monitored object according to the size of element in the described default object of preassigned and acquisition, to make the monitored object of monitor supervision platform to the different stage collected add up, when the monitored object quantity of different stage reaches corresponding threshold value, send the warning message of releasing memory.
The method preventing internal memory from exhausting of the embodiment of the present application, the operation of interception Query Database, and for tackling behavior at every turn, judge whether the returning results of query manipulation of tackling is default object, if preset object, then obtain the size presetting element in object, and determine the rank of corresponding monitored object according to the size of element in the default object of preassigned and acquisition, add up to make the monitored object of monitor supervision platform to the different stage collected, when the monitored object quantity of different stage reaches corresponding threshold value, send the warning message of releasing memory, to make managerial personnel according to the timely releasing memory of warning message, application server is avoided to occur the situation that internal memory exhausts, and then stability and the robustness of server can be improved.
For reaching above-mentioned purpose, the application's second aspect embodiment proposes a kind of device preventing internal memory from exhausting, and comprising: blocking module, for when monitoring the operation of Query Database, tackles the operation of described Query Database; And processing module, for for tackling behavior at every turn, judge whether the returning results of query manipulation of tackling is default object, if preset object, then obtain the size of element in described default object, and determine the rank of corresponding monitored object according to the size of element in the described default object of preassigned and acquisition, add up to make the monitored object of monitor supervision platform to the different stage collected, when the monitored object quantity of different stage reaches corresponding threshold value, send the warning message of releasing memory.
The device preventing internal memory from exhausting of the embodiment of the present application, by the operation of blocking module interception Query Database, for tackling behavior at every turn, processing module judges whether returning results of the query manipulation tackled is default object, if preset object, then obtain the size presetting element in object, and determine the rank of corresponding monitored object according to the size of element in the default object of preassigned and acquisition, add up to make the monitored object of monitor supervision platform to the different stage collected, when the monitored object quantity of different stage reaches corresponding threshold value, send the warning message of releasing memory, to make managerial personnel according to the timely releasing memory of warning message, application server is avoided to occur the situation that internal memory exhausts, and then stability and the robustness of server can be improved.
Embodiment
Be described below in detail the embodiment of the application, the example of described embodiment is shown in the drawings, and wherein same or similar label represents same or similar element or has element that is identical or similar functions from start to finish.Be exemplary below by the embodiment be described with reference to the drawings, be intended to for explaining the application, and the restriction to the application can not be interpreted as.
Below with reference to the accompanying drawings the method preventing internal memory from exhausting and the device of the embodiment of the present application are described.
Fig. 1 is the process flow diagram of the method preventing internal memory from exhausting of the application's embodiment, and as shown in Figure 1, this method preventing internal memory from exhausting comprises:
S101, when monitoring the operation of Query Database, tackles the operation of described Query Database.
In this embodiment, first, create an interception function based on tangent plane programming, wherein, this interception function is mainly used in the query manipulation that interception application server sends to database.Then, the query manipulation that application server sends to database is monitored, when monitoring the query manipulation that application server sends to database, by the operation of interception intercepting api calls Query Database.
S102, for tackling behavior at every turn, judge whether the returning results of query manipulation of tackling is default object, if preset object, then obtain the size presetting element in object, and determine the rank of corresponding monitored object according to the size of element in the default object of preassigned and acquisition, add up to make the monitored object of monitor supervision platform to the different stage collected, when the monitored object quantity of different stage reaches corresponding threshold value, send the warning message of releasing memory.
After obtaining Query Database operation by interception function, can judge whether returning results of tackled query manipulation is default object, wherein, above-mentioned default object can comprise set, and above-mentioned set can be set (collection), list (list) and map (mapping) etc.When above-mentioned query manipulation return results be default object such as gather time, the size of element in default object can be obtained, then the rank of the monitored object corresponding to default object is determined based on preassigned, after the rank determining corresponding monitored object, the monitored object of printable appropriate level.Wherein, above-mentioned monitored object can include but not limited to daily record.
Such as, preset standard is: the size presetting element in object is less than or equal to 1k, and the rank of corresponding daily record is DEBUG rank; The size presetting element in object is greater than 1k, and is less than or equal to 5k, and the rank of corresponding daily record is INFO rank; The size presetting element in object is greater than 5k, and is less than or equal to 1M, and the rank of corresponding daily record is WARN rank; The size presetting element in object is greater than 1M, and the rank of corresponding daily record is ERROR rank.If determine, the size of element in default object is 25k, can determine that the rank of the daily record that this default object is corresponding is WARN rank, the daily record of exportable WARN rank according to preset standard.
In this embodiment, when tackled query manipulation return results be not default object time, can check and return results in corresponding object properties whether comprise default object, if comprise default object, then obtain the size of element in this default object.
Such as, the returning results of query manipulation of tackling when interception function is not set, but during general object, can check in the attribute that object is corresponding and whether comprise set, if comprise set, then obtain the size of element in set, and determine the rank of the daily record of corresponding set according to the size of element in the set of preassigned and acquisition.
In the process of daily record printing appropriate level, monitor supervision platform collects the daily record of different stage, and the daily record of different stage is added up, if the quantity of the daily record of corresponding level exceedes corresponding threshold value, then monitor supervision platform sends the warning message of different stage to related personnel by the mode of mail and/or note.Related personnel, after the warning message receiving monitor supervision platform transmission, can discharge the internal memory in application server in time according to warning message.
Such as, assuming that threshold value corresponding to the daily record arranging INFO rank in monitor supervision platform is 30000, the threshold value that the daily record of WARN rank is corresponding is 10000.If the quantity that monitor supervision platform monitors the daily record of INFO rank has exceeded 30000, or the daily record quantity of WARN rank is more than 10000, now, monitor supervision platform can send warning message by the mode of note or mail to managerial personnel, managerial personnel are after the warning message receiving monitor supervision platform transmission, can releasing memory in time, avoid application server to occur the situation that internal memory exhausts, and then stability and the robustness of application server can be improved.
The method preventing internal memory from exhausting of the embodiment of the present application, the operation of interception Query Database, and for tackling behavior at every turn, judge whether the returning results of query manipulation of tackling is default object, if preset object, then obtain the size presetting element in object, and determine the rank of corresponding monitored object according to the size of element in the default object of preassigned and acquisition, add up to make the monitored object of monitor supervision platform to the different stage collected, when the monitored object quantity of different stage reaches corresponding threshold value, send the warning message of releasing memory, to make managerial personnel according to the timely releasing memory of warning message, application server is avoided to occur the situation that internal memory exhausts, and then stability and the robustness of server can be improved.
In order to realize above-described embodiment, the application also proposes a kind of device preventing internal memory from exhausting.
Fig. 2 is the structural representation of the device preventing internal memory from exhausting of the application's embodiment, and as shown in Figure 2, this device comprises: blocking module 100 and processing module 200, wherein:
Blocking module 100, for when monitoring the operation of Query Database, tackles the operation of Query Database; And processing module 200 is for for tackling behavior at every turn, judge whether the returning results of query manipulation of tackling is default object, if preset object, then obtain the size presetting element in object, and determine the rank of corresponding monitored object according to the size of element in the default object of preassigned and acquisition, add up to make the monitored object of monitor supervision platform to the different stage collected, when the monitored object quantity of different stage reaches corresponding threshold value, send the warning message of releasing memory.
Wherein, above-mentioned default object can comprise set.Above-mentioned set can be set (collection), list (list) and map (mapping) etc., and above-mentioned monitored object can include but not limited to daily record.
Particularly, when processing module 200 determine query manipulation return results be default object such as gather time, the size of element in default object can be obtained, then the rank of the daily record corresponding to default object is determined based on preassigned, and after the rank determining corresponding daily record, print the daily record of appropriate level.
Such as, preset standard is: the size presetting element in object is less than or equal to 1k, and the rank of corresponding daily record is DEBUG rank; The size presetting element in object is greater than 1k, and is less than or equal to 5k, and the rank of corresponding daily record is INFO rank; The size presetting element in object is greater than 5k, and is less than or equal to 1M, and the rank of corresponding daily record is WARN rank; The size presetting element in object is greater than 1M, and the rank of corresponding daily record is ERROR rank.If determine, the size of element in default object is 25k, and according to preset standard, processing module 200 can determine that the rank of the daily record that this default object is corresponding is WARN rank, and print the daily record of WARN rank.
Above-mentioned blocking module 100 is for the operation by interception intercepting api calls Query Database.
In addition, as shown in Figure 3, said apparatus can also comprise creation module 300, and this creation module 300, for before the operation of blocking module by interception intercepting api calls Query Database, creates interception function based on tangent plane programming.
Above-mentioned processing module 200 also for: if returning results of the query manipulation tackled is not default object, then checks and return results in corresponding object properties whether comprise default object, if comprise default object, then obtain the size presetting element in object.
Particularly, when processing module 200 judges that returning results of tackled query manipulation is not default object, can check and return results in corresponding object properties whether comprise default object, if return results in corresponding object properties and comprise default object, then obtain the corresponding size presetting element in object, and determine the rank of corresponding daily record according to the size of element in the default object of preassigned and acquisition, add up to make the daily record of monitor supervision platform to the different stage collected, when the daily record quantity of different stage reaches corresponding threshold value, monitor supervision platform passes through the warning message of mail and/or short message sending different stage.Thus, managerial personnel according to the timely releasing memory of warning message, can be avoided application server to occur the situation that internal memory exhausts, and then can improve stability and the robustness of application server.
The process that the device preventing internal memory from the exhausting control internal memory comprising blocking module 100, processing module 200 and creation module 300 exhausts see Fig. 1, can not repeat herein.
The device preventing internal memory from exhausting of the embodiment of the present application, by the operation of blocking module interception Query Database, for tackling behavior at every turn, processing module judges whether returning results of the query manipulation tackled is default object, if preset object, then obtain the size presetting element in object, and determine the rank of corresponding monitored object according to the size of element in the default object of preassigned and acquisition, add up to make the monitored object of monitor supervision platform to the different stage collected, when the monitored object quantity of different stage reaches corresponding threshold value, send the warning message of releasing memory, to make managerial personnel according to the timely releasing memory of warning message, application server is avoided to occur the situation that internal memory exhausts, and then stability and the robustness of server can be improved.
In the description of this instructions, at least one embodiment that specific features, structure, material or feature that the description of reference term " embodiment ", " some embodiments ", " example ", " concrete example " or " some examples " etc. means to describe in conjunction with this embodiment or example are contained in the application or example.In this manual, to the schematic representation of above-mentioned term not must for be identical embodiment or example.And the specific features of description, structure, material or feature can combine in one or more embodiment in office or example in an appropriate manner.In addition, when not conflicting, the feature of the different embodiment described in this instructions or example and different embodiment or example can carry out combining and combining by those skilled in the art.
In addition, term " first ", " second " only for describing object, and can not be interpreted as instruction or hint relative importance or imply the quantity indicating indicated technical characteristic.Thus, be limited with " first ", the feature of " second " can express or impliedly comprise at least one this feature.In the description of the application, the implication of " multiple " is at least two, such as two, three etc., unless otherwise expressly limited specifically.
Describe and can be understood in process flow diagram or in this any process otherwise described or method, represent and comprise one or more for realizing the module of the code of the executable instruction of the step of specific logical function or process, fragment or part, and the scope of the preferred implementation of the application comprises other realization, wherein can not according to order that is shown or that discuss, comprise according to involved function by the mode while of basic or by contrary order, carry out n-back test, this should understand by the embodiment person of ordinary skill in the field of the application.
In flow charts represent or in this logic otherwise described and/or step, such as, the sequencing list of the executable instruction for realizing logic function can be considered to, may be embodied in any computer-readable medium, for instruction execution system, device or equipment (as computer based system, comprise the system of processor or other can from instruction execution system, device or equipment instruction fetch and perform the system of instruction) use, or to use in conjunction with these instruction execution systems, device or equipment.With regard to this instructions, " computer-readable medium " can be anyly can to comprise, store, communicate, propagate or transmission procedure for instruction execution system, device or equipment or the device that uses in conjunction with these instruction execution systems, device or equipment.The example more specifically (non-exhaustive list) of computer-readable medium comprises following: the electrical connection section (electronic installation) with one or more wiring, portable computer diskette box (magnetic device), random access memory (RAM), ROM (read-only memory) (ROM), erasablely edit ROM (read-only memory) (EPROM or flash memory), fiber device, and portable optic disk ROM (read-only memory) (CDROM).In addition, computer-readable medium can be even paper or other suitable media that can print described program thereon, because can such as by carrying out optical scanning to paper or other media, then carry out editing, decipher or carry out process with other suitable methods if desired and electronically obtain described program, be then stored in computer memory.
Should be appreciated that each several part of the application can realize with hardware, software, firmware or their combination.In the above-described embodiment, multiple step or method can with to store in memory and the software performed by suitable instruction execution system or firmware realize.Such as, if realized with hardware, the same in another embodiment, can realize by any one in following technology well known in the art or their combination: the discrete logic with the logic gates for realizing logic function to data-signal, there is the special IC of suitable combinational logic gate circuit, programmable gate array (PGA), field programmable gate array (FPGA) etc.
Those skilled in the art are appreciated that realizing all or part of step that above-described embodiment method carries is that the hardware that can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, this program perform time, step comprising embodiment of the method one or a combination set of.
In addition, each functional unit in each embodiment of the application can be integrated in a processing module, also can be that the independent physics of unit exists, also can be integrated in a module by two or more unit.Above-mentioned integrated module both can adopt the form of hardware to realize, and the form of software function module also can be adopted to realize.If described integrated module using the form of software function module realize and as independently production marketing or use time, also can be stored in a computer read/write memory medium.
The above-mentioned storage medium mentioned can be ROM (read-only memory), disk or CD etc.Although illustrate and described the embodiment of the application above, be understandable that, above-described embodiment is exemplary, can not be interpreted as the restriction to the application, and those of ordinary skill in the art can change above-described embodiment, revises, replace and modification in the scope of the application.