CN107562782A - A kind of multi-level buffer method, apparatus and system based on CIM - Google Patents
A kind of multi-level buffer method, apparatus and system based on CIM Download PDFInfo
- Publication number
- CN107562782A CN107562782A CN201710606890.4A CN201710606890A CN107562782A CN 107562782 A CN107562782 A CN 107562782A CN 201710606890 A CN201710606890 A CN 201710606890A CN 107562782 A CN107562782 A CN 107562782A
- Authority
- CN
- China
- Prior art keywords
- cim
- pond
- objects
- soft
- expired
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 230000015654 memory Effects 0.000 claims abstract description 106
- 238000007689 inspection Methods 0.000 claims abstract description 19
- 230000003139 buffering effect Effects 0.000 claims description 15
- 238000004458 analytical method Methods 0.000 description 17
- 241001269238 Data Species 0.000 description 6
- 230000003993 interaction Effects 0.000 description 5
- 230000008901 benefit Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 230000002159 abnormal effect Effects 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000007405 data analysis Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000003111 delayed effect Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000004807 localization Effects 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 238000003672 processing method Methods 0.000 description 2
- 238000011084 recovery Methods 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000013479 data entry Methods 0.000 description 1
- 230000001934 delay Effects 0.000 description 1
- 235000013399 edible fruits Nutrition 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000011017 operating method Methods 0.000 description 1
- 238000007430 reference method Methods 0.000 description 1
- 238000013268 sustained release Methods 0.000 description 1
- 239000012730 sustained-release form Substances 0.000 description 1
- 238000010937 topological data analysis Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Abstract
The present invention discloses a kind of multi-level buffer method, apparatus and system based on CIM, and its method includes:The two-staged step cache pool formed by soft reference pond and weak reference pond is established, to cache the CIM objects cited in reference pond, wherein CIM objects include the markers of record CIM object current accessed times;Establish the expired inspection thread of dynamic CIM objects;According to the utilization rate of maximum configured internal memory, CIM objects are expired to check that thread cycle arranges two-staged step cache pool, discharges the expired CIM objects checked.The present invention maximally utilizes free memory increase CIM target cache amounts, and ensure that the unlatching of caching does not influence system normal operation by the daemon thread to two-staged step CIM object class cache pool setting lower level.
Description
Technical field
The present invention relates to technical field of data transmission, more particularly to a kind of multi-level buffer method, apparatus based on CIM
And system.
Background technology
The common information model (CIM) that the series standards of IEC 61970 propose is widely used in power system.Adopt
Develop the topological analysis of fairly large electric network model with Java, the client application such as the quality of data integrally checks when, it is necessary to be based on
Incidence relation between the level inclusion relation and object of object carries out the traversal processing of more rounds, that is, needs for object point
Netted, tree-shaped relation (each object forms the node one by one in data structure) between class set and object, as needed
Complete the analysis of breadth-first or depth-first.During analysis, in the specific stage, some object datas can be visited repeatedly
Ask, when handling afterwards other object, these objects will not may be accessed the long period.Requirements for access is with analysis
Stress to change and therewith change.
Accessed to complete above-mentioned CIM object datas, existing technical scheme mainly there are two kinds, and one kind is that client needs every time
When accessing CIM object datas, do not cached in itself from server lookup, client by interface directly.Another kind is client
Complete or collected works are established at end to the data needed to use every time, that is, cache whole power network CIM objects, and the reference established between object.The
A kind of scheme is frequent with server interaction, causes a large amount of net interactions, on the one hand aggravates server burden, on the other hand right
Image data obtains less efficient;Second scheme causes almost all object to be all based on pair due to the network relation of CIM objects
As " (StrongReference, when the reference of object is held, collecting garbage can not discharge pair being cited for strongly reference
As) " association, the collecting garbage of Java Virtual Machine can not discharge the object that part is of little use, it is therefore desirable to very big interior of configuration
Resource is deposited, otherwise easily triggers low memory (OutOfMemory) abnormal.
The content of the invention
The main object of the present invention is to propose a kind of multi-level buffer method based on CIM, it is intended to which release is by soft reference
The collecting garbage that pond and weak reference pond form the CIM target caches pond of two-staged step can not discharge the CIM objects that are cited
Problem.
To achieve the above object, the destination object proposed by the present invention based on CIM goes to the multi-level buffer side of strongly reference
Method, comprise the following steps:
S10 establishes the two-staged step cache pool formed by soft reference pond and weak reference pond, and Chi Suoyin is quoted to cache
CIM objects, wherein CIM objects include the markers of record CIM object current accessed times;
S20 establishes the expired inspection thread of dynamic CIM objects;
For S30 according to the utilization rate of maximum configured internal memory, CIM objects are expired to check that thread cycle arranges two-staged step and delayed
Pond is deposited, discharges the expired CIM objects checked.
Preferably, the step of S30 includes:
If the utilization rate of S301 maximum configured internal memories is more than first threshold, current time and each bar in soft reference pond are calculated
The difference of the markers for the CIM objects that mesh points to, obtain the soft time difference for quoting the CIM objects that each entry is pointed in pond;
S302 establishes the dynamic formula of expiration period duration, it is softer quote each entry is pointed in pond CIM objects when
Difference and expiration period duration, obtain CIM object of the time difference more than expiration period duration;
S303 arranges time difference and is more than the CIM objects of expiration period duration to weak reference pond.
Preferably, the dynamic formula of the expiration period duration is:
Wherein, u is memory usage when being arranged, TiProcess spent time, S are arranged for the last soft reference pondi
For since the last time soft time interval quoted buffering area housekeeping operation terminates to this soft reference buffering area housekeeping operation, texp
For expiration period duration.
Preferably, the step of S30 also includes:
If the utilization rate of S304 maximum configured internal memories is more than Second Threshold, the CIM cited in current weak reference pond is discharged
Object.
Preferably, the Second Threshold is more than first threshold.
The present invention also proposes a kind of multi-level buffer device based on CIM, including:
First establishes module 10, for establishing the two-staged step cache pool formed by soft reference pond and weak reference pond, uses
CIM objects cited in pond are quoted with caching, wherein CIM objects include the markers of record CIM object current accessed times;
Second establishes module 20, for establishing the expired inspection thread of dynamic CIM objects;
Expired inspection module 30, for the utilization rate according to maximum configured internal memory, CIM objects are expired to check thread cycle
Two-staged step cache pool is arranged, discharges the expired CIM objects checked.
Preferably, the expired inspection module 30 includes:
First acquisition unit 301, if the utilization rate for maximum configured internal memory is more than first threshold, calculate current time
And the soft difference for quoting the markers for the CIM objects that each entry is pointed in pond, obtain the CIM objects that each entry is pointed in soft reference pond
The time difference;
Second acquisition unit 302, for establishing the dynamic formula of expiration period duration, each entry refers in softer reference pond
To CIM objects the time difference and expiration period duration, obtain the time difference be more than expiration period duration CIM objects;
Finishing unit 303, for arranging CIM object of the time difference more than expiration period duration to weak reference pond.
Preferably, the expired inspection module 30 also includes releasing unit 304, if the utilization rate for maximum configured internal memory
During more than Second Threshold, the CIM objects cited in current weak reference pond are discharged.
The present invention also proposes a kind of multilevel cache system based on CIM, including server, in addition to base described above
The multi-level buffer device of strongly reference is removed in the destination object of CIM, for realizing the target pair based on CIM described above
Multi-level buffer method as going strongly reference.
The technical program discloses a kind of destination object queried access method, apparatus based on CIM and system and one
Kind CIM electric network model object datas go the multi-level buffer method, apparatus and system of strongly reference, and above two method is combined, and is solved
A kind of CIM objects of having determined go the problem of dynamic buffering data transfer and processing of strongly reference, the technical program and prior art phase
Than beneficial effects of the present invention are embodied in:
The present invention is used in the application software such as power network CIM data analysis, especially suitable for needing to carry out the vertical of model
To the situation of the analysis of level traversal and the traversal analysis of horizontal power network topology.For large-scale power network, because memory source is limited
Or data volume is huge, generally whole electric network model can not all be put into internal memory, in this case, CIM objects of the invention
Going the dynamic buffering processing method of strongly reference just has obvious advantage.It is mainly reflected in:
1) access efficiency and memory usage are balanced.After internal memory dosage exceedes particular bound (70%), made according to internal memory
Expiration period is set dynamically with rate, internal memory is effectively maintained to a rational level.Shorten when memory usage is high
Expiration period, internal memory can be rapidly vacateed from CIM target caches, and empty weak reference buffer pool, increase can as far as possible
Use internal memory;And do not discharge cache object when memory usage is low, increase buffer data size, improve the hit rate of object retrieval,
Reduce server lookup.
2) flexible adaptation is the memory amount of application configuration.If the memory amount of application is allocated to relative to being analyzed
Grid model data, its capacity is enough, is just not required to discharge the soft data object for quoting management, need not also repeat to look into server
Ask;If grid model data amount to be analyzed is big, internal memory can not be entirely enclosed in, then program still can normal operation, pass through two
The rotation of individual buffering area improves object data retrieving efficiency.
3) effectively prevent internal memory from overflowing.Using it is soft reference and weak reference mechanism, under extreme internal memory limited case,
Will not internal memory overflow because soft reference and the resource held of weak reference can all be reclaimed by JVM garbage collectors.
4) using simple.The application end of target cache only needs to access object data on demand, it is not necessary to consider data how from
Server loads, it is not required that actively goes to discharge.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this
Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with
Structure according to these accompanying drawings obtains other accompanying drawings.
Fig. 1 is a kind of method flow diagram of an embodiment of the multi-level buffer method based on CIM of the present invention;
Fig. 2 is the S30 of present invention method flow diagram;
Fig. 3 is the method flow diagram of the S30 of the present invention another embodiment;
Fig. 4 is a kind of functional block diagram of an embodiment of the multi-level buffer device based on CIM of the present invention;
Fig. 5 is the expired functional module refinement figure for checking module of the present invention;
Fig. 6 is the functional module refinement figure of the expired another embodiment for checking module of the present invention.
The realization, functional characteristics and advantage of the object of the invention will be described further referring to the drawings in conjunction with the embodiments.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only the part of the embodiment of the present invention, rather than whole embodiments.Base
Embodiment in the present invention, those of ordinary skill in the art obtained under the premise of creative work is not made it is all its
His embodiment, belongs to the scope of protection of the invention.
If it is to be appreciated that related in the embodiment of the present invention directionality instruction (such as up, down, left, right, before and after ...),
Then directionality instruction is only used for explaining that the relative position under a certain particular pose (as shown in drawings) between each part is closed
System, motion conditions etc., if the particular pose changes, directionality instruction also correspondingly changes therewith.
If in addition, relating to the description of " first ", " second " etc. in the embodiment of the present invention, " first ", " second " etc. are somebody's turn to do
Description be only used for describing purpose, and it is not intended that instruction or implying its relative importance or implicit indicating indicated skill
The quantity of art feature.Thus, " first " is defined, the feature of " second " can be expressed or implicitly includes at least one spy
Sign.In addition, the technical scheme between each embodiment can be combined with each other, but must be with those of ordinary skill in the art's energy
Based on enough realizations, the knot of this technical scheme is will be understood that when the combination appearance of technical scheme is conflicting or can not realize
Conjunction is not present, also not within the protection domain of application claims.
As shown in figures 1 to 6, the present invention proposes a kind of multi-level buffer method based on CIM, comprises the following steps:
S10 establishes the two-staged step cache pool formed by soft reference pond and weak reference pond, and Chi Suoyin is quoted to cache
CIM objects, wherein CIM objects include the markers of record CIM object current accessed times;
S20 establishes the expired inspection thread of dynamic CIM objects;
For S30 according to the utilization rate of maximum configured internal memory, CIM objects are expired to check that thread cycle arranges two-staged step and delayed
Pond is deposited, discharges the expired CIM objects checked.
In the present embodiment, on the basis of the present invention is in the queried access method of the destination object based on CIM, enter one
Solution is walked, the queried access method of the destination object based on CIM is:It is corresponding based on CIM generation CIM classes
JAVA classes, these JAVA classes need directly or indirectly (passing through parent) be inherited from a specific class, i.e. CIM objects
(CIMObject), CIM objects are included with properties:The unique identification of Id, CIM object, and timestamp markers, for remembering
Record the CIM object current accessed times, destination object Access Management Access class structure CIM target caches pond, one is built with HashMap
Main reference pond is soft reference pond, and an auxiliary pond of quoting is weak reference pond, and a two level rank is formed by soft reference pond and weak reference pond
Ladder type CIM target caches pond, the key of the entry in two reference ponds is CIMObject ID, the soft value for quoting entry in pond
For SoftReference<CIMObject>, the value of entry is WeakReference in weak reference pond<CIMObject>(i.e.,
Data Entry is ID and SoftReference in weak reference pond<CIMObject>Data are to (pair);Data strip in weak reference pond
Mesh is ID and WeakReference<CIMObject>Data to);Object accesses manage class, based on by soft reference pond and weak reference
The two-staged step CIM target caches pond that pond is formed, the queried access request of destination object is received, from received inquiry
Destination object ID is obtained in access request;Using acquired destination object ID, drawn with two-staged step CIM target caches pond
The ID of CIM objects matches, i.e., the refined value with the soft entry for drawing pond and/or the key of the entry in weak reference pond matches, if
The match is successful, then obtains the soft reference of CIM objects corresponding to the id, then with the get methods of soft reference, obtains " strong " of object
Quote, obtain the success of CIM objects, then access inquired CIM objects, and the markers of the CIM objects records current accessed
Time, now, illustrated exemplified by quoting this CIM object held storage well, in the local IP access CIM objects;It is if above-mentioned
Inquiry is not into illustrating that the destination object is not stored in the CIM target caches pond, turn to server and carry out queried access;If mesh
Mark object ID and inquired about in CIM target caches pond and failed, turn to server and perform inquiry, if being looked into by destination object ID in server
Ask successfully, generation has the CIM objects in identical ID soft reference pond with destination object, with the refined value CIM of the ID of the CIM objects
The entry in the soft reference pond of object, accesses inquired CIM objects, and the markers record current accessed of the CIM objects when
Between;If failing by destination object ID in server lookup, the queried access request failure of destination object is returned;In the above method
Described the step of accessing inquired CIM objects, includes:Judge inquired CIM objects whether with destination object phase
Match somebody with somebody;If matching, inquired CIM objects, and the time of the markers record current accessed of the CIM objects are accessed;If not phase
Matching, then return to the queried access request failure of destination object.
The queried access method of the destination object based on CIM with soft adduction relationship substitute CIM objects between it is strong
Adduction relationship, solves " the strongly reference for due to the network relation of CIM objects, causing almost all object to be all based between object
(StrongReference, when the reference of object is held, collecting garbage can not discharge the object being cited) " associates, and Java is empty
The collecting garbage of plan machine can not discharge the object that part is of little use, it is therefore desirable to the very big memory source of configuration, otherwise easily
The problem of triggering low memory (OutOfMemory) abnormal;Secondly, establish that (SoftReference, object draw in pond by soft reference
During with being held, if collecting garbage judges low memory, the object being cited can be discharged) and weak reference pond
(WeakReference, as long as collecting garbage finds weak reference, you can discharge the object of its reference), the two-staged step of formation
CIM target caches pond, for application repeatedly access CIM objects provides quickly localization retrieve.
The present invention further, after the utilization rate of maximum configured internal memory reaches certain limit, then enables " object is expired "
Check, by accessed object does not move to weak reference pond by soft reference pond in the expiration period duration of dynamic calculation.By soft reference
Pond and weak reference pond form the caching level of different reference intensity, so that Java virtual machines reclaim internal memory by level as needed,
Reach dynamic control of data buffer memory, reduce the actual memory expense of larger electric network model so as to effectively avoid the effect that internal memory overflows
Fruit, while reduce and server interaction amount, lifting Object Query efficiency.Main thread and daemon thread, a process is belonged to, this
Individual process fetches CIM object datas and does analysis application, and this two-staged step CIM target caches pond is in this application software for XRF analysis
The cache hierarchy put, when described maximum configured internal memory refers to actual JAVA programs operation, the analysis is allocated to using soft
The maximum free memory of part operation, server mentioned herein refer to that application software for XRF analysis obtains the source of CIM object datas, this
System described in text refers to any server for being provided with this application software for XRF analysis and the network that any terminal is formed
System.The present invention solves the use problem of the internal memory of software itself configuration similar to the application software for XRF analysis class, passes through two
Level staged cache pool is reduced and interacting between other software and server;Further through the object mistake of two-staged step cache pool
Phase checks the foundation and execution of thread, clears up the maximum memory space of software itself configuration in time.
System in the technical program needs a large amount of CIM objects of Reusability to carry out power network global analysis, calculate, system
Originally need to be analyzed after repeatedly obtaining data from server, handled now by increasing two-staged step CIM target caches
To reduce server interaction frequency, lifting object data access efficiency.
Further, the daemon thread of the invention by setting lower priority to two-staged step CIM target caches pond,
That is the expired inspection thread of CIM objects, periodically clears up cache object, it is ensured that most on one's own initiative with lower priority daemon thread
Bigization ensures that the unlatching of caching does not influence the internal memory of system normal operation using free memory increase CIM target cache amounts
Available quantity.It should be noted that daemon thread mentioned here refers to open CIM to two-staged step CIM object class cache pool
The expired inspection thread of object;The lower priority of daemon thread is also the inquiry relative to the destination object based on CIM
Access the lower priority for thread.Meanwhile and because the cache pool of the CIM objects using two-staged step, even in pole
Under end memory limited case, also will not internal memory overflow because soft reference and the resource held of weak reference are all can be by JAVA classes
Garbage collector recovery.
The present invention is used in the application software such as power network CIM data analysis, especially suitable for needing to carry out the vertical of model
To the situation of the analysis of level traversal and the traversal analysis of horizontal power network topology.For large-scale power network, because memory source is limited
Or data volume is huge, generally whole electric network model can not all be put into internal memory, in this case, CIM objects of the invention
Going the dynamic buffering processing method of strongly reference just has obvious advantage.
Further, the step of S30 includes:
If the utilization rate of S301 maximum configured internal memories is more than first threshold, current time and each bar in soft reference pond are calculated
The difference of the markers for the CIM objects that mesh points to, obtain the soft time difference for quoting the CIM objects that each entry is pointed in pond;
S302 establishes the dynamic formula of expiration period duration, it is softer quote each entry is pointed in pond CIM objects when
Difference and expiration period duration, obtain CIM object of the time difference more than expiration period duration;
S303 arranges time difference and is more than the CIM objects of expiration period duration to weak reference pond.
Further, the dynamic formula of the expiration period duration is:
Wherein, u is memory usage when being arranged, TiProcess spent time, S are arranged for the last soft reference pondi
For since the last time soft time interval quoted buffering area housekeeping operation terminates to this soft reference buffering area housekeeping operation, texp
For expiration period duration.
In the present embodiment, the first threshold is one and actively arranges the soft critical value for quoting pond cache object, the mistake
An a length of dynamic formula related to memory usage, expiration period is set dynamically according to first threshold during time limit phase, will
Internal memory effectively maintains a rational level.Shorten expiration period when memory usage is high, can be rapidly from CIM pairs
As obtaining memory space in caching;And do not discharge cache object when memory usage is low, increase buffer data size, can improve
The hit rate of object retrieval, reduce the interactive query with server.Due to the setting of first threshold, flexible adaptation is used as application to match somebody with somebody
The memory amount put, if being allocated to the memory amount of application relative to the grid model data to be analyzed, its capacity is enough, just
It is not required to discharge the soft data object for quoting management, need not also repeats to inquire about to server;If grid model data to be analyzed
Amount is big, can not be entirely enclosed in internal memory, then program still can normal operation, the rotation for passing through two buffering areas improves object data and examines
Rope efficiency.
Further, the step of S30 also includes:
If the utilization rate of S304 maximum configured internal memories is more than Second Threshold, the CIM cited in current weak reference pond is discharged
Object.
Further, the Second Threshold is more than first threshold.
In the present embodiment, the Second Threshold is a critical value for actively arranging weak reference pond cache object, if internal memory
When utilization rate is more than Second Threshold, system release weak reference pond, memory headroom is obtained.The Second Threshold is more than first threshold,
It follows that arranging soft reference pond cache object in advance, just there are a S40 steps, the arrangement to weak reference pond is now weak to draw
With the cache object included by pond:Cache object and soft reference pond cited in the script of weak reference pond arrange and are moved to weak reference pond
Expired cache object.
The present invention also proposes a kind of multi-level buffer device based on CIM, is somebody's turn to do the destination object based on CIM and goes by force
The multi-level buffer device of reference to realize that the above-mentioned destination object based on CIM goes the multi-level buffer method of strongly reference, by
The multi-level buffer device of strongly reference is gone to employ whole technologies of above-mentioned all embodiments in the destination object based on CIM
Scheme, therefore all beneficial effects at least caused by the technical scheme with above-described embodiment, this is no longer going to repeat them.Its
In, the multi-level buffer device of strongly reference is removed based on the destination object of CIM, including:
First establishes module 10, for establishing the two-staged step cache pool formed by soft reference pond and weak reference pond, uses
CIM objects cited in pond are quoted with caching, wherein CIM objects include the markers of record CIM object current accessed times;
Second establishes module 20, for establishing the expired inspection thread of dynamic CIM objects;
Expired inspection module 30, for the utilization rate according to maximum configured internal memory, CIM objects are expired to check thread cycle
Two-staged step cache pool is arranged, discharges the expired CIM objects checked.
Further, the expired inspection module 30 includes:
First acquisition unit 301, if the utilization rate for maximum configured internal memory is more than first threshold, calculate current time
And the soft difference for quoting the markers for the CIM objects that each entry is pointed in pond, obtain the CIM objects that each entry is pointed in soft reference pond
The time difference;
Second acquisition unit 302, for establishing the dynamic formula of expiration period duration, each entry refers in softer reference pond
To CIM objects the time difference and expiration period duration, obtain the time difference be more than expiration period duration CIM objects;
Finishing unit 303, for arranging CIM object of the time difference more than expiration period duration to weak reference pond.
Further, the expired inspection module 30 also includes releasing unit 304, if the use for maximum configured internal memory
When rate is more than Second Threshold, the CIM objects cited in current weak reference pond are discharged.
The invention also discloses a kind of multilevel cache system based on CIM, including server, in addition to as right will
The destination object based on CIM described in 6-8 is asked to remove the multi-level buffer device of strongly reference, for realizing such as claim 1-5
The described destination object based on CIM goes the multi-level buffer method of strongly reference.
In the technical program, the present invention proposes a kind of multi-level buffer method based on CIM, first, is drawn with soft
The strongly reference relation between CIM objects is substituted with relation, solves due to the network relation of CIM objects, causes almost all object
Be all based between object " (StrongReference, when the reference of object is held, collecting garbage can not discharge quilt for strongly reference
The object of reference) " associate, the collecting garbage of Java Virtual Machine can not discharge the object that part is of little use, it is therefore desirable to configure non-
Often big memory source, the problem of otherwise easily triggering low memory (OutOfMemory) abnormal;Secondly, establish by soft reference
Pond (SoftReference, when object reference is held, if collecting garbage judges low memory, can discharge what is be cited
Object) and weak reference pond (WeakReference, as long as collecting garbage finds weak reference, you can discharge the object of its reference;But
Because collecting garbage thread running priority level is low, if the processing thread of high priority is being run, the object meeting of weak reference sensing
Sustained release) formed two-staged step CIM object class cache pool, for application repeatedly access CIM objects provide quickly
Localization retrieval.After memory usage reaches certain limit, then " object is expired " inspection is enabled, by the expired phase of dynamic calculation
Accessed object does not move to weak reference pond by soft reference pond in limit.Different references are formed by soft reference pond and weak reference pond
The caching level of intensity, so that Java Virtual Machine is as needed by level recovery internal memory, reach dynamic control of data buffer memory, drop
The actual memory expense of low larger electric network model reduces and server interaction so as to effectively avoid the effect that internal memory overflows
Amount, lifting Object Query efficiency.
The present inventive concept of the technical program:The finger daemon of a lower priority is opened, periodically analysis and arrangement
Data in soft reference pond, moved with the pre-established threshold of memory usage (program is with the ratio of internal memory and program free memory)
State sets expiration period, and outdated object is moved into weak reference pond.By taking memory usage 70% as an example (70% is empirical value), make
The soft pre-established threshold quoted pond and actively arrange cache object is performed for finger daemon;(85% is by taking memory usage 85% as an example
Empirical value), perform the pre-established threshold that weak reference pond actively arranges cache object as finger daemon.
The outdoor scene operating procedure of the technical program is as follows:
(1) cache pool that two-staged step CIM objects are built with soft reference and weak reference stores CIM objects, the wherein CIM
Object includes the ID and the markers of record CIM object current accessed times of unique mark CIM objects, and delays based on soft reference pond
Deposit, weak reference caches supplemented by pond.
(2) finger daemon of lower priority is created, is traveled through for periodicity and analyzes soft reference pond, with the occupancy of internal memory
Predetermined threshold expiration period is set dynamically, and outdated object is moved into weak reference pond.
(3) periodically traveled through by the daemon thread of lower priority and analyze soft reference pond, come according to the use level of internal memory
Expiration period is set dynamically, and outdated object is moved into weak reference pond.
(4) judge whether the CIM objects pointed by current quote are expired, outdated conditions:With the use of maximum configured internal memory
Whether rate has reached 70%, if greater than 70%, judges again, whether memory usage is more than 85%, if internal memory uses
Rate is more than 85%, then discharges weak with data cached cited in pond, and 85% is less than or equal to if greater than 70%, then is carried out soft
The arrangement in pond is quoted, if memory usage is less than 70%, is arranged without soft reference pond.
(5) dynamic expiration period duration used in this housekeeping operation is calculated, inquires about two-staged step cache pool step by step
In CIM objects, and obtain the last access time of inquired CIM objects (during last access time, i.e. current accessed
Between, it is possible to understand that ground is current CIM objects institute usage time), judge whether the CIM objects pointed by current quote are expired, mistake
Phase condition is set up, and object is moved into the management of weak reference pond, according to the relational expression of the dynamic expiration period of memory usage:
(i=1,2,3 ..., T1=0, S1=10)
Wherein, u is memory usage when being arranged;Ti arranges process spent time for the last soft reference pond;
siFor since the last time soft time interval quoted buffering area housekeeping operation terminates to this soft reference buffering area housekeeping operation.It is interior
Deposit consumption first be more than 70% and perform it is soft reference pond arrange when, texpFor the dynamic expiration period of memory usage, it is with 10
Example, that is, unused object can move to weak reference pond from soft reference pond in 10 seconds,
(6) if retrieving accessed CIM objects in weak reference pond, then this CIM object will be upgraded to soft
Pond is quoted to hold, and the access time that timestamp markers record CIM objects are current in soft reference pond.
The technical program discloses a kind of destination object queried access method and device based on CIM and a kind of CIM
Electric network model object data goes the multi-level buffer method and device of strongly reference, and above two method is combined, and solves a kind of CIM
Object goes the problem of dynamic buffering data transfer and processing of strongly reference, and the technical program is compared with the prior art, of the invention
Have the beneficial effect that:
The present invention is used in the application software such as power network CIM data analysis, especially suitable for needing to carry out the vertical of model
To the situation of the analysis of level traversal and the traversal analysis of horizontal power network topology.For large-scale power network, because memory source is limited
Or data volume is huge, generally whole electric network model can not all be put into internal memory, in this case, the technical program just has bright
Aobvious advantage.It is mainly reflected in:
1) access efficiency and memory usage are balanced, after internal memory dosage exceedes particular bound (70%), is made according to internal memory
Expiration period is set dynamically with rate, internal memory is effectively maintained to a rational level.Shorten when memory usage is high
Expiration period, internal memory can be rapidly vacateed from CIM target caches, and empty weak reference buffer pool, increase can as far as possible
Use internal memory;And do not discharge cache object when memory usage is low, increase buffer data size, improve the hit rate of object retrieval,
Reduce server lookup.
2) flexible adaptation is the memory amount of application configuration, if being allocated to the memory amount of application relative to being analyzed
Grid model data, its capacity is enough, is just not required to discharge the soft data object for quoting management, need not also repeat to look into server
Ask;If grid model data amount to be analyzed is big, internal memory can not be entirely enclosed in, then program still can normal operation, pass through two
The rotation release of individual buffering area, improves object data retrieving efficiency.
3) effectively prevent internal memory from overflowing.Using it is soft reference and weak reference mechanism, under extreme internal memory limited case,
Will not internal memory overflow because soft reference and the resource held of weak reference can all be reclaimed by JVM garbage collectors.
4) using simple.The application end of target cache only needs to access object data on demand, it is not necessary to consider data how from
Server loads, it is not required that actively goes to discharge.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the scope of the invention, it is every at this
Under the inventive concept of invention, the equivalent structure transformation made using description of the invention and accompanying drawing content, or directly/use indirectly
It is included in other related technical areas in the scope of patent protection of the present invention.
Claims (9)
- A kind of 1. multi-level buffer method based on CIM, it is characterised in that comprise the following steps:S10 establishes the two-staged step cache pool formed by soft reference pond and weak reference pond, is quoted to cache cited in pond CIM objects, wherein CIM objects include the markers of record CIM object current accessed times;S20 establishes the expired inspection thread of dynamic CIM objects;For S30 according to the utilization rate of maximum configured internal memory, CIM objects are expired to check that thread cycle arranges two-staged step caching Pond, discharge the expired CIM objects checked.
- 2. the destination object based on CIM goes the multi-level buffer method of strongly reference as claimed in claim 1, its feature exists Include in the step of, S30:If the utilization rate of S301 maximum configured internal memories is more than first threshold, calculates current time and refer to each entry in soft reference pond To CIM objects markers difference, obtain the soft time difference for quoting the CIM objects that each entry is pointed in pond;S302 establishes the dynamic formula of expiration period duration, it is softer quote in pond the time difference for the CIM objects that each entry is pointed to and Expiration period duration, obtain CIM object of the time difference more than expiration period duration;S303 arranges time difference and is more than the CIM objects of expiration period duration to weak reference pond.
- 3. the destination object based on CIM goes the multi-level buffer method of strongly reference as claimed in claim 2, its feature exists In the dynamic formula of the expiration period duration is:(i=1,2,3 ..., T1=0, S1=10)Wherein, u is memory usage when being arranged, TiProcess spent time, S are arranged for the last soft reference pondiFor from The last time soft time interval quoted buffering area housekeeping operation and terminate to start to this soft reference buffering area housekeeping operation, texpFor mistake Time limit phase duration.
- 4. the destination object based on CIM as described in claim any one of 1-3 goes the multi-level buffer method of strongly reference, its It is characterised by, also includes the step of the S30:If the utilization rate of S304 maximum configured internal memories is more than Second Threshold, the CIM objects cited in current weak reference pond are discharged.
- 5. the destination object based on CIM goes the multi-level buffer method of strongly reference as claimed in claim 4, its feature exists In the Second Threshold is more than first threshold.
- A kind of 6. multi-level buffer device based on CIM, it is characterised in that including:First establishes module 10, for establishing the two-staged step cache pool formed by soft reference pond and weak reference pond, to slow The CIM objects cited in reference pond are deposited, wherein CIM objects include the markers of record CIM object current accessed times;Second establishes module 20, for establishing the expired inspection thread of dynamic CIM objects;Expired inspection module 30, for the utilization rate according to maximum configured internal memory, CIM objects are expired to check that thread cycle arranges Two-staged step cache pool, discharge the expired CIM objects checked.
- 7. the destination object based on CIM removes the multi-level buffer device of strongly reference as claimed in claim 6, its feature exists In the expired inspection module 30 includes:First acquisition unit 301, if the utilization rate for maximum configured internal memory is more than first threshold, calculate current time with it is soft Quote the difference of the markers for the CIM objects that each entry is pointed in pond, obtain it is soft quote each entry is pointed in pond CIM objects when Difference;Second acquisition unit 302, it is softer to quote what each entry in pond was pointed to for establishing the dynamic formula of expiration period duration The time difference of CIM objects and expiration period duration, obtain CIM object of the time difference more than expiration period duration;Finishing unit 303, for arranging CIM object of the time difference more than expiration period duration to weak reference pond.
- 8. the destination object based on CIM as described in claim any one of 6-7 removes the multi-level buffer device of strongly reference, its It is characterised by, the expired inspection module 30 also includes releasing unit 304, if the utilization rate for maximum configured internal memory is more than the During two threshold values, the CIM objects cited in current weak reference pond are discharged.
- 9. a kind of multilevel cache system based on CIM, including server and terminal, it is characterised in that also include such as right It is required that the destination object based on CIM described in 6-8 removes the multi-level buffer device of strongly reference, for realizing such as claim 1- The destination object based on CIM described in 5 goes the multi-level buffer method of strongly reference.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710606890.4A CN107562782B (en) | 2017-07-24 | 2017-07-24 | CIM (common information model) -based multi-level caching method, device and system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710606890.4A CN107562782B (en) | 2017-07-24 | 2017-07-24 | CIM (common information model) -based multi-level caching method, device and system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN107562782A true CN107562782A (en) | 2018-01-09 |
| CN107562782B CN107562782B (en) | 2020-02-04 |
Family
ID=60974172
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710606890.4A Active CN107562782B (en) | 2017-07-24 | 2017-07-24 | CIM (common information model) -based multi-level caching method, device and system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107562782B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117130792A (en) * | 2023-10-26 | 2023-11-28 | 腾讯科技(深圳)有限公司 | Processing method, device, equipment and storage medium for cache object |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102722432A (en) * | 2011-03-29 | 2012-10-10 | 国际商业机器公司 | Method and apparatus for tracing memory access |
| US20120330895A1 (en) * | 2011-06-24 | 2012-12-27 | International Business Machines Corporation | Transitioning application replication configurations in a networked computing environment |
| US8365164B1 (en) * | 2008-02-21 | 2013-01-29 | T-APP Ltd. | Portable software applications |
| CN105790259A (en) * | 2016-03-15 | 2016-07-20 | 华南理工大学 | CIM based power grid power flow data conversion method |
| CN106657282A (en) * | 2016-11-25 | 2017-05-10 | 许继电气股份有限公司 | Integration method and device for equipment operation state information of convertor station |
-
2017
- 2017-07-24 CN CN201710606890.4A patent/CN107562782B/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8365164B1 (en) * | 2008-02-21 | 2013-01-29 | T-APP Ltd. | Portable software applications |
| CN102722432A (en) * | 2011-03-29 | 2012-10-10 | 国际商业机器公司 | Method and apparatus for tracing memory access |
| US20120330895A1 (en) * | 2011-06-24 | 2012-12-27 | International Business Machines Corporation | Transitioning application replication configurations in a networked computing environment |
| US20130290258A1 (en) * | 2011-06-24 | 2013-10-31 | International Business Machines Corporation | Transitioning application replication configurations in a networked computing environment |
| CN105790259A (en) * | 2016-03-15 | 2016-07-20 | 华南理工大学 | CIM based power grid power flow data conversion method |
| CN106657282A (en) * | 2016-11-25 | 2017-05-10 | 许继电气股份有限公司 | Integration method and device for equipment operation state information of convertor station |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117130792A (en) * | 2023-10-26 | 2023-11-28 | 腾讯科技(深圳)有限公司 | Processing method, device, equipment and storage medium for cache object |
| CN117130792B (en) * | 2023-10-26 | 2024-02-20 | 腾讯科技(深圳)有限公司 | Processing method, device, equipment and storage medium for cache object |
Also Published As
| Publication number | Publication date |
|---|---|
| CN107562782B (en) | 2020-02-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9898206B2 (en) | Memory access processing method, apparatus, and system | |
| DE102020007986A1 (en) | PROACTIVE PRELIMINARY DATA CALL WITH APPLIED QUALITY OF SERVICE | |
| CN102722432B (en) | Follow the trail of the method and apparatus of internal storage access | |
| DE102022124530A1 (en) | STORAGE POOL MANAGEMENT | |
| CN102073683A (en) | Distributed real-time news information acquisition system | |
| US20080270653A1 (en) | Intelligent resource management in multiprocessor computer systems | |
| CN106021468A (en) | Updating method and system for distributed caches and local caches | |
| CN106933715A (en) | A kind of server performance method of testing based on different test scenes | |
| CN110990483A (en) | Data access and control method and system for cache nodes in distributed cache | |
| CN108595543A (en) | Data grab method, device and network crawler system | |
| CN119336513B (en) | Memory pool management method and device, storage medium and electronic device | |
| CN104699529B (en) | A kind of information acquisition method and device | |
| CN101820356A (en) | Network fault diagnosis system based on ARM-Linux | |
| CN118760626A (en) | Adaptive adjustment method, device, electronic device and storage medium of cache mechanism | |
| CN107562782A (en) | A kind of multi-level buffer method, apparatus and system based on CIM | |
| DE202015009257U1 (en) | Administration of an instruction cache | |
| CN107908470B (en) | A kind of queried access method, apparatus and system based on CIM model | |
| CN110865869B (en) | Method and system for extracting memory access characteristics of virtual machine on Shenwei architecture | |
| CN102752374B (en) | System and method for storing and accessing power utilization efficacy data | |
| CN109947672B (en) | MLC STT-RAM cache data management method based on probability distribution | |
| CN102902593A (en) | Protocol distribution processing system based on cache mechanism | |
| CN202906977U (en) | A storage access system of electric energy using efficiency data | |
| Paz et al. | An efficient on-the-fly cycle collection | |
| Maas et al. | Grail quest: A new proposal for hardware-assisted garbage collection | |
| CN109492020A (en) | A kind of data cache method, device, electronic equipment and storage medium |
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 | ||
| TA01 | Transfer of patent application right | ||
| TA01 | Transfer of patent application right |
Effective date of registration: 20191218 Address after: 510080, Guangdong, Guangzhou province Yuexiu District Dongfeng East Road water all Gang No. 8, No. eighteen, building 6 Applicant after: GUANGDONG POWER GRID CO., LTD. INFORMATION CENTER Address before: 510060 building 6, No. 8, No. eighteen, Dongfeng Road, Dongfeng East Road, Guangzhou, Yuexiu District, Guangdong Applicant before: GUANGDONG POWER GRID CO., LTD. INFORMATION CENTER Applicant before: WeiHai CIMSTech Co., Ltd. |
|
| GR01 | Patent grant | ||
| GR01 | Patent grant |