Summary of the invention
Embodiments provide a kind of data-storage system towards many application and data store, call method, can based on different application, carry out independent buffer memory to data to call/store, and hierarchical cache is carried out to the data of access frequency different brackets, thus effectively improve the speed of data call/storage, promote the work efficiency of management information system.
First aspect, embodiments provide a kind of data-storage system towards many application, described system comprises:
Metadatabase, for the metadata of storage system;
Multiple cache module, each cache module is towards an application, and each described cache module at least comprises level cache unit and L2 cache unit; Described cache module is used for, according to rule by stored in or the metadata derived in described metadatabase be stored as data cached in described level cache unit or L2 cache unit;
Data switch engine, for the data requesting instructions according to application, calls the data cached of required metadata from level cache unit or L2 cache unit; Or the data that application produces are sent to the described cache module that described application is corresponding, described data to be stored in described metadatabase with metadata form by described cache module.
Preferably, what described rule comprised metadata calls frequency;
Described level cache unit specifically for, the metadata calling frequency and exceed first threshold is stored temporarily.
Further preferred, described L2 cache unit specifically for, exceed Second Threshold and the metadata not exceeding first threshold stores to calling frequency.
Further preferred, described level cache unit and L2 cache unit also for, the relational data for recording the relation between described application is stored.
Preferably, described data-storage system is isomeric data storage system.
Second aspect, embodiments provides a kind of date storage method of data-storage system, and described method comprises:
The write data of data switch engine self-application in future send to cache module; Said write data are the set of fields through compiling; Each field in described set of fields has field attribute, and described field attribute comprises the apply property information that described field carrys out self-application;
Described set of fields is carried out field fractionation, is stored as data cached in the level cache unit or L2 cache unit of cache module according to rule;
By in described data cached importing metadatabase, be stored as metadata.
Preferably, described metadatabase comprises metadata dictionary; Described by described data cached importing metadatabase, be stored as metadata, be stored as metadata and specifically comprise:
Determine whether each field after the described data cached fractionation comprised meets the regulation of metadata dictionary;
When the field after described fractionation meets the regulation of metadata dictionary, the described field conformed with the regulations is imported in metadatabase, is stored as metadata;
When the field after described fractionation does not meet the regulation of metadata dictionary, according to the mapping relations preset, to meeting of field against regulation process, and the field after meeting being processed imports in metadatabase, is stored as metadata
The third aspect, embodiments provides a kind of data calling method of data-storage system, and described method comprises:
Data switch engine, according to the data requesting instructions of application, sends metadata call request to the cache module corresponding with described application;
Described cache module is according to described metadata call request, and in the level cache unit of described cache module, the required metadata of inquiry is data cached;
When there is required metadata data cached in described level cache unit, described required the data cached of metadata is returned to described application by described data switch engine;
When there is no required metadata data cached in described level cache unit, in the L2 cache unit of described cache module, the required metadata of inquiry is data cached, and the data cached of metadata needed for storing in described L2 cache unit is returned to described application by data switch engine.
Preferably, when not having required metadata data cached in described L2 cache unit, described method also comprises:
Described L2 cache unit, according to described data call request, obtains required metadata, is stored as data cached from metadatabase;
Data cachedly described application is returned to by data switch engine by described.
Preferably, described method also comprises:
Described cache module is according to described metadata data call request, the metadata cache of first threshold is exceeded in the first buffer unit by calling frequency, further, by call frequency exceed Second Threshold and the metadata cache not exceeding first threshold in the second buffer unit.
The data-storage system that the present invention proposes, for data in metadatabase call/store adopt multi-level buffer mechanism, supported the cache module of multi-level buffer mechanism towards each application by framework, hierarchical cache is carried out to the data of access frequency different brackets, make the most accessed data can with prestissimo be employed obtain, more frequently and not too frequently accessed data can with fast speed be employed obtain.Adopt the system architecture called/store of based on different application data to be carried out under independent buffer memory simultaneously, make, when carrying out expansion to systemic-function and increasing number of applications, also can not have influence on the request of data speed of each application.Data-storage system of the present invention, effectively can improve the speed of data call/storage, promotes the work efficiency of management information system.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, the specific embodiment of the invention is described in further detail.
The system architecture of the data-storage system towards many application that the embodiment of the present invention provides is described below in detail, the data-storage system schematic diagram that Fig. 1 provides for the embodiment of the present invention for Fig. 1.
As shown in Figure 1, the data-storage system of the present embodiment comprises: metadatabase 10, multiple cache module (being described for cache module 20-1, cache module 20-2, cache module 20-3 in the present embodiment), and data switch engine 30.
Metadatabase 10 is for the metadata of storage system;
Cache module, each cache module is towards an application (as application-oriented in cache module 20-1 1, cache module 20-2 application-oriented 2, cache module 20-3 towards quoting 3), and each cache module at least comprises level cache unit 201 and L2 cache unit 202; Cache module be used for according to rule by stored in or the metadata that derives in described metadatabase 10, be stored as data cached in level cache unit 201 or L2 cache unit 202;
Wherein, the data cached storage at level cache unit 201 and L2 cache unit 202 can the rule default according to some be carried out.As: can specify which is data cachedly stored in level cache unit 201 according to the frequency of calling of metadata, which is data cached is stored in L2 cache unit 202.
Data switch engine 30, for the data requesting instructions according to application, from the level cache unit 201 or L2 cache unit 202 of the cache module (as applied 1 corresponding cache module 20-1) corresponding with application, call the data cached of required metadata; Or data are stored in metadatabase 10 with metadata form by this cache module by the cache module sending to application corresponding the data that application produces.
Concrete, when application 1 is by data switch engine 30 request call data, first can search whether there is desired data from the level cache unit 201 of cache module 20-1, if found, just read and return to application 1, if do not found, just from L2 cache unit 202, search whether there is desired data; If found, just read and return to application 1, if also do not found, just from metadatabase 10, calling corresponding data by L2 cache unit 202 and be cached in L2 cache unit 202, and return to application 1.Afterwards, these data can be buffered in L2 cache unit 202 always, time application 1 is called these data more from now on, just directly can call from L2 cache unit 202 and obtain, need not read from metadatabase again.The hit rate that such reading mechanism makes application call from buffer memory is very high, and that is the data major part of application call all in the buffer, only has small part to need to read from database.This saves the time of application request data greatly.
When some in L2 cache unit 202 data cached repeatedly called time, these data cached will being transferred to by L2 cache unit 202, are cached in level cache unit 201.Threshold value can be set to determine which is data cachedly stored in level cache unit 201.This threshold value can be the invoked number of times of data, and such as call number reaches 8 times; Also can be all data cached in the percentage sequence of called frequency, such as call frequency front 10%.
Along with the change of time, accessed data are not the most frequently unalterable.That is, just now also data infrequently, now need by frequent visit, just now still data the most frequently, now again infrequently, so the data in level cache unit 201 can dynamically update according to certain rule, the data in such guarantee level cache unit 201 be accessed the most frequently.
Except storing data, level cache unit 201 and L2 cache unit 202 are also for the relational data of the relation between stored record application.Such as, some is data cached can be employed 1 and call, and also can be employed 2 and call, and when these data are revised in application 1, time application 2 is carried out calling again, what need to call is amended data.Therefore can say, there is association in these data, the data between different application exist various relation between application 1 and application 2.Be used for recording and describing the data of relation between application, be the relational data described in the present embodiment.
Part in relational data or major part, can be stored in level cache unit 201, the relational data of such as 50%-90% is all stored in level cache unit 201, other relational datas, the relational data be such as of little use, can be stored in L2 cache unit 202.
Because the setting of cache module matches with application, data call and the storage of each application use independently cache module, therefore, when multiple users under a tenant use different application, the data call of these application or storage can walk abreast and carry out, do not interfere with each other, effectively improve the speed of data call and storage.And different cache modules is reading and the storage of carrying out data based on same metadatabase, therefore different application obtains the data source of data is all identical, can not cause data corruption.Just ensure that the quick and stable of this data-storage system thus.
If different application is based on different programming language, the data structure of so these application may be inconsistent.In the present system, apply the data stored by data switch engine and carry out discrete storage with the form of the metadata of system.Namely before storing, be meet the metadata that data dictionary specifies by the data processing of different application, then store.When reading, be also first obtain metadata, then be converted to the data of application identifiable design data structure by data processing.Therefore, the data-storage system towards many application of the present invention, can support the storage of the isomeric data of many application.
Accordingly, the embodiment of the present invention additionally provides date storage method based on data-storage system described above and data calling method.
The date storage method process flow diagram based on data-storage system that Fig. 2 provides for the embodiment of the present invention., first date storage method to be described in conjunction with above-mentioned Fig. 1 with Fig. 2 below.
Date storage method of the present invention comprises the steps:
Step 210, the write data of data switch engine self-application in future send to cache module;
Concrete, the data structure of write data is based on this application, and the data structure based on the application of different programming language may be inconsistent.Send in the process of cache module in write data application being obtained or generates, need first to compile these write data, they are converted to set of fields.Each field in these set of fields has field attribute, and field attribute comprises apply property information and other information that field carrys out self-application.Such as write data be " Zhang, 30 years old ", so include in this set of fields " Zhang ", " 30 ", " year " these three fields.Wherein " Zhang " is name, and just including what this field record was described inside its field attribute is the attribute of name; May write data is in certain list item of application, and be such as personnel's inventory of the A department under the list item of personnel management, so also including the name that this field record is described in " Zhang " this field attribute is the attribute belonging to A department.Certainly, in this field attribute, also include and illustrate which application write (read-write) or can by the attribute of which application call (read-only) is this field be by.
Step 220, carries out field fractionation by described set of fields, is stored as data cached according to rule in the level cache unit or L2 cache unit of cache module;
Concrete, rule here, refers to the rule described in previous embodiment, and as determined according to the frequent degree setting threshold value of data access, which is data cachedly stored in level cache unit which is stored in L2 cache unit.If the application of " Zhang, 30 years old " these data is modified based on data with existing, the data stored are such as " Zhang, 29 years old ", and so amended set of fields can store in the buffer unit stored before.Example as in the previous data in the storage of level cache element memory, so this amended set of fields is split as " Zhang ", " 30 ", " year " can still be recorded in level cache unit.If " Zhang, 30 years old " these data are newly-increased, do not store up at level cache unit and L2 cache element memory before, so this set of fields is split as " Zhang ", " 30 ", " year " after be first recorded in L2 cache unit.
Step 230, by described data cached importing metadatabase, is stored as metadata.
Concrete, metadatabase comprises metadata dictionary, and metadata dictionary is used for all kinds of metadata in define system, is the set that metadata describes.Metadata in data dictionary can comprise: numeral, for data describing numerology etc.When storing data cached importing metadatabase, each field after determining the data cached fractionation comprised is needed whether to meet the regulation of metadata dictionary.
Still with " Zhang, 30 years old " for example, in buffer unit, split into field " Zhang ", " 30 ", " year ".Suppose that these fields all meet the regulation of metadata dictionary, so these three fields all can be stored in metadata dictionary, meanwhile, also have recorded the attribute of these metadata.Such as stored in " Zhang ", the attributes such as its affiliated function can be recorded.
If certain field does not meet the regulation of metadata dictionary, so need first to process this meeting of field according to the mapping relations preset, and then import metadatabase and store.Such as in metadata dictionary, regulation attribute is that the metadata store of the numeral at record age is for remaining into one decimal place.So when above-mentioned field " 30 " stores, according to the definition of metadata dictionary, will store again after field being treated to " 30.0 ".
The date storage method based on the data-storage system towards many application that the embodiment of the present invention provides, can based on different application, independent buffer memory is carried out to data, and hierarchical cache is carried out to the data of access frequency different brackets, thus effectively improve the speed of data storage, promote the work efficiency of management information system.
The data calling method process flow diagram based on data-storage system that Fig. 3 provides for the embodiment of the present invention., in conjunction with above-mentioned Fig. 1 data calling method to be described with Fig. 3 below.
Data calling method of the present invention comprises the steps:
Step 310, data switch engine, according to the data requesting instructions of application, sends metadata call request to the cache module corresponding with described application;
Concrete, when an application needs to carry out data call to data, first data requesting instructions can be sent by data switch engine.The information etc. such as the attribute of required requested date, data relationship are carried in data requesting instructions.
Under same tenant different user use different application simultaneously request call data time, each application, by data switch engine, is carried out data call, can be walked abreast each other, not interfere with each other from the cache module corresponding to this application.
Step 320, described cache module is according to described metadata call request, and in the level cache unit of described cache module, the required metadata of inquiry is data cached;
Concrete, cache module, can the data requesting instructions information such as attribute, data relationship of data of carrying after receiving data requesting instructions, in cache module, first search whether have corresponding data.
In data-storage system of the present invention, data storage in cache module carries out classification storage according to access frequency (or also may be other rules), cache module is at least divided into two-level cache, the level cache unit namely described in above-described embodiment and L2 cache unit.The data that in level cache unit, memory access frequency is higher, L2 cache unit stores the lower data of other access frequencys except the higher data of aforementioned access frequency.
Step 330, when there is required metadata data cached in described level cache unit, returns to described application by described required the data cached of metadata by described data switch engine;
Concrete, if when having found desired data in level cache unit, just direct these data called by data switch engine in buffer memory, have returned to application.
Step 340, when there is no required metadata data cached in described level cache unit, in the L2 cache unit of described cache module, the required metadata of inquiry is data cached, and the data cached of metadata needed for storing in described L2 cache unit is returned to described application by data switch engine.
Concrete, if there is no desired data in level cache unit, then continue to search from L2 cache unit, called these data in buffer memory after finding by data switch engine, return to application.
Under normal circumstances, required calling data can should find in L2 cache unit, but also may have special circumstances, and as cache module physics is closed or fault, wherein data are all lost.In this case, cannot find in cache module during data call.Search data failure in cache module after, described L2 cache unit, according to data call request, obtains required metadata, and is stored as data cached in L2 cache unit from metadatabase; And this is data cachedly returned to described application by data switch engine.
The data calling method based on the data-storage system towards many application that the embodiment of the present invention provides, can based on different application, carry out independently calling to data, carry out classification based on the data staging buffer memory that access frequency is different to call, thus effectively improve the speed of data access, promote the work efficiency of management information system.
Professional should recognize further, in conjunction with unit and the algorithm steps of each example of embodiment disclosed herein description, can realize with electronic hardware, computer software or the combination of the two, in order to the interchangeability of hardware and software is clearly described, generally describe composition and the step of each example in the above description according to function.These functions perform with hardware or software mode actually, depend on application-specific and the design constraint of technical scheme.Professional and technical personnel can use distinct methods to realize described function to each specifically should being used for, but this realization should not think the scope exceeding the embodiment of the present invention.
The software module that the method described in conjunction with embodiment disclosed herein or the step of algorithm can use hardware, processor to perform, or the combination of the two is implemented.Software module can be placed in the storage medium of other form any known in random access memory (RAM), internal memory, ROM (read-only memory) (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technical field.
Above-described embodiment; to the embodiment of the present invention, technical scheme and beneficial effect further describe; be understood that; the foregoing is only the embodiment of the embodiment of the present invention; be not intended to limit the present invention the protection domain of embodiment; within all spirit in the embodiment of the present invention and principle, any amendment made, equivalent replacement, improvement etc., within the protection domain that all should be included in the embodiment of the present invention.