This application claims the right of priority that the applying date is on October 28th, 2014, application number is 201410586667.4, denomination of invention is the Chinese invention patent application of " a kind of disposal route of business datum, device and server ".
Embodiment
Below with reference to accompanying drawings exemplary embodiment of the present disclosure is described in more detail.Although show exemplary embodiment of the present disclosure in accompanying drawing, however should be appreciated that can realize the disclosure in a variety of manners and not should limit by the embodiment set forth here.On the contrary, provide these embodiments to be in order to more thoroughly the disclosure can be understood, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
Below in conjunction with Figure of description, the embodiment of the disposal route of a kind of business datum that the embodiment of the present invention provides, device and server is described.
The disposal route of a kind of business datum that the embodiment of the present invention provides, as shown in Figure 1, specifically comprises the following steps:
S11, by lasting for the business datum write storage entity stored time, described business datum is written in buffer memory;
S12, when receiving business datum inquiry request, from described buffer memory, reading corresponding business datum and return.
In embodiments of the present invention, the lasting storage entity stored can be any entity realizing lasting storage (for interim storage) function, is not limited to the form of software, hardware or software and hardware combining.In embodiments of the present invention, this storage entity stored lastingly includes but not limited to such as database or file etc.
When business datum stores in the buffer, can adopt the mode of buffer queue, the embodiment of the present invention for which kind of concrete storage mode of employing does not limit.Equally, the embodiment of the present invention for which kind of the concrete storage mode of employing in the lasting storage entity stored also does not limit.
The disposal route of the above-mentioned business datum that the embodiment of the present invention provides, while in the storage entity that business datum persistence is stored lastingly by business datum write, same business datum is also needed to be written in buffer memory, like this, in the business datum ensured in the lasting storage entity stored and buffer memory service data consistence prerequisite under, when receiving business datum inquiry request, so no matter concurrency is much, corresponding business datum directly can be inquired about in buffer memory, and need not go to search in the lasting storage entity stored, both the problem that resource reduces performance is fought in the read-write interlocking that the storage entity having avoided the lasting storage of frequent inquiry causes, simultaneously again by business datum persistence in time, avoid the problem of the loss of business datum when service occurs abnormal.
Further, in above-mentioned steps S11, by the step of lasting for the business datum write storage entity stored, specifically can pass through following process implementation:
The service request of user is monitored;
When receiving user and sending service request, according to the form of Definition unserializing data object of this request;
Serializing is data (being generally data stream) process data object state being converted to the form that can keep or transmit.Unserializing is a process in contrast, is converted to data object by network data flow.
In order to the stream compression comprising the service request that user sends changes data object into, the form defined according to this request is needed to be converted into data object.The implementation method of concrete unserializing, can with reference to prior art.
Data object is put in the lasting storage entity stored and preserve.
The service request of user includes but not limited to HTTP request, can also be the service request adopting other protocol types.
Preferably, before according to the form of Definition unserializing data object of this request, the step to the whether legal inspection of request content can also be comprised, if legal, then carry out the operation of unserializing data object.
Further, the disposal route of above-mentioned business datum, can also according to the demand of business belonging to business datum, and pre-determine the life cycle of dsc data in business datum in buffer memory, this dsc data refers in buffer memory the data meeting service inquiry request.
Under the scene of real-time monitoring system, usually the business datum of up-to-date time period can only be paid close attention to, according to business demand can be nearest 30 minutes, the data of nearest 1 hour, even several hours recently, this part data be concerned can meet the data of service inquiry demand in other words conj.or perhaps, be referred to as dsc data in embodiments of the present invention, when after the no longer effective property of business datum, be referred to as cold data.As time goes on, dsc data can become cold data, and the up-to-date data received become dsc data.
The life cycle of dsc data can the business demand belonging to business datum be determined, specifically how determining can with reference to prior art.
Further, the disposal route of the above-mentioned business datum that the embodiment of the present invention provides, can also according to the life cycle of dsc data, and constantly delete cold data in the buffer, namely those generation times exceed the data of the life cycle of this dsc data.
In embodiments of the present invention, business datum comprises the various dimensions of business, index and timestamp, this timestamp indicates the generation time of business datum, and, data in buffer memory are put into according to time order and function order, the timestamp of business datum is above less than the timestamp of subsequent data, so, in embodiments of the present invention, can determine which business datum is dsc data according to the timestamp of business datum, which business datum is cold data and cold data is deleted, specifically, the timestamp of last column business datum of preserving in buffer memory can be deducted the life cycle of dsc data, obtain the closing time of cold data,
The all business datums of timestamp in buffer memory before the closing time of the cold data calculated are deleted.
Like this, constantly delete cold data in the buffer, retain dsc data, make in buffer memory, always to maintain the up-to-date dsc data useful to inquiry business, both met inquiry request, and can excessively taking buffer memory be avoided again.
Further, as shown in Figure 2, step S12 specifically can comprise:
S121, when receiving business datum inquiry request, determine whether current service exception occurs;
If the determination result of S122 S121 is yes, then from the lasting storage entity stored, reads corresponding business datum and return;
If the determination result of S123 S121 is no, then from buffer memory, reads corresponding business datum and return.
In order to the disposal route of the above-mentioned business datum that the embodiment of the present invention provides is described better, be described with a simple example below:
As shown in Figure 3, this flow process comprises the steps: the process flow diagram of this example
When S21, flow process start, the term of execution of initialization data set and the method, need the built-in variable used;
The monitoring of S22, unlatching HTTP request;
S23, judge whether to receive HTTP request; If so, S24 is performed, otherwise, continue to perform S22;
S24, the request that receives judge that whether request content is legal afterwards; If legal, then perform S25; Otherwise, continue to perform S22;
S25, according to request form of Definition antitone sequence change into data object.
S26, data object is put in queue database, queue database comprises the various dimension of business and index and timestamp.
This step S25 in the specific implementation, can utilize an independent thread timing that queue database is updated to database, this thread calls (several seconds or tens seconds etc.) according to timed periodic, deletes the queue database member upgraded after renewal.
S27, data object to be put in buffer queue simultaneously;
Because data put into queue according to sequencing, so the timestamp of earlier data is necessarily less than the timestamp of subsequent data, buffer queue comprises the various dimension of business and index and timestamp.
In this step S27, can adopt the data of an independent thread timed maintenance buffer queue, this thread calls (tens seconds or one minute etc.) according to timed periodic.The life cycle of dsc data is obtained according to business demand, if such as life cycle is 1 hour (life cycle of dsc data), so obtain the timestamp of buffer queue last column data, it is all cold data that this timestamp deducts the time data forward drawn for 1 hour.These cold data of continuous deletion, the data now in buffer queue are exactly dsc data.
When monitoring service is initiating switchup, needs the data query of nearest 1 hour (life cycle of dsc data) in database out, put into buffer queue.
When S28, front end send inquiry, if it is abnormal that service does not occur, then directly from buffer queue, inquire about up-to-date dsc data and return, because the dsc data in buffer memory is consistent with the data in database.
Based on same inventive concept, the embodiment of the present invention additionally provides a kind for the treatment of apparatus and server of business datum, the principle of dealing with problems due to these devices and server is similar to the disposal route of aforementioned business datum, therefore the enforcement of this device and server see the enforcement of preceding method, can repeat part and repeats no more.
The treating apparatus of the above-mentioned business datum that the embodiment of the present invention provides, as shown in Figure 4, comprising:
First writing module 301, for writing in the lasting storage entity stored by business datum;
Second writing module 302, for when business datum being write in the lasting storage entity stored, is written in buffer memory by described business datum;
Enquiry module 303, for when receiving business datum inquiry request, reading corresponding business datum and returning from described buffer memory.
Further, the treating apparatus of the business datum that the embodiment of the present invention provides, as shown in Figure 3, also comprise: buffer process module 304, for the demand according to business, pre-determine the life cycle of dsc data in business datum in described buffer memory, described dsc data is the data meeting service inquiry request in described buffer memory.
Further, the buffer process module 304 in the treating apparatus of the business datum that the embodiment of the present invention provides, also for the life cycle according to described dsc data, constantly deletes the cold data that generation time is greater than the life cycle of described dsc data in described buffer memory.
Further, above-mentioned buffer process module 304, specifically for the timestamp of the last column of preserving in described buffer memory business datum being deducted the life cycle of described dsc data, obtains the closing time of cold data; The all business datums of timestamp in described buffer memory before the closing time of described cold data are deleted.
Further, above-mentioned enquiry module 303 can comprise:
Confirming submodule, for when receiving business datum inquiry request, determining whether current service exception occurs;
Inquiry submodule, for when confirming result for being, reading corresponding business datum and returning from the lasting storage entity stored; When confirming that result is no, from buffer memory, reading corresponding business datum and return.
The embodiment of the present invention additionally provides a kind of server, and this server comprises the treating apparatus of the above-mentioned business datum that the embodiment of the present invention provides.
Intrinsic not relevant to any certain computer, virtual system or miscellaneous equipment with display at this algorithm provided.Various general-purpose system also can with use based on together with this teaching.According to description above, the structure constructed required by this type systematic is apparent.In addition, the present invention is not also for any certain programmed language.It should be understood that and various programming language can be utilized to realize content of the present invention described here, and the description done language-specific is above to disclose preferred forms of the present invention.
In instructions provided herein, describe a large amount of detail.But can understand, embodiments of the invention can be put into practice when not having these details.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand in each inventive aspect one or more, in the description above to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes.But, the method for the disclosure should be construed to the following intention of reflection: namely the present invention for required protection requires feature more more than the feature clearly recorded in each claim.Or rather, as claims below reflect, all features of disclosed single embodiment before inventive aspect is to be less than.Therefore, the claims following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and adaptively can change the module in the equipment in embodiment and they are arranged in one or more equipment different from this embodiment.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and multiple submodule or subelement or sub-component can be put them in addition.Except at least some in such feature and/or process or unit be mutually repel except, any combination can be adopted to combine all processes of all features disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) and so disclosed any method or equipment or unit.Unless expressly stated otherwise, each feature disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) can by providing identical, alternative features that is equivalent or similar object replaces.
In addition, those skilled in the art can understand, although embodiments more described herein to comprise in other embodiment some included feature instead of further feature, the combination of the feature of different embodiment means and to be within scope of the present invention and to form different embodiments.Such as, in the following claims, the one of any of embodiment required for protection can use with arbitrary array mode.
All parts embodiment of the present invention with hardware implementing, or can realize with the software module run on one or more processor, or realizes with their combination.It will be understood by those of skill in the art that the some or all functions that microprocessor or digital signal processor (DSP) can be used in practice to realize according to the some or all parts in the treating apparatus of the business datum of the embodiment of the present invention and server.The present invention can also be embodied as part or all equipment for performing method as described herein or device program (such as, computer program and computer program).Realizing program of the present invention and can store on a computer-readable medium like this, or the form of one or more signal can be had.Such signal can be downloaded from internet website and obtain, or provides on carrier signal, or provides with any other form.
The present invention will be described instead of limit the invention to it should be noted above-described embodiment, and those skilled in the art can design alternative embodiment when not departing from the scope of claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and does not arrange element in the claims or step.Word "a" or "an" before being positioned at element is not got rid of and be there is multiple such element.The present invention can by means of including the hardware of some different elements and realizing by means of the computing machine of suitably programming.In the unit claim listing some devices, several in these devices can be carry out imbody by same hardware branch.Word first, second and third-class use do not represent any order.Can be title by these word explanations.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.