Summary of the invention
Fundamental purpose of the present invention is to provide a kind of data processing method and device of accessing time-out, to solve in correlation technique iff the fixed-timeouts time of estimation, then be difficult to meet all querying conditions, moreover, such fixed-timeouts time being all querying conditions share also is difficult to determine, namely allow to successfully determine, the problem that also may impact the performance of system.
To achieve these goals, according to an aspect of the present invention, a kind of data processing method of accessing time-out is provided.The method comprises: the querying attributes obtaining request of access, and above-mentioned querying attributes is for characterizing the type of above-mentioned request of access; Obtain the corresponding relation of above-mentioned querying attributes and time-out time, above-mentioned time-out time is the time exceeding default access latency; And the actual time-out time of above-mentioned request of access is determined according to above-mentioned corresponding relation.
Further, before the corresponding relation obtaining above-mentioned querying attributes and time-out time, above-mentioned data processing method also comprises: judge that whether above-mentioned querying attributes is the querying attributes of discretize, wherein, if judge that above-mentioned querying attributes is the querying attributes of above-mentioned discretize, then perform the step of the corresponding relation obtaining above-mentioned querying attributes and time-out time; If judge that above-mentioned querying attributes is not the querying attributes of above-mentioned discretize, then first sliding-model control is carried out to above-mentioned querying attributes, then perform the step of the corresponding relation obtaining above-mentioned querying attributes and time-out time.
Further, the querying attributes of above-mentioned discretize comprises: the first querying attributes and the second querying attributes, query composition attribute is the querying attributes of the combination of above-mentioned first querying attributes and the second querying attributes, determines the time-out time corresponding with the querying attributes of above-mentioned discretize by the following method: carry out actual queries according to the combinations thereof querying attributes of above-mentioned request of access; Record the time-out time of above-mentioned request of access in actual queries; And using the time-out time of above-mentioned request of access in actual queries as the time-out time corresponding with the querying attributes of above-mentioned discretize.
Further, the querying attributes of above-mentioned discretize comprises: the first querying attributes and the second querying attributes, query composition attribute is the querying attributes of the combination of above-mentioned first querying attributes and the second querying attributes, determines the time-out time corresponding with the querying attributes of above-mentioned discretize by the following method: carry out repeatedly actual queries according to the combinations thereof querying attributes of above-mentioned request of access; Record the repeatedly time-out time of above-mentioned request of access in actual queries; Time is averaging to the repeatedly time-out time of above-mentioned request of access in actual queries; And using above-mentioned averaging time as the time-out time corresponding with the querying attributes of above-mentioned discretize.
Further, after the actual time-out time determining above-mentioned request of access according to above-mentioned corresponding relation, above-mentioned data processing method also comprises: obtain the max-timeout time preset; Judge whether above-mentioned actual time-out time is greater than the above-mentioned max-timeout time; If judge that above-mentioned actual time-out time is greater than the above-mentioned max-timeout time, then using the above-mentioned max-timeout time as final actual time-out time; And if judge that above-mentioned actual time-out time is not more than the above-mentioned max-timeout time, then using above-mentioned actual time-out time as above-mentioned actual time-out time finally.
To achieve these goals, according to a further aspect in the invention, a kind of data processing equipment of accessing time-out is provided.This device comprises: the first acquiring unit, and for obtaining the querying attributes of request of access, above-mentioned querying attributes is for characterizing the type of above-mentioned request of access; Second acquisition unit, for obtaining the corresponding relation of above-mentioned querying attributes and time-out time, above-mentioned time-out time is the time exceeding default access latency; And first determining unit, for determining the actual time-out time of above-mentioned request of access according to above-mentioned corresponding relation.
Further, above-mentioned data processing equipment also comprises: the first judging unit, for before the corresponding relation obtaining above-mentioned querying attributes and time-out time, judge that whether above-mentioned querying attributes is the querying attributes of discretize, wherein, if judge that above-mentioned querying attributes is the querying attributes of above-mentioned discretize, then perform the function of above-mentioned second acquisition unit; If judge that above-mentioned querying attributes is not the querying attributes of above-mentioned discretize, then first sliding-model control is carried out to above-mentioned querying attributes, then perform the function of above-mentioned second acquisition unit.
Further, the querying attributes of above-mentioned discretize comprises: the first querying attributes and the second querying attributes, query composition attribute is the querying attributes of the combination of above-mentioned first querying attributes and the second querying attributes, above-mentioned data processing equipment also comprises: the second determining unit, for by determining the time-out time corresponding with the querying attributes of above-mentioned discretize with lower device, wherein, above-mentioned second determining unit has: the first enquiry module, carries out actual queries for the combinations thereof querying attributes according to above-mentioned request of access; First logging modle, for recording the time-out time of above-mentioned request of access in actual queries; And first determination module, for using the time-out time of above-mentioned request of access in actual queries as the time-out time corresponding with the querying attributes of above-mentioned discretize.
Further, the querying attributes of above-mentioned discretize comprises: the first querying attributes and the second querying attributes, query composition attribute is the querying attributes of the combination of above-mentioned first querying attributes and the second querying attributes, above-mentioned data processing equipment also comprises: the 3rd determining unit, for by determining the time-out time corresponding with the querying attributes of above-mentioned discretize with lower device, wherein, above-mentioned 3rd determining unit has: the second enquiry module, carries out repeatedly actual queries for the combinations thereof querying attributes according to above-mentioned request of access; Second logging modle, for recording the repeatedly time-out time of above-mentioned request of access in actual queries; Computing module, for being averaging the time to the repeatedly time-out time of above-mentioned request of access in actual queries; And second determination module, for using above-mentioned averaging time as the time-out time corresponding with the querying attributes of above-mentioned discretize.
Further, above-mentioned data processing equipment also comprises: the 3rd acquiring unit, for after the actual time-out time determining above-mentioned request of access according to above-mentioned corresponding relation, obtains the max-timeout time preset; Second judging unit, for judging whether above-mentioned actual time-out time is greater than the above-mentioned max-timeout time; 4th determining unit, for when judging that above-mentioned actual time-out time is greater than the above-mentioned max-timeout time, using the above-mentioned max-timeout time as final actual time-out time; And the 5th determining unit, for when judging that above-mentioned actual time-out time is not more than the above-mentioned max-timeout time, using above-mentioned actual time-out time as above-mentioned actual time-out time finally.
By the present invention, adopt the querying attributes obtaining request of access, querying attributes is for characterizing the type of request of access; Obtain the corresponding relation of querying attributes and time-out time, time-out time is the time exceeding default access latency; And according to the actual time-out time of corresponding relation determination request of access, solve in correlation technique iff the fixed-timeouts time of estimation, then be difficult to meet all querying conditions, moreover, such fixed-timeouts time being all querying conditions share also is difficult to determine, namely allow to successfully determine, the problem that also may impact the performance of system, and then reach and determine that time-out time is to meet the effect of the requirement of different querying conditions dynamically.
Embodiment
It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.Below with reference to the accompanying drawings and describe the present invention in detail in conjunction with the embodiments.
The application's scheme is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present application, technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only the embodiment of the application's part, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtained under creative work prerequisite, all should belong to the scope of the application's protection.
It should be noted that, term " first ", " second " etc. in the instructions of the application and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged, in the appropriate case so that the embodiment of the application described herein.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those steps or unit that the process of series of steps or unit, method, system, product or equipment is not necessarily limited to clearly list, but can comprise clearly do not list or for intrinsic other step of these processes, method, product or equipment or unit.
According to embodiments of the invention, provide a kind of data processing method of accessing time-out.The data processing method of this access time-out may operate on computer-processing equipment.
Fig. 1 is the process flow diagram of the data processing method of access time-out according to the embodiment of the present invention.As shown in Figure 1, the method comprises following step S102 to step S106:
Step S102, obtain the querying attributes of request of access, querying attributes is for characterizing the type of request of access.
It should be noted that, in embodiments of the present invention, request of access can be the request of access of accessing database, and such as, it can be SQL query request.Querying attributes can comprise one or more, the present invention does not do any restriction to it, such as, its can be data query number attribute, whether there is the attribute of filtercondition, whether have the attribute etc. of sequence, accordingly, the type characterizing request of access can be the request of data query number respectively, whether has the request of filtercondition, whether have the request etc. of sequence.
Due to data query number, whether there is filtercondition and whether have sequence etc. to be the principal element affecting query time, therefore, obtain request of access querying attributes after, can mainly using querying attributes corresponding for above-mentioned several key element as the initial conditions determining time-out time.
Step S104, obtains the corresponding relation of querying attributes and time-out time.Time-out time is the time exceeding default access latency.
Time-out time is the time exceeding default access latency, also, after client initiates request of access, and the time-out time of database response.During enforcement, time-out time corresponding to each querying attributes can be pre-determined according to historical query record or experimental data, and the corresponding relation of the time-out time obtained and each querying attributes and corresponding time-out time is stored in overtime form, use in order to during actual access database.
Step S106, according to the actual time-out time of corresponding relation determination request of access.
During enforcement, when needing the time-out time determining an inquiry request, first can obtain each querying attributes of this inquiry request, i.e. each querying condition, and in above-mentioned overtime form, search corresponding time-out time according to these querying conditions, and the actual time-out time using the time-out time of this correspondence as request of access, also, the time-out time of actual queries.
Pass through the embodiment of the present invention, due to can according to the querying attributes of each request of access, dynamically determine a time-out time for data base querying, thus as far as possible many inquiries can be allowed not overtime, and avoid consuming system resource excessively, reach and determine that time-out time is to meet the effect of the requirement of different querying conditions dynamically. as far as possible
Preferably, in embodiments of the present invention, before the corresponding relation that step S104 obtains querying attributes and time-out time, this data processing method can also comprise:
S2, judges that whether querying attributes is the querying attributes of discretize.Wherein, if judge that querying attributes is the querying attributes of discretize, then perform the step that step S104 obtains the corresponding relation of querying attributes and time-out time; If judge that querying attributes is not the querying attributes of discretize, then first sliding-model control is carried out to querying attributes, then perform the step that step S104 obtains the corresponding relation of querying attributes and time-out time.
Because querying attributes can be divided into continuous type querying attributes and discrete type querying attributes according to inquiry meaning, also be, determine that the initial conditions of time-out time can be divided into two classes: continuous type initial conditions and discrete type initial conditions, such as, the attribute of data query number is continuous type querying attributes, and whether there is the attribute of filtration and whether have the attribute of sequence to be discrete type querying attributes, thus when implementing, for each continuous type initial conditions, need first by it discretize, re-use the initial conditions after discretize in above-mentioned overtime form, search corresponding time-out time, and using this time-out time found as the time-out time of actual queries, also be, final time-out time.
Wherein, the treatment scheme of discretize is as follows: first determine the maximal value that this continuous type initial conditions is inquired about in systems in which and minimum value, gather some points according to predetermined interval between a minimum value and a maximum value again, put the discrete form of corresponding value as this continuity initial conditions with these.
Further preferably, in embodiments of the present invention, the querying attributes of discretize comprises: the first querying attributes and the second querying attributes, query composition attribute can be the querying attributes of the combination of the first querying attributes and the second querying attributes, determines the time-out time corresponding with the querying attributes of discretize by the following method:
S4, carries out actual queries according to the query composition attribute of request of access;
S6, the time-out time of record access request in actual queries; And
S8, using the time-out time of request of access in actual queries as the time-out time corresponding with the querying attributes of discretize.
Preferably, in embodiments of the present invention, the querying attributes of discretize comprises: the first querying attributes and the second querying attributes, query composition attribute is the querying attributes of the combination of the first querying attributes and the second querying attributes, determines the time-out time corresponding with the querying attributes of discretize by the following method:
S10, carries out repeatedly actual queries according to the query composition attribute of request of access;
S12, the repeatedly time-out time of record access request in actual queries;
S14, is averaging the time to the repeatedly time-out time of request of access in actual queries; And
S16, using averaging time as the time-out time corresponding with the querying attributes of discretize.
During enforcement, can first obtain each initial conditions, for being left intact of initial conditions of inherently discretize, then first sliding-model control is done for the initial conditions of continuous type time itself, obtain the initial conditions of discrete type, then the initial conditions of these discrete types is combined, thus structure inquiry request carries out actual queries, and record the time-out time of each group polling, and calculate the average of these time-out times, to expend time in t using this average as the typical query of this group polling condition, also be, the time-out time corresponding with the querying attributes of discretize.
Further, an overtime Coefficient m can also be determined, the time-out time according to each group polling condition of following formulae discovery: T=mt.After calculating is complete, records the time-out time of each group polling condition, and record result is stored in an overtime form.
Preferably, in embodiments of the present invention, after step S106 is according to the actual time-out time of corresponding relation determination request of access, this data processing method can also comprise:
S18, obtains the max-timeout time preset;
S20, judges whether actual time-out time is greater than the max-timeout time;
S22, if judge that actual time-out time is greater than the max-timeout time, then using the max-timeout time as final actual time-out time; And
S24, if judge that actual time-out time is not more than the max-timeout time, then using actual time-out time as final actual time-out time.
Because the time-out time obtained according to above-mentioned enforcement may be very large, and then cause system resource to be consumed excessively, therefore, in order to avoid the time-out time of the SQL of dynamic calculation is excessive, first appointment max-timeout time Tmax is needed, if the time-out time of the SQL of dynamic calculation is no more than this max-timeout time Tmax, then using the time-out time of the SQL of dynamic calculation as final actual time-out time, otherwise, then using the max-timeout time Tmax that specifies as final actual time-out time.
The present invention is elaborated below with a specific embodiment:
First, the max-timeout time Tmax=5 minute of appointing system; Select the following querying attributes of request of access as the initial conditions determining time-out time, as shown in table 1:
Table 1
The querying attributes of data query number |
Whether there is the querying attributes of filtercondition |
Whether there is the querying attributes of sequence |
For above-mentioned querying attributes, querying attributes due to data query number is the querying attributes of continuous type, therefore, suppose that the possible value of the data query number that this attribute is corresponding is in actual applications 0-500, suppose that the time interval of sliding-model control is 100, by data query number discretize, then the value of inquiring about number is: 1,100,200,300,400,500.And for the querying attributes of other two discretizes, their span is: be, no.
For the querying attributes of the discretize of data query number and whether having filtercondition querying attributes and whether having sequence three initial conditions querying attributes of discretize, suppose to be combined as following structure inquiry request successively, and repeatedly inquire about according to these inquiry request, the inquiry obtained equal value record consuming time is as shown in table 2, wherein, suppose that overtime coefficient is 1.2, then can calculate the time-out time under each condition:
Table 2
Suppose there is now following inquiry request: inquiry number is 360, filtercondition whether is had to be no, whether sequence is yes, so in order to obtain the time-out time of this inquiry request, need to inquire about number discretize, because what determine is time-out time herein, therefore need upwards to get discrete point, namely inquire about number and get 400, and then discrete point corresponding to querying condition is as follows: inquiry number is 400, whether be yes, the time-out time that can inquire in upper table now according to this condition should be set to 840ms if having filtercondition to be no whether sequence.
It should be noted that, can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing, and, although show logical order in flow charts, but in some cases, can be different from the step shown or described by order execution herein.
According to embodiments of the invention, provide a kind of data processing equipment of accessing time-out.It should be noted that, the data processing method of the access time-out that the embodiment of the present invention provides can be performed by the data processing equipment of the access time-out of the embodiment of the present invention, and the data processing equipment of the access time-out of the embodiment of the present invention also may be used for the data processing method of the access time-out performing the embodiment of the present invention.
Fig. 2 is the schematic diagram of the data processing equipment of access time-out according to the embodiment of the present invention.As shown in Figure 2, this device comprises: the first acquiring unit 10, second acquisition unit 20 and the first determining unit 30.
First acquiring unit 10 is for obtaining the querying attributes of request of access, and querying attributes is for characterizing the type of request of access.
It should be noted that, in embodiments of the present invention, request of access can be the request of access of accessing database, and such as, it can be SQL query request.Querying attributes can comprise one or more, the present invention does not do any restriction to it, such as, its can be data query number attribute, whether there is the attribute of filtercondition, whether have the attribute etc. of sequence, accordingly, the type characterizing request of access can be the request of data query number respectively, whether has the request of filtercondition, whether have the request etc. of sequence.
Due to data query number, whether there is filtercondition and whether have sequence etc. to be the principal element affecting query time, therefore, obtain request of access querying attributes after, can mainly using querying attributes corresponding for above-mentioned several key element as the initial conditions determining time-out time.
Second acquisition unit 20 is for obtaining the corresponding relation of querying attributes and time-out time, and time-out time is the time exceeding default access latency.
Time-out time is the time exceeding default access latency, also, after client initiates request of access, and the time-out time of database response.During enforcement, time-out time corresponding to each querying attributes can be pre-determined according to historical query record or experimental data, and the corresponding relation of the time-out time obtained and each querying attributes and corresponding time-out time is stored in overtime form, use in order to during actual access database.
First determining unit 30 is for the actual time-out time according to corresponding relation determination request of access.
During enforcement, when needing the time-out time determining an inquiry request, first can obtain each querying attributes of this inquiry request, i.e. each querying condition, and in above-mentioned overtime form, search corresponding time-out time according to these querying conditions, and the actual time-out time using the time-out time of this correspondence as request of access, also, the time-out time of actual queries.
Pass through the embodiment of the present invention, due to can according to the querying attributes of each request of access, dynamically determine a time-out time for data base querying, thus as far as possible many inquiries can be allowed not overtime, and avoid consuming system resource excessively, reach and determine that time-out time is to meet the effect of the requirement of different querying conditions dynamically. as far as possible
Preferably, in embodiments of the present invention, this data processing equipment can also comprise: the first judging unit.First judging unit is used for before the corresponding relation obtaining querying attributes and time-out time, judges that whether querying attributes is the querying attributes of discretize, wherein, if judge that querying attributes is the querying attributes of discretize, then performs the function of second acquisition unit; If judge that querying attributes is not the querying attributes of discretize, then first sliding-model control is carried out to querying attributes, then perform the function of second acquisition unit.
Because querying attributes can be divided into continuous type querying attributes and discrete type querying attributes according to inquiry meaning, also be, determine that the initial conditions of time-out time can be divided into two classes: continuous type initial conditions and discrete type initial conditions, such as, the attribute of data query number is continuous type querying attributes, and whether there is the attribute of filtration and whether have the attribute of sequence to be discrete type querying attributes, thus when implementing, for each continuous type initial conditions, need first by it discretize, re-use the initial conditions after discretize in above-mentioned overtime form, search corresponding time-out time, and using this time-out time found as the time-out time of actual queries, also be, final time-out time.
Wherein, the treatment scheme of discretize is as follows: first determine the maximal value that this continuous type initial conditions is inquired about in systems in which and minimum value, gather some points according to predetermined interval between a minimum value and a maximum value again, put the discrete form of corresponding value as this continuity initial conditions with these.
Further preferably, in embodiments of the present invention, the querying attributes of discretize can comprise: the first querying attributes and the second querying attributes, query composition attribute is the querying attributes of the combination of the first querying attributes and the second querying attributes, like this, this data processing equipment can also comprise: the second determining unit.Second determining unit may be used for by determining the time-out time corresponding with the querying attributes of discretize with lower device, and wherein, the second determining unit can have: the first enquiry module, the first logging modle and the first determination module.First enquiry module is used for carrying out actual queries according to the query composition attribute of request of access; First logging modle is used for the time-out time of record access request in actual queries; And first determination module be used for the time-out time of request of access in actual queries as the time-out time corresponding with the querying attributes of discretize.
Preferably, in embodiments of the present invention, the querying attributes of discretize can comprise: the first querying attributes and the second querying attributes, and query composition attribute is the querying attributes of the combination of the first querying attributes and the second querying attributes, like this, this data processing equipment can also comprise: the 3rd determining unit.3rd determining unit is used for by determining the time-out time corresponding with the querying attributes of discretize with lower device, and wherein, the 3rd determining unit can have: the second enquiry module, the second logging modle, computing module and the second determination module.Second enquiry module is used for carrying out repeatedly actual queries according to the query composition attribute of request of access; Second logging modle is used for the repeatedly time-out time of record access request in actual queries; Computing module is used for being averaging the time to the repeatedly time-out time of request of access in actual queries; And second determination module be used for using averaging time as the time-out time corresponding with the querying attributes of discretize.
During enforcement, can first obtain each initial conditions, for being left intact of initial conditions of inherently discretize, then first sliding-model control is done for the initial conditions of continuous type time itself, obtain the initial conditions of discrete type, then the initial conditions of these discrete types is combined, thus structure inquiry request carries out actual queries, and record the time-out time of each group polling, and calculate the average of these time-out times, to expend time in t using this average as the typical query of this group polling condition, also be, the time-out time corresponding with the querying attributes of discretize.
Further, an overtime Coefficient m can also be determined, the time-out time according to each group polling condition of following formulae discovery: T=mt.After calculating is complete, records the time-out time of each group polling condition, and record result is stored in an overtime form.
Because the time-out time obtained according to above-mentioned enforcement may be very large, and then cause system resource to be consumed excessively, therefore, in order to avoid the time-out time of the SQL of dynamic calculation is excessive, first appointment max-timeout time Tmax is needed, if the time-out time of the SQL of dynamic calculation is no more than this max-timeout time Tmax, then using the time-out time of the SQL of dynamic calculation as final actual time-out time, otherwise, then using the max-timeout time Tmax that specifies as final actual time-out time.
It should be noted that, in the above embodiment of the present invention, 3rd determining unit and the second determining unit can be same unit, and accordingly, the first enquiry module, the first logging modle and the first determination module can be respectively the second enquiry module, the second logging modle and the second determination module.
Preferably, in embodiments of the present invention, this data processing equipment can also comprise: the 3rd acquiring unit, the second judging unit,
3rd acquiring unit, for after according to the actual time-out time of corresponding relation determination request of access, obtains the max-timeout time preset;
Second judging unit, for judging whether actual time-out time is greater than the max-timeout time;
4th determines form unit, for when judging that actual time-out time is greater than the max-timeout time, using the max-timeout time as final actual time-out time; And
5th determining unit, for when judging that actual time-out time is not more than the max-timeout time, using actual time-out time as final actual time-out time.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of calculation element, thus, they can be stored and be performed by calculation element in the storage device, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.