This application claims the applying date be on October 28th, 2014, application No. is 201410586667.4, entitled " one
Processing method, device and the server of kind of business datum " Chinese invention patent application priority.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
It is fully disclosed to those skilled in the art.
With reference to the accompanying drawings of the specification, to a kind of processing method of business datum provided in an embodiment of the present invention, device and
The specific embodiment of server is illustrated.
A kind of processing method of business datum provided in an embodiment of the present invention, as shown in Figure 1, specifically includes the following steps:
S11, by business datum write-in persistent storage storage entity in when, the business datum is written in caching;
S12, when receiving business datum inquiry request, corresponding business datum is read from the caching and is returned.
In embodiments of the present invention, the storage entity of persistent storage can be any achievable persistent storage (relative to facing
When storage for) entity of function, be not limited to the form of software, hardware or software and hardware combining.In embodiments of the present invention,
The storage entity of the persistent storage includes but is not limited to such as database or file.
, can be by the way of buffer queue when business datum is stored in the buffer, what the embodiment of the present invention is for using
The specific storage mode of kind does not limit.Equally, which kind of the embodiment of the present invention for being had in the storage entity of persistent storage using
The storage mode of body does not also limit.
Business datum persistence is being by business number by the processing method of above-mentioned business datum provided in an embodiment of the present invention
While according in the storage entity of write-in persistent storage, it is also necessary to same business datum is written in caching, in this way, protecting
It demonstrate,proves in business datum and the caching in the storage entity of persistent storage under the premise of service data consistence, when receiving business datum
When inquiry request, no matter concurrency is much in this way, and corresponding business datum can be directly inquired into caching, without going persistently
It is searched in the storage entity of storage, has both avoided read-write interlocking caused by the frequently storage entity of inquiry persistent storage and fought for resource
The problem of reducing performance, while again by business datum persistence in time, the business datum when service of avoiding is abnormal
The problem of loss.
Further, in above-mentioned steps S11, by business datum write-in persistent storage storage entity the step of, specifically may be used
To be realized by following processes:
The service request of user is monitored;
When receiving user's sending service request, according to the form of Definition unserializing data object of the request;
Serializing is that data object state is converted to data (generally data flow) mistake for the format that can be kept or transmit
Journey.Unserializing is a process in contrast, i.e., network data flow is converted to data object.
In order to which the stream compression of the service request issued comprising user changes data object into, need to define according to the request
Form is converted into data object.The implementation method of specific unserializing, is referred to the prior art.
Data object is put into the storage entity of persistent storage and is saved.
The service request of user includes but is not limited to HTTP request, can also be and is asked using the business of other protocol types
It asks.
Preferably, can also include in request before the form of Definition unserializing data object according to the request
Hold whether legal inspection the step of, if legal, then carry out the operation of unserializing data object.
Further, the processing method of above-mentioned business datum, can also be according to the demand of the affiliated business of business datum, in advance
Determine the life cycle of dsc data in business datum in caching, which refers to the number for meeting service inquiry request in caching
According to.
Under the scene of real-time monitoring system, the business datum of newest period usually can be only paid close attention to, according to business demand
It can be nearest 30 minutes, 1 hour nearest, even several hours data recently, the data that this part is concerned are in other words
It is the data that can satisfy service inquiry demand, referred to as dsc data in embodiments of the present invention, when business datum is no longer effective
After property, referred to as cold data.Over time, dsc data can become cold data, and recently received data become hot number
According to.
The life cycle of dsc data can determine that specifically how determining can join according to the business demand belonging to business datum
Examine the prior art.
Further, the processing method of above-mentioned business datum provided in an embodiment of the present invention, can also be according to dsc data
Life cycle constantly deletes cold data, i.e. data of those generation times more than the life cycle of the dsc data in the buffer.
In embodiments of the present invention, business datum includes various dimensions, index and the timestamp of business, this timestamp mark
Will the generation time of business datum, also, cache in data be to be put into according to chronological order, the business number of front
According to timestamp be less than subsequent data timestamp, so, in embodiments of the present invention, can be according to the timestamp of business datum
Determine which business datum is dsc data, which business datum is cold data and deletes cold data, specifically, can will
The timestamp of the last line business datum saved in caching subtracts the life cycle of dsc data, when obtaining the cut-off of cold data
Between;
All business datums of the timestamp in caching before the deadline for the cold data being calculated are deleted.
In this way, constantly deleting cold data in the buffer, retain dsc data, so that always maintain in caching to inquiry business
Useful newest dsc data not only meets inquiry request, but also can avoid the excessive occupancy to caching.
Further, as shown in Fig. 2, step S12 can specifically include:
S121, when receiving business datum inquiry request, determine whether current service is abnormal;
If the definitive result of S122, S121 be it is yes, corresponding business datum is read from the storage entity of persistent storage
And it returns;
If the definitive result of S123, S121 be it is no, corresponding business datum is read from caching and is returned.
The processing method for the above-mentioned business datum that embodiment provides in order to better illustrate the present invention is simple with one below
Example be described:
The flow chart of the example is as shown in figure 3, the process includes the following steps:
When S21, process start, built-in variable to be used is needed during initialization data set and this method execution;
S22, the monitoring for opening HTTP request;
S23, judge whether to receive HTTP request;If so, otherwise executing S24 continues to execute S22;
S24, judge whether request content is legal after receiving request;If legal, S25 is executed;Otherwise, it continues to execute
S22;
S25, according to the form of Definition unserializing of request at data object.
S26, data object is put into queue database, queue database include various dimensions and the index of business with
And timestamp.
This step S25 in the specific implementation, can use an individual thread timing and queue database updated to number
According to library, which calls (several seconds or tens seconds etc.) according to timed periodic, updated data is deleted after update
Library queue member.
S27, data object is put into buffer queue simultaneously;
Because data are to be put into queue according to sequencing, the timestamp of earlier data is centainly less than subsequent data
Timestamp, buffer queue includes the various dimensions and index and timestamp of business.
In this step S27, can use an individual thread timed maintenance buffer queue data, the thread according to
Timed periodic calls (tens seconds or one minute etc.).The life cycle of dsc data is obtained according to business demand, such as false
If life cycle is 1 hour (life cycle of dsc data), then the timestamp of buffer queue last line data is obtained, it should
It is all cold data that timestamp, which subtracts the data of time that 1 hour obtains forward,.These cold datas are constantly deleted, cache team at this time
Data in column are exactly dsc data.
When the service of monitoring is to start for the first time, the number (life cycle of dsc data) 1 hour nearest in database is needed
According to checking out, it is put into buffer queue.
When S28, front end send inquiry, if service exception does not occur, newest heat is directly inquired from buffer queue
Data simultaneously return, because the data in the dsc data and database in caching are consistent.
Based on the same inventive concept, the embodiment of the invention also provides a kind of processing unit of business datum and server,
Since the principle of these devices and the solved problem of server is similar to the processing method of aforementioned business datum, the device and
The implementation of server may refer to the implementation of preceding method, and overlaps will not be repeated.
The processing unit of above-mentioned business datum provided in an embodiment of the present invention, as shown in Figure 4, comprising:
First writing module 301, for business datum to be written in the storage entity of persistent storage;
Second writing module 302, for by business datum write-in persistent storage storage entity in when, by the business
Data are written in caching;
Enquiry module 303, for reading corresponding business from the caching when receiving business datum inquiry request
Data simultaneously return.
Further, the processing unit of business datum provided in an embodiment of the present invention, as shown in Figure 3, further includes: at caching
It manages module 304 and predefines the life cycle of dsc data in business datum in the caching, institute for the demand according to business
Stating dsc data is the data for meeting service inquiry request in the caching.
Further, the buffer process module 304 in the processing unit of business datum provided in an embodiment of the present invention, is also used
In the life cycle according to the dsc data, the Life Cycle that generation time is greater than the dsc data is constantly deleted in the caching
The cold data of phase.
Further, above-mentioned buffer process module 304, specifically for the last line business number that will be saved in the caching
According to timestamp subtract the life cycle of the dsc data, obtain the deadline of cold data;Timestamp in the caching is existed
All business datums before the deadline of the cold data are deleted.
Further, above-mentioned enquiry module 303 may include:
Submodule is confirmed, for determining whether current service is abnormal when receiving business datum inquiry request;
Submodule is inquired, for reading corresponding business from the storage entity of persistent storage when confirming result is to be
Data simultaneously return;When it is no for confirming result, corresponding business datum is read from caching and is returned.
The embodiment of the invention also provides a kind of server, which includes above-mentioned business provided in an embodiment of the present invention
The processing unit of data.
Algorithm and display are not inherently related to any particular computer, virtual system, or other device provided herein.
Various general-purpose systems can also be used together with teachings based herein.As described above, it constructs required by this kind of system
Structure be obvious.In addition, the present invention is also not directed to any particular programming language.It should be understood that can use various
Programming language realizes summary of the invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In the instructions provided here, numerous specific details are set forth.It is to be appreciated, however, that implementation of the invention
Example can be practiced without these specific details.In some instances, well known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this specification.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of the various inventive aspects,
Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the disclosed method should not be interpreted as reflecting the following intention: i.e. required to protect
Shield the present invention claims features more more than feature expressly recited in each claim.More precisely, as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, wherein each claim itself
All as a separate embodiment of the present invention.
Those skilled in the art will understand that can be carried out adaptively to the module in the equipment in embodiment
Change and they are arranged in one or more devices different from this embodiment.It can be the module or list in embodiment
Member or component are combined into a module or unit or component, and furthermore they can be divided into multiple submodule or subelement or
Sub-component.Other than such feature and/or at least some of process or unit exclude each other, it can use any
Combination is to all features disclosed in this specification (including adjoint claim, abstract and attached drawing) and so disclosed
All process or units of what method or apparatus are combined.Unless expressly stated otherwise, this specification is (including adjoint power
Benefit require, abstract and attached drawing) disclosed in each feature can carry out generation with an alternative feature that provides the same, equivalent, or similar purpose
It replaces.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments
In included certain features rather than other feature, but the combination of the feature of different embodiments mean it is of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed
Meaning one of can in any combination mode come using.
Various component embodiments of the invention can be implemented in hardware, or to run on one or more processors
Software module realize, or be implemented in a combination thereof.It will be understood by those of skill in the art that can be used in practice
Microprocessor or digital signal processor (DSP) realize the processing unit kimonos of business datum according to an embodiment of the present invention
The some or all functions for some or all components being engaged in device.The present invention is also implemented as being retouched here for executing
The some or all device or device programs (for example, computer program and computer program product) for the method stated.
It is such to realize that program of the invention can store on a computer-readable medium, or can have one or more signal
Form.Such signal can be downloaded from an internet website to obtain, be perhaps provided on the carrier signal or with it is any its
He provides form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and ability
Field technique personnel can be designed alternative embodiment without departing from the scope of the appended claims.In the claims,
Any reference symbol between parentheses should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not
Element or step listed in the claims.Word "a" or "an" located in front of the element does not exclude the presence of multiple such
Element.The present invention can be by means of including the hardware of several different elements and being come by means of properly programmed computer real
It is existing.In the unit claims listing several devices, several in these devices can be through the same hardware branch
To embody.The use of word first, second, and third does not indicate any sequence.These words can be explained and be run after fame
Claim.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art
Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to include these modifications and variations.