CN104408110A - Method, device and system for requesting data - Google Patents

Method, device and system for requesting data Download PDF

Info

Publication number
CN104408110A
CN104408110A CN201410681632.9A CN201410681632A CN104408110A CN 104408110 A CN104408110 A CN 104408110A CN 201410681632 A CN201410681632 A CN 201410681632A CN 104408110 A CN104408110 A CN 104408110A
Authority
CN
China
Prior art keywords
database
inquiry request
journey
association
testing result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201410681632.9A
Other languages
Chinese (zh)
Other versions
CN104408110B (en
Inventor
王院生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qianxin Technology Group Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201410681632.9A priority Critical patent/CN104408110B/en
Publication of CN104408110A publication Critical patent/CN104408110A/en
Application granted granted Critical
Publication of CN104408110B publication Critical patent/CN104408110B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques

Abstract

The invention discloses a method, a device and a system for requesting data, and relates to the technical field of internets, which aims at solving the problem of paralysis caused by excessive query requests of a database. The method comprises the following steps of establishing a first coroutine corresponding to the database, detecting the load state of the database through the first coroutine, and obtaining the detection result; when an query request reported by a terminal is received, establishing a second coroutine corresponding to the query request, and obtaining the detection result from the first coroutine through the second coroutine; when the detection result represents that the database is in the overload state, stopping forwarding the query request to the database. The method is mainly applied to postgresql database systems.

Description

The method of request of data, Apparatus and system
Technical field
The present invention relates to Internet technical field, particularly relate to a kind of method of request of data, Apparatus and system.
Background technology
Inner in LAN (Local Area Network), control desk, as the bridge between terminal and database, is responsible for receiving, management, forwards the inquiry request that terminal sends to database, and the query contents returned by database is handed down to terminal.The process resource that query task distributed to by usual database server is limited, in LAN (Local Area Network), the instantaneous inquiry request quantity (follow-up referred to as request Concurrency number) reported is then likely larger, in this case, the process resource of database server all cannot respond all inquiry request, now the resource load pressure of database is comparatively large, easily paralyses.And just cannot recover once database generation paralysis, database server can only be restarted, thus the normal operation of local area network causes interruption.
Along with the continuous growth of large enterprise, institutional settings local area network scale demand, the terminal quantity in LAN (Local Area Network) will get more and more, and the inquiry request quantity in net also can correspondingly increase, and the frequency of therefore database paralysis can be more and more higher.For catenet, particularly multistage network, the frequent paralysis of Database Systems will certainly have influence on the stability of network, reduces the operational efficiency of LAN (Local Area Network).So, how Database Systems are effectively safeguarded, the query demand under large-scale network environment can be tackled, just become a difficult problem of pendulum before technician.
Summary of the invention
In view of this, the invention provides a kind of method of request of data, Apparatus and system, the problem that database occurs because inquiry request is too much to paralyse can be solved.
For solving the problems of the technologies described above, on the one hand, the invention provides a kind of method of request of data, the method comprises:
Set up first association's journey of correspondence database, and detected by the load condition of first association's journey to database, obtain testing result;
When receiving the inquiry request of terminal to report, setting up second association's journey of corresponding inquiry request, and obtaining testing result by second association's journey to first association's journey;
If testing result characterization database is in overload state, then stop to the request of database forwarding inquiries.
On the other hand, present invention also offers a kind of device of request of data, this device comprises:
Detecting unit, for setting up first association's journey of correspondence database, and being detected by the load condition of first association's journey to database, obtaining testing result;
Acquiring unit, for when receiving the inquiry request of terminal to report, sets up second association's journey of corresponding inquiry request, and obtains testing result by first association's journey that second association's journey is set up to detecting unit;
Processing unit, for when the testing result characterization database that acquiring unit obtains is in overload state, stops to the request of database forwarding inquiries.
Again on the one hand, present invention also offers a kind of system of request of data, this system comprises: terminal, control desk and database server; Wherein, control desk comprises the device as aforementioned second aspect indication;
Terminal, for reporting inquiry request to control desk, inquiry request is used for carrying out data query to database server request;
Control desk, for when testing result characterization database is in normal load state, to the request of database server forwarding inquiries, and when testing result characterization database is in overload state, stops to the request of database server forwarding inquiries;
Database server, for when testing result characterization database is in normal load state, receives the inquiry request that control desk forwards, and responds inquiry request, return query contents;
Control desk, also for receiving the query contents that database server returns, and is handed down to terminal by query contents.
The method of request of data provided by the invention, Apparatus and system, resident first association's journey can be set up carry out continuing to detect to the load condition of database, and the testing result of acquisition is shared to the second association's journey set up into inquiry request, so that the latter to forward inquiry request based on different testing results or cancels the process of forwarding.Compared with prior art, the present invention can suspend the forwarding of inquiry request when database is in overload state, can give the database sufficient time processes in time existing request and discharges and process resource accordingly, prevents database from too much paralysing because inquiry request thus.
Above-mentioned explanation is only the general introduction of technical solution of the present invention, in order to technological means of the present invention can be better understood, and can be implemented according to the content of instructions, and can become apparent, below especially exemplified by the specific embodiment of the present invention to allow above and other objects of the present invention, feature and advantage.
Accompanying drawing explanation
By reading hereafter detailed description of the preferred embodiment, various other advantage and benefit will become cheer and bright for those of ordinary skill in the art.Accompanying drawing only for illustrating the object of preferred implementation, and does not think limitation of the present invention.And in whole accompanying drawing, represent identical parts by identical reference symbol.In the accompanying drawings:
Fig. 1 shows the method flow diagram of a kind of request of data provided by the invention;
Fig. 2 shows the method flow diagram of another kind of request of data provided by the invention;
Fig. 3 shows the method flow diagram of another request of data provided by the invention;
Fig. 4 shows the schematic diagram of waiting list provided by the invention;
Fig. 5 (a) and Fig. 5 (b) shows the schematic diagram of mixing forwarding inquiries provided by the invention request;
Fig. 6 shows the structural representation of the device of a kind of request of data provided by the invention;
Fig. 7 shows the structural representation of the device of another kind of request of data provided by the invention;
Fig. 8 shows the system schematic of a kind of request of data provided by the invention.
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.
Paralyse because inquiry request is too much for preventing database, embodiments provide a kind of method of request of data, the method can suspend the forwarding of inquiry request when database is in overload state, make database have the sufficient time to process existing request thus.As shown in Figure 1, the method comprises:
101, set up first association's journey of correspondence database, and detected by the load condition of first association's journey to database, obtain testing result.
When starting database, independently first association's journey set up by control desk, is specifically designed to and detects the load condition of database.First association's journey in the present embodiment is a kind of resident association journey, and namely this association's journey is set up when data base initialize and survived in the process of whole data query.The no matter control desk inquiry request whether receiving terminal reports, as long as the life cycle of database does not terminate, so first association's journey will keep existing state always, carries out continuing to detect to the resource load condition of database.
It should be noted that the lasting detection described in the present embodiment refers to a kind of process keeping detected state, be not defined in uninterrupted situation about detecting.In actual applications, the mode of above-mentioned lasting detection also comprises: carry out periodically detecting or irregularly detecting according to the instruction of control desk, carry out automatically detecting again or based on certain preset strategy/rule according to certain default time interval, the present embodiment does not assist the opportunity of journey Test database state, number of times or frequency to limit to first.
In the present embodiment, can reflect that the resource parameters of database resource load condition can be: internal memory uses accounting, central processing unit (Central Processing Unit is called for short CPU) uses accounting, disk read-write interface to use accounting etc.Certainly, resource parameters also can be the combination of above-mentioned several resource parameters.First association's journey can send request of data by the interface routine finished writing in advance to database, obtains above-mentioned resource parameters (or combination of resource parameters), and by obtaining the testing result of database load state with the mode of preset standard threshold value comparison.
Generally, whole process resources can not all be distributed to data query task by database server usually, and therefore in actual applications, the use accounting of above-mentioned each resource parameters should be the use accounting under its actual Resourse Distribute scope.Such as, suppose for the database server of 4G internal memory, if it distributes 1G memory source for the treatment of inquiry request, so when taking 0.4G internal memory when pre-treatment inquiry request, its physical memory uses accounting to should be 40%, but not 10%.
The detection mode of above-mentioned Gains resources parameter is one of a kind of implementation of the present embodiment, in practical application, control desk also can be concerned about the concrete resource parameters of database, but directly the response speed of database is detected from result aspect, if the response speed of database excessively slow (used time is longer), then show that the resource load of database has exceeded normal ability to bear.In other words, what the response speed of database comprehensively can embody its inner various resource takies situation, therefore in actual applications, tests and usually implements more easy, and can obtain more desirable Detection results to response speed.Follow-up the focusing on of the present embodiment is described for this kind of detection mode.
In the present embodiment, the testing result that control desk obtains can have the different forms of expression.In a kind of implementation of the present embodiment, testing result can be one can the notch level of descriptive data base load condition, such as " free time ", " busy ", " saturated ", " overload " etc., different gears is for reflecting the load of machinery systems that database is different; Or in the another kind of implementation of the present embodiment, testing result also can be a simple numerical value, such as 45,67 etc., the size of this numerical value is for reflecting the load of machinery systems of database, for this form, need to ensure that this numerical value has the interval that exists border, the up-and-down boundary in this interval should two kinds of extreme loads degree (such as 0 load and overload etc.) of correspondence database.And in order to simplify the enforcement in practical application, in the third implementation of the present embodiment, testing result is only divided into " normal load state " and " overload state " two grades, boundary between two grades can be considered and set to draw in conjunction with the combined factors such as network size, database performance by keeper, also can be calculated voluntarily according to the rule and policy preset by control desk, and can dynamic conditioning be carried out.Owing to being convenient to realize, therefore the present embodiment is follow-up is that example is described by testing result in a third form.
102, when receiving the inquiry request of terminal to report, setting up second association's journey of corresponding inquiry request, and obtaining testing result by second association's journey to first association's journey.
Directly inquiry request to be transmitted to database different from control desk in prior art, in the present embodiment, control desk is before the request of database forwarding inquiries, first the testing result by obtaining database positioning to first association's journey to the second association's journey that should ask is needed, when database is in overload state, perform following step 103, stop forwarding inquiry request, alleviate the load pressure of database thus.
Second association's journey in this step is set up for inquiry request and assists association's journey of journey independent of aforementioned first.Control desk receives several inquiry request and just sets up several second association's journeys, and each bar second is assisted between journey does not have essence to associate.In the present embodiment, second association's journey is set up based on reporting of inquiry request, terminates after inquiry request obtains inquiry response or when inquiry stops, and for the time to live of first association's journey, the time to live of second association's journey is usually shorter.
In the present embodiment, first association's journey is exclusively used in the load condition of Test database, not responsible to second association's journey transmission testing result, and therefore, second association's journey, when to the request of database forwarding inquiries, needs initiatively to ask for testing result to first association's journey.In practical application, the request Concurrency number of control desk side is usually more, therefore second association's journey that each inquiry request is corresponding needs to ask for testing result respectively to first association's journey, the action that each bar association journey asks for testing result is separate, and the present embodiment does not limit all second association's journeys and asks for testing result simultaneously.In addition, as previously mentioned, first detection of association's journey to database is continuation, based on the continuous change of database load state, the testing result that first association's journey obtains at different time may there are differences, and the opportunity that second association's journey asks for testing result is different separately, therefore in practical application, the testing result that different second association's journey obtains may be different, such as, second association's journey of request 1 is " overload state " in the testing result that the last period obtains, and asks 2 second association's journey to be then " normal load state " in the testing result that subsequent period obtains.Based on different testing results, the result of different inquiry request is had nothing in common with each other certainly.
If 103 testing result characterization databases are in overload state, then stop to the request of database forwarding inquiries.
When the testing result that second association's journey obtains be database be in overload state time, control desk stops inquiry request corresponding to this second association's journey to send to database.For the subsequent treatment of this inquiry request, in a kind of implementation of the present embodiment, this inquiry request can abandon by control desk, and notification terminal, for terminal, be equivalent to this querying flow and terminate; And in the another kind of implementation of the present embodiment, control desk also " can hang up " this inquiry request, be transmitted to database again when the load pressure of database alleviates.
In this step, control desk can set up separately the operation that a process association Cheng Zhihang abandoned or hung up request, in practical application, control desk can set up separately a process association journey for the request to be processed of each need, and terminate this process association journey after processing is completed, also can reside one and always assist journey, always assist Cheng Tongyi to process each inquiry request by this.
In practical application, no matter set up separately process association's journey or set up and always assist journey, all can take control desk part process resource.For avoiding the meaningless expense of control desk process resource as far as possible, in a kind of implementation of the present embodiment, control desk can utilize existing second association Cheng Zhihang to abandon, hang up the operations such as request.
If 104 testing result characterization databases are in normal load state, then to the request of database forwarding inquiries.
For the testing result obtained in step 102, if its characterization database is in normal load state, so represent that the process resource of database exists part idle, can not paralyse because of increasing inquiry request further, therefore in the case, the inquiry request of reception can send to database to respond by control desk, and the query contents returned by database is transmitted to terminal, completes once conventional data query flow process thus.
Similar to step 103, in a kind of implementation of the present embodiment, control desk also can be completed by second association's journey of corresponding requests and send the operation such as inquiry request, forwarding inquiries content.
In prior art, control desk, as the intermediary between terminal and database, is only responsible for sending to database to process the inquiry request of terminal to report, even if the process resource of database is in an emergency, occur larger load pressure, control desk also can not stop sending inquiry request.Therefore database is easy to paralyse because resource load is excessive, and just cannot recover once database generation paralysis, can only restart, make the normal operation of LAN (Local Area Network) be interrupted thus to database server.And in the present embodiment, control desk can detect the load condition of database, when database load is excessive, suspend and send inquiry request, give the chance of the existing request of database digestion thus, prevent database from paralysing, and then improve the stability of LAN (Local Area Network) operation.
Secondly, in the present embodiment, control desk can carry out continuing to detect to database by resident first association's journey, and second association's journey " asks for " testing result directly to first association's journey can carry out follow-up process operation.Realize from the angle of technology, second association's journey also can directly detect database, but due to the quantity of second association's journey more, a large amount of detection repeated operates will certainly waste the limited process resource of control desk.The present embodiment can reduce repeating of similar operations by the mentality of designing of " result-sharing ", can reduce the resource overhead of control desk to greatest extent.
3rd, with in prior art by compared with process or thread execution corresponding operating, the present embodiment can by each generic operation of association Cheng Zhihang of more lightweight.Because association's journey belongs to the program of pure backstage execution, the execution that terminal foreground or the complete perception of database server operate less than it, therefore except saving except thread resources, adopts association's journey can also reduce the impact of executable operations on service operation.
Further, as the refinement to Fig. 1 step 101, in another embodiment of the invention, control desk can be detected by the first association's response speed of journey to database, thus obtain can the testing result of concentrated expression database resource state.Specifically as shown in Figure 2, which comprises:
201, state-detection message is sent by first association's journey to database.
The data message of this state-detection message with traditional on message format is identical, and its header needs the IP address of carrying control desk and database, using as source IP address and object IP address.But with traditional data message unlike, this state-detection message is only for the response speed of test database, its data content there is no practical significance for state, therefore keeper arbitrarily can arrange the data content of message, such as, its data content is set to " Hello DB " or " Test ".
It should be noted that, because the content of state-detection message is without practical significance, therefore consider from the angle of saving network transmission bandwidth, the data content of message should not arrange excessive.In practical application, it is comparatively suitable that its data volume size controls below a few crossed joint.
As previously mentioned, be a lasting process to the detection of database positioning, in the whole life cycle of database, control desk regularly or at random can carry out repeatedly state-detection, therefore, the number of times that control desk sends state-detection message usually also can not be limited to once or minority several times.In practical application, the opportunity that the opportunity that control desk sends state-detection message is detected by its starting state determined, the transmission times of state-detection message is then no less than the number of times of state-detection usually.
202, local timing is started and the response message of wait-receiving mode database.
203, receive the response message of database and stop timing.
When Initialize installation, keeper can the pre-set database content of replying, and similar with state-detection message, the content of response message also there is no practical significance, can be set to " Im OK " or " So Far So Good " etc. in practical application.
In this step, control desk starts local timing when sending state-detection message, its object is to calculate database and returns the consuming time of response message.In a kind of implementation of the present embodiment, control desk can call timer functional interface by first association's journey (can certainly set up independent association's journey) and start timing.In addition, control desk also by the mode of reading system clock, can obtain and send the moment value that namely state-detection message receives response message, and consuming time based on the response of the difference acquisition database of two moment value.For the latter's implementation, in practical application, control desk can read the atomic clock on hardware mainboard, and also can read the system clock of network side, this enforcement does not limit this.
204, to the response of database, the stipulated time with presetting consuming time compares.
If the response of database is consuming time be greater than the default stipulated time, then show the response speed that the response speed of database does not reach control desk and requires, perform step 205; If the response of database is consuming time be less than or equal to the default stipulated time, then show the response speed that the response speed of database reaches control desk and requires, perform step 206.
It should be noted that, for the setting of stipulated time, except considering that terminal is to except the sensitivity of time delay, also normally consuming time involved by message transmissions should be taken into account.In practical application, arranging of stipulated time generally can be limited to ms rank, in particular cases (such as network can not put up with a bit time delay), the setting of this stipulated time also can level off to 0ms, and the present embodiment does not limit the size of stipulated time.
205, determine that database is in overload state.
206, determine that database is in normal load state.
It should be noted that, in practical application, when database load is larger, may there is database cannot the situation of feedback response message.Now, control desk wait-for-response message unrealistic simply.Therefore for this kind of situation, should formulate and a set ofly remedy scheme.In a kind of implementation of the present embodiment, control desk can allow Administrator duration threshold value, and this threshold value generally needs to be greater than the aforementioned stipulated time (such as 500ms, 1000ms etc.).When control desk timing arrives this duration threshold value, do a condition adjudgement, if also do not receive the response message of Database Feedback, then control desk stops timing, and performs step 205, directly determines that database is in overload state.But for the mode of reading system clock, because it does not relate to local timing, control desk cannot learn whether the consuming time of database exceedes duration threshold value, therefore this implementation be not suitable for this and remedy scheme.
In practical application, after stopping sends inquiry request to database, if database still cannot digest existing request, so can cannot normally recover in decision data storehouse.In such cases, for ensureing the normal operation of LAN (Local Area Network), can restart database server.Database after restarting is by all for release occupied process resources, therefore, it is possible to the normal process of recovery to inquiry request.
When judging whether database cannot normally recover, can using time dimension as reference standard.Control desk obtains a default duration threshold value, and after sending state-detection message to database, control desk starts local timing.If do not receive the response message of database after arriving this duration threshold values yet, then judge that database cannot normally recover, restart database server.In the present embodiment, above-mentioned duration threshold value can be greater than aforementioned duration threshold value, but the present embodiment does not limit its concrete numerical value.
When restarting database server, control desk can call the instruction of restarting finished writing in advance restarts database server.Because control desk remains first association's journey for database, therefore control desk can transfer the API of restarting database server by first association's journey, obtains and performs instruction of restarting wherein.Certain the present embodiment does not limit control desk by other association's journey or thread dispatching instruction of restarting.
Further, when the inquiry request in database occur congested, cause restarting database server still cannot discharge whole occupied resource completely time, control desk can also restart control desk server further voluntarily.After restarting control desk server, all inquiry request that control desk has received are all dropped, and discharge occupied process resource thus.In addition, when re-establishing the connection with terminal, control desk also can limit the number of terminals of connection, assists the load pressure alleviating database thus further.To aforementioned to restart database server similar, control desk also can be restarted by calling corresponding instruction of restarting voluntarily.
Above embodiment is illustrated the Different treatments that control desk performs for different testing result.In an embodiment below, by provide a kind of after database recovery normal load state for receive request processing mode.Concrete, as shown in Figure 3, the method comprises:
301, set up first association's journey of correspondence database, and detected by the load condition of first association's journey to database, obtain testing result.
In the present embodiment, this testing result characterization database is in overload state.
302, when receiving the inquiry request of terminal to report, setting up second association's journey of corresponding inquiry request, and obtaining testing result by second association's journey to first association's journey.
303, stop to the request of database forwarding inquiries.
304, each second association Cheng Jixu obtains testing result to first association's journey.
In this step, when stopping forwarding when inquiry request factor data bank overload, except request is directly abandoned, can also by control desk by each inquiry request " hang-up ".When database recovery normal condition, then continue the inquiry request of " hang-up " to be again transmitted to database.
It should be noted that, when database is in overload state, for the inquiry request received, control desk can be hung up, and waits for and again forwarding.But for the inquiry request that terminal newly reports, control desk should be refused, otherwise the number of requests that control desk is assembled will constantly increase, and ties up the process resource of control desk.
Owing to relating to the load condition redefining database, therefore each second association's journey needs constantly to obtain new testing result.In practical application, each bar second assists journey timing (such as every 100ms) to obtain testing result to first association's journey.When the testing result reflection database recovery normal load state got, perform step 305, forwarding inquiries request again; And when the testing result reflection database got still is in overload state, continue to perform this step, wait testing result next time to be obtained.In practical application, the time interval that second association's journey obtains testing result can assist the time interval of journey Test database state to be consistent with first, namely ensure that the testing result that first association's journey obtains at every turn all can be obtained by the journey timing of the second association, enable inquiry request be forwarded to database as early as possible and process.
305, when database recovery normal load state, to the request of database forwarding inquiries.
When database recovery normal load state, the request of wait forwarding inquiries sends to database to respond by second association's journey by control desk, obtains query contents.
Below, a kind of implementation of Fig. 3 is provided:
Control desk sets up a waiting list in advance to deposit the inquiry request be suspended.When database is in overload state, control desk inquiry request is joined in waiting list to carry out etc. to be forwarded.And when after database recovery normal load state, the inquiry request in waiting list, from the head of the queue of waiting list, according to the principle of first in first out, is transmitted to database by control desk successively, till waiting list empties.Exemplary, the inquiry request in waiting list can be as shown in Figure 4.
Further, when waiting list is longer, the inquiry request newly reported for preventing terminal was waited for for a long time, in a kind of improved procedure, control desk can also carry out mixing to the inquiry request in waiting list and the new inquiry request received and forward, and carries out parallel taking into account thus to both requests.Exemplary, as shown in Figure 5, request A represents the inquiry request in waiting list, the inquiry request that request B GC group connector newly reports.Control desk to two kinds of requests carry out intersection forward, such as, shown in Fig. 5 (a) " ABABABA ... " mode.Certainly, control desk also can according to shown in Fig. 5 (b) " AAABBBAAABBB ... " mode is carried out batch and is intersected forwarding.The present embodiment does not limit the concrete hybrid mode that control desk adopts.
Further, for the above-mentioned implementation adding queue, the team that joins the team out of the foundation of queue and maintenance and request all can cause certain EMS memory occupation to control desk.In the more simple implementation of one, control desk can cancel the foundation of waiting list, then adopts the mode seized at random to carry out the forwarding of inquiry request.In this fashion, second association's journey of each request constantly obtains up-to-date detection request according to the implementation of abovementioned steps 304.When second association's Cheng Faxian database recovery normal load state, carry out request forward immediately.The execution that each bar second thread seizes forwarding is separate, and the sequencing of request forward starts by the second thread the sequencing seized and determines.Further, after database recovery normal load state, for the inquiry request that terminal newly reports, also can participate in seizing forwarding at random, with the chance together being seized forwarding by the inquiry request of " hang-up ".
It should be noted that, in practical application, terminal can not obtain the information of characterization database load condition, and therefore terminal cannot learn whether database is in overload state.In foregoing embodiments, terminal, without the need to being concerned about the load condition of database, only conventionally reports inquiry request, thus there will be a problem, and namely when control desk stops forwarding inquiry request, terminal still constantly reports new inquiry request.When a large amount of inquiry request congested at control desk time, easily cause control desk to collapse.Inquiry request is overstock in a large number for preventing control desk, in another each embodiment of the present invention, when database is in overload state, control desk can issue indication information to each terminal, indicating terminal temporarily stops reporting new inquiry request, makes the number of requests of control desk to be controlled thus.Accordingly, when database recovery normal load state, control desk also can issue indication information to each terminal, and indicating terminal recovers to report inquiry request again.
Further, in existing LAN backbone, usual keeper can be monitored by special man-machine interactive platform local area network.In another embodiment of the present invention, when the load condition of database changes, control desk can also send information, so that corresponding decision is made in keeper's timing to keeper's platform.
Such as, when database is in overload state, control desk can call reserved functional interface and send information to keeper's platform, informs that administrator data storehouse occurs congested, cannot proceed response; When database recovery normal load state, control desk calls identical functional interface equally and sends information to keeper's platform, informs that administrator data storehouse recovers normal, can perform query task.In the present embodiment, control desk can send to keeper's platform the static page being used as prompting, also directly can recall dialog box and export information, or can also in other appointed areas of toolbar or the page display reminding information, the present embodiment does not limit information display form.
Further, as the realization to above-mentioned each embodiment of the method, another embodiment of the present invention additionally provides a kind of device of request of data, and this device can be arranged in control desk, or and set up data interaction relation between control desk, in order to realize aforementioned approaches method embodiment independent of control desk.It should be noted that, the control desk described in the present embodiment also can be a server with Network Management Function in actual applications.As shown in Figure 6, this device comprises: detecting unit 61, acquiring unit 62 and processing unit 63; Wherein,
Detecting unit 61, for setting up first association's journey of correspondence database, and being detected by the load condition of first association's journey to database, obtaining testing result;
Acquiring unit 62, for when receiving the inquiry request of terminal to report, sets up second association's journey of corresponding inquiry request, and obtains testing result by first association's journey that second association's journey is set up to detecting unit 61;
Processing unit 63, for when the testing result characterization database that acquiring unit 62 obtains is in overload state, stops to the request of database forwarding inquiries.
Further, processing unit 63, for when the testing result characterization database that acquiring unit 62 obtains is in normal load state, to the request of database forwarding inquiries.
Further, detecting unit 61, for sending state-detection message by first association's journey to database, if do not receive the response message of database at the appointed time, then testing result is that database is in overload state.
Further, as shown in Figure 7, this device comprises further:
Restart unit 64, for when detecting unit 61 does not receive the response message of database yet after arriving the duration threshold values preset, restart database server; Wherein duration threshold values is greater than the stipulated time.
Further, restart unit 64, for being called and the instruction of restarting of performing database server by first association's journey.
Further, processing unit 63, for after database server recovers normal load state, is transmitted to database again by inquiry request.
Further, as shown in Figure 7, processing unit 63, comprising:
First process subelement 631, for stopping after the request of database forwarding inquiries, joining inquiry request in waiting list, after database server recovers normal load state, the inquiry request in waiting list being transmitted to database.
Further, as shown in Figure 7, processing unit 63, comprising:
Second process subelement 632, for issuing indication information to terminal, indicating terminal reports inquiry request again.
Further, as shown in Figure 7, this device comprises further:
Call unit 65, sends information for calling reserved functional interface.
Further, as the realization to above-mentioned each embodiment of the method, another embodiment of the present invention additionally provides a kind of system of request of data.As shown in Figure 8, this system comprises: terminal 81, control desk 82 and database server 83.Wherein, control desk in actual applications also can for having the server of Network Management Function.This control desk 82 comprises the device as shown in front Fig. 6 or Fig. 7.
Terminal 81, for reporting inquiry request to control desk 82, inquiry request is used for carrying out data query to database server 83 request;
Control desk 82, for when testing result characterization database is in normal load state, to the request of database server 83 forwarding inquiries, and when testing result characterization database is in overload state, stops to the request of database server 83 forwarding inquiries;
Database server 83, for when testing result characterization database is in normal load state, receives the inquiry request that control desk 82 forwards, and responds inquiry request, return query contents;
Control desk 82, also for receiving the query contents that database server 83 returns, and is handed down to terminal 81 by query contents.
In prior art, control desk, as the intermediary between terminal and database, is only responsible for sending to database to process the inquiry request of terminal to report, even if the process resource of database is in an emergency, occur larger load pressure, control desk also can not stop sending inquiry request.Therefore database is easy to paralyse because resource load is excessive, and just cannot recover once database generation paralysis, can only restart, make the normal operation of LAN (Local Area Network) be interrupted thus to database server.And based on the Apparatus and system that the present embodiment provides, control desk can detect the load condition of database, when database load is excessive, suspend and send inquiry request, give the chance of the existing request of database digestion thus, prevent database from paralysing, and then improve the stability of LAN (Local Area Network) operation.
Secondly, based on the Apparatus and system that the present embodiment provides, control desk can carry out continuing to detect to database by resident first association's journey, and second association's journey " asks for " testing result directly to first association's journey can carry out follow-up process operation.Realize from the angle of technology, second association's journey also can directly detect database, but due to the quantity of second association's journey more, a large amount of detection repeated operates will certainly waste the limited process resource of control desk.The present embodiment can reduce repeating of similar operations by the mentality of designing of " result-sharing ", can reduce the resource overhead of control desk to greatest extent.
3rd, with in prior art by compared with process or thread execution corresponding operating, the Apparatus and system that the present embodiment provides can by each generic operation of association Cheng Zhihang of more lightweight.Because association's journey belongs to the program of pure backstage execution, the execution that terminal foreground or the complete perception of database server operate less than it, therefore except saving except thread resources, adopts association's journey can also reduce the impact of executable operations on service operation.
Embodiments of the invention also disclose:
A kind of method of A1, request of data, is characterized in that, described method comprises:
Set up first association's journey of correspondence database, and detected by the load condition of described first association's journey to database, obtain testing result;
When receiving the inquiry request of terminal to report, set up second association's journey of corresponding described inquiry request, and obtain described testing result by described second association's journey to described first association's journey;
If described testing result characterization database is in overload state, then stop forwarding described inquiry request to described database.
A2, method according to claim A1, it is characterized in that, if described testing result characterization database is in normal load state, then described method comprises further:
Described inquiry request is forwarded to described database.
A3, method according to claim A1, is characterized in that, describedly detected by the load condition of described first association's journey to database, obtains testing result, comprising:
State-detection message is sent to described database by described first association's journey;
If do not receive the response message of database at the appointed time, then described testing result is that database is in overload state.
A4, method according to claim A3, is characterized in that, if do not receive the response message of database yet after arriving the duration threshold values preset, then described method comprises further:
Restart database server;
Wherein said duration threshold values is greater than the described stipulated time.
A5, method according to claim A4, is characterized in that, described in restart database server, comprising:
Call by described first association's journey and perform the instruction of restarting of described database server.
A6, method according to claim A1, is characterized in that, after described database server recovers normal load state, described method comprises further:
Described inquiry request is transmitted to described database again.
A7, method according to claim A6, is characterized in that, described described inquiry request is transmitted to described database again, comprising:
After stopping forwards described inquiry request to described database, described inquiry request is joined in waiting list;
After described database server recovers normal load state, the inquiry request in described waiting list is transmitted to described database.
A8, method according to claim A6, is characterized in that, described inquiry request is transmitted to described database again, comprises:
Issue indication information to described terminal, indicate described terminal again to report described inquiry request.
A9, method according to claim A1, it is characterized in that, described method comprises further:
Call reserved functional interface and send information.
The device of B10, a kind of request of data, is characterized in that, described device comprises:
Detecting unit, for setting up first association's journey of correspondence database, and being detected by the load condition of described first association's journey to database, obtaining testing result;
Acquiring unit, for when receiving the inquiry request of terminal to report, sets up second association's journey of corresponding described inquiry request, and obtains described testing result by described first association's journey that described second association's journey is set up to described detecting unit;
Processing unit, for when the described testing result characterization database that described acquiring unit obtains is in overload state, stops forwarding described inquiry request to described database.
B11, device according to claim B10, is characterized in that, described processing unit, for when the described testing result characterization database that described acquiring unit obtains is in normal load state, forwards described inquiry request to described database.
B12, device according to claim B10, it is characterized in that, described detecting unit, for sending state-detection message by described first association's journey to described database, if do not receive the response message of database at the appointed time, then described testing result is that database is in overload state.
B13, device according to claim B12, it is characterized in that, described device comprises further:
Restart unit, for when described detecting unit does not receive the response message of database yet after arriving the duration threshold values preset, restart database server; Wherein said duration threshold values is greater than the described stipulated time.
B14, device according to claim B13, is characterized in that, described in restart unit, for calling by described first association's journey and perform the instruction of restarting of described database server.
B15, device according to claim B10, is characterized in that, described processing unit, for after described database server recovers normal load state, described inquiry request is transmitted to described database again.
B16, device according to claim B15, it is characterized in that, described processing unit, comprising:
First process subelement, for after stopping forwards described inquiry request to described database, described inquiry request is joined in waiting list, after described database server recovers normal load state, the inquiry request in described waiting list is transmitted to described database.
B17, device according to claim B15, it is characterized in that, described processing unit, comprising:
Second process subelement, for issuing indication information to described terminal, indicates described terminal again to report described inquiry request.
B18, device according to claim B10, it is characterized in that, described device comprises further:
Call unit, sends information for calling reserved functional interface.
The system of C19, a kind of request of data, is characterized in that, described system comprises: terminal, control desk and database server; Wherein, described control desk comprises the device according to any one of aforementioned claim B10 to B18;
Described terminal, for reporting inquiry request to described control desk, described inquiry request is used for carrying out data query to described database server request;
Described control desk, for when testing result characterization database is in normal load state, forward described inquiry request to described database server, and when testing result characterization database is in overload state, stop forwarding described inquiry request to described database server;
Described database server, for when testing result characterization database is in normal load state, receives the described inquiry request that described control desk forwards, and responds described inquiry request, return query contents;
Described control desk, also for receiving the query contents that described database server returns, and is handed down to described terminal by described query contents.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, in certain embodiment, there is no the part described in detail, can see the associated description of other embodiments.
Be understandable that, the correlated characteristic in said method and device can reference mutually.In addition, " first ", " second " in above-described embodiment etc. are for distinguishing each embodiment, and do not represent the quality of each embodiment.
Those skilled in the art can be well understood to, and for convenience and simplicity of description, the system of foregoing description, the specific works process of device and unit, with reference to the corresponding process in preceding method embodiment, can not repeat them here.
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 microprocessor or digital signal processor (DSP) can be used in practice to realize monitoring according to the Object flow of the embodiment of the present invention method, some or all parts in Apparatus and system some or all functions.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.

Claims (10)

1. a method for request of data, is characterized in that, described method comprises:
Set up first association's journey of correspondence database, and detected by the load condition of described first association's journey to database, obtain testing result;
When receiving the inquiry request of terminal to report, set up second association's journey of corresponding described inquiry request, and obtain described testing result by described second association's journey to described first association's journey;
If described testing result characterization database is in overload state, then stop forwarding described inquiry request to described database.
2. method according to claim 1, is characterized in that, if described testing result characterization database is in normal load state, then described method comprises further:
Described inquiry request is forwarded to described database.
3. method according to claim 1, is characterized in that, is describedly detected by the described first association's load condition of journey to database, obtains testing result, comprising:
State-detection message is sent to described database by described first association's journey;
If do not receive the response message of database at the appointed time, then described testing result is that database is in overload state.
4. method according to claim 3, is characterized in that, if do not receive the response message of database yet after arriving the duration threshold values preset, then described method comprises further:
Restart database server;
Wherein said duration threshold values is greater than the described stipulated time.
5. method according to claim 4, is characterized in that, described in restart database server, comprising:
Call by described first association's journey and perform the instruction of restarting of described database server.
6. method according to claim 1, is characterized in that, after described database server recovers normal load state, described method comprises further:
Described inquiry request is transmitted to described database again.
7. method according to claim 6, is characterized in that, described described inquiry request is transmitted to described database again, comprising:
After stopping forwards described inquiry request to described database, described inquiry request is joined in waiting list;
After described database server recovers normal load state, the inquiry request in described waiting list is transmitted to described database.
8. method according to claim 6, is characterized in that, described inquiry request is transmitted to described database again, comprises:
Issue indication information to described terminal, indicate described terminal again to report described inquiry request.
9. a device for request of data, is characterized in that, described device comprises:
Detecting unit, for setting up first association's journey of correspondence database, and being detected by the load condition of described first association's journey to database, obtaining testing result;
Acquiring unit, for when receiving the inquiry request of terminal to report, sets up second association's journey of corresponding described inquiry request, and obtains described testing result by described first association's journey that described second association's journey is set up to described detecting unit;
Processing unit, for when the described testing result characterization database that described acquiring unit obtains is in overload state, stops forwarding described inquiry request to described database.
10. a system for request of data, is characterized in that, described system comprises: terminal, control desk and database server; Wherein, described control desk comprises the device according to any one of aforementioned claim 10 to 18;
Described terminal, for reporting inquiry request to described control desk, described inquiry request is used for carrying out data query to described database server request;
Described control desk, for when testing result characterization database is in normal load state, forward described inquiry request to described database server, and when testing result characterization database is in overload state, stop forwarding described inquiry request to described database server;
Described database server, for when testing result characterization database is in normal load state, receives the described inquiry request that described control desk forwards, and responds described inquiry request, return query contents;
Described control desk, also for receiving the query contents that described database server returns, and is handed down to described terminal by described query contents.
CN201410681632.9A 2014-11-24 2014-11-24 The method, apparatus and system of request of data Active CN104408110B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410681632.9A CN104408110B (en) 2014-11-24 2014-11-24 The method, apparatus and system of request of data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410681632.9A CN104408110B (en) 2014-11-24 2014-11-24 The method, apparatus and system of request of data

Publications (2)

Publication Number Publication Date
CN104408110A true CN104408110A (en) 2015-03-11
CN104408110B CN104408110B (en) 2018-11-09

Family

ID=52645741

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410681632.9A Active CN104408110B (en) 2014-11-24 2014-11-24 The method, apparatus and system of request of data

Country Status (1)

Country Link
CN (1) CN104408110B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105117291A (en) * 2015-06-30 2015-12-02 百度在线网络技术(北京)有限公司 Method and system adjusting operation quantity of message push executor
CN106656604A (en) * 2016-12-23 2017-05-10 郑州云海信息技术有限公司 Microservice request management method, microservice controller and high-concurrence microservice architecture
WO2019169724A1 (en) * 2018-03-09 2019-09-12 平安科技(深圳)有限公司 Server concurrency control method and device, computer device, and storage medium
CN110888947A (en) * 2018-09-10 2020-03-17 北京嘀嘀无限科技发展有限公司 Service request processing method and system
CN111814024A (en) * 2020-08-14 2020-10-23 北京斗米优聘科技发展有限公司 Distributed data acquisition method, system and storage medium
CN112181600A (en) * 2020-10-21 2021-01-05 朱领军 Cloud computing resource management method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6405045B1 (en) * 1996-11-30 2002-06-11 Hyundai Electronics Inds. Co. Ltd. Dynamic overload control device and method in digital mobile communication system
CN1756164A (en) * 2004-09-27 2006-04-05 松下电器产业株式会社 Packet reception control device and method
CN101394405A (en) * 2008-10-22 2009-03-25 金蝶软件(中国)有限公司 Method and apparatus for data request processing
CN102170422A (en) * 2010-02-25 2011-08-31 腾讯科技(深圳)有限公司 Method, device and system for inquiring node
CN103838849A (en) * 2014-02-13 2014-06-04 北京数字天域科技股份有限公司 Information query method, device and system and data processing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6405045B1 (en) * 1996-11-30 2002-06-11 Hyundai Electronics Inds. Co. Ltd. Dynamic overload control device and method in digital mobile communication system
CN1756164A (en) * 2004-09-27 2006-04-05 松下电器产业株式会社 Packet reception control device and method
CN101394405A (en) * 2008-10-22 2009-03-25 金蝶软件(中国)有限公司 Method and apparatus for data request processing
CN102170422A (en) * 2010-02-25 2011-08-31 腾讯科技(深圳)有限公司 Method, device and system for inquiring node
CN103838849A (en) * 2014-02-13 2014-06-04 北京数字天域科技股份有限公司 Information query method, device and system and data processing method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105117291A (en) * 2015-06-30 2015-12-02 百度在线网络技术(北京)有限公司 Method and system adjusting operation quantity of message push executor
CN106656604A (en) * 2016-12-23 2017-05-10 郑州云海信息技术有限公司 Microservice request management method, microservice controller and high-concurrence microservice architecture
WO2019169724A1 (en) * 2018-03-09 2019-09-12 平安科技(深圳)有限公司 Server concurrency control method and device, computer device, and storage medium
CN110888947A (en) * 2018-09-10 2020-03-17 北京嘀嘀无限科技发展有限公司 Service request processing method and system
CN111814024A (en) * 2020-08-14 2020-10-23 北京斗米优聘科技发展有限公司 Distributed data acquisition method, system and storage medium
CN112181600A (en) * 2020-10-21 2021-01-05 朱领军 Cloud computing resource management method and system

Also Published As

Publication number Publication date
CN104408110B (en) 2018-11-09

Similar Documents

Publication Publication Date Title
CN104408110A (en) Method, device and system for requesting data
CN106909411B (en) File updating method and device
US20170206229A1 (en) Distributed and optimized garbage collection of exported data objects
US9374425B2 (en) Behavior based client selection for disparate treatment
CN104219316A (en) Method and device for processing call request in distributed system
CN105760240A (en) Distributed task processing method and device
JPS61500751A (en) Method for stopping program processes in multiprocessing systems
CN107404540B (en) Data synchronization method and device
CN104077212A (en) Pressure test system and method
CN111367693B (en) Method, system, device and medium for scheduling plug-in tasks based on message queue
CN106095483A (en) The Automation arranging method of service and device
CN102098233B (en) Method and system for controlling communication window in instant messenger
CN110716793A (en) Execution method, device, equipment and storage medium of distributed transaction
CN109062982B (en) Financial data interaction method and device, computer equipment and storage medium
CN112181627A (en) Timing task scheduling method, device and system
US8117181B2 (en) System for notification of group membership changes in directory service
CN114401207A (en) Positioning method and device for communication abnormal terminal equipment and electronic equipment
CN105653556B (en) Data aging method and device
CN106815318B (en) Clustering method and system for time sequence database
CN111913784B (en) Task scheduling method and device, network element and storage medium
CN111224811A (en) SNMP request monitoring system, method, device and computer readable storage medium
CN103530173A (en) Dynamic weighted event processing system and method
CN113596105B (en) Content acquisition method, edge node and computer readable storage medium
CN105868012A (en) Method and device for processing user request
CN102761527B (en) The access method of serving in cluster and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C41 Transfer of patent application or patent right or utility model
TA01 Transfer of patent application right

Effective date of registration: 20170112

Address after: 100015 Chaoyang District Road, Jiuxianqiao, No. 10, building No. 3, floor 15, floor 17, 1701-26,

Applicant after: BEIJING QI'ANXIN SCIENCE & TECHNOLOGY CO., LTD.

Address before: 100088 Beijing city Xicheng District xinjiekouwai Street 28, block D room 112 (Desheng Park)

Applicant before: Beijing Qihoo Technology Co., Ltd.

Applicant before: Qizhi Software (Beijing) Co., Ltd.

GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: 100088 Building 3 332, 102, 28 Xinjiekouwai Street, Xicheng District, Beijing

Patentee after: Qianxin Technology Group Co., Ltd.

Address before: 100015 15, 17 floor 1701-26, 3 building, 10 Jiuxianqiao Road, Chaoyang District, Beijing.

Patentee before: BEIJING QI'ANXIN SCIENCE & TECHNOLOGY CO., LTD.

CP03 Change of name, title or address