Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to
When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistented with the present invention.On the contrary, they be only with it is such as appended
The example of device and method being described in detail in claims, some aspects of the invention are consistent.
It is only to be not intended to limit the invention merely for for the purpose of describing particular embodiments in terminology used in the present invention.
It is also intended in the present invention and the "an" of singular used in the attached claims, " described " and "the" including majority
Form, unless the context clearly indicates other meaning.It is also understood that term "and/or" used herein refers to and wraps
It may be combined containing one or more associated any or all of project listed.
It will be appreciated that though various information, but this may be described using term first, second, third, etc. in the present invention
A little information should not necessarily be limited by these terms.These terms are only used to for same type of information being distinguished from each other out.For example, not departing from
In the case where the scope of the invention, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as
One information.Depending on context, word as used in this " if " can be construed to " ... when " or " when ...
When " or " in response to determination ".
SOA (Service-Oriented Architecture) is a kind of Enterprise SOA, as shown in Figure 1,
There is complementary relationships in SOA environment, between system generally requires after a system receives a service request
Another system is called to go to complete this service request, relative to the initiator of service request, we claim to receive service request
System is service request response system, and the system for going to complete this service request that is called is called system.Such as system A
After 10 receive the service request 4 of the transmission of user 13 and the initiation of system B 14 service request 1, service request 2 and service request 3, need
It wants calling system C 11 to go to complete service request 1, service request 2 and service request 4, calling system D 12 is needed to go to complete to service
Request 3, so system A 10 is properly termed as service request response system, system C 11 and system D 12 are called system.
When there are many service request that service request response system receives, it may be necessary to called system repeatedly be called to go to ring
It answers this service request, such as system A 10 in response to service request 1, service request 2, service request 4, needs repeatedly to call
System C 11.If the response time of called system C 11 extends due to network or power system capacity etc., service is asked
It asks response system A 10 just to need to occupy more resources and carrys out calling system C, provided in the system of service request response system A 10
In the case that source is certain, other services of system A 10, such as service request 3 may be will affect, lead to service request response system
The service ability decline of system A 10.It would therefore be desirable to be improved to the scheme of system A scheduling, to guarantee the stabilization of system A
Property.
In order to guarantee that system when calling a system to go to complete service request, will not prolong because of the response of called system
When and lead to resource occupation, influence this system stability and other service.Present description provides under a kind of SOA system architecture
System call method, Fig. 2 is the flow chart of the method, including step S202-S206:
S202, when receiving service request, according to the response time of called system determine whether to service request carry out
Screening;
S204, if it is, being screened to the service request;
S206, the call result for called system is obtained based on the target service requests that screening obtains, to respond
State target service requests.
Generally under SOA system architecture, the division of labor of system can be relatively finer, certain type of business can unify by
Some specific systems is handled, thus when a system receives service request, generally requires that other systems is called to go to complete
This service request.For example, placing an order in Taobao's system buys certain part commodity, Taobao's system can call special order management system
Management order business is gone, the completion payment business of special payment system is called.Service response system can be, such as system, Taobao
System, and called system can be, such as order management system, payment system.And it may be received in same time Taobao system
The service request that places an order of user can be relatively more, at this moment just need repeatedly calling order management system to go to manage multiple service requests
Order business, call payment system go to complete the payment business of multiple service requests.Certainly, if it is called in certain situations
System mode it is relatively good, can quickly respond all service requests, so that it may issue all service requests called
System, so as to the system return response result that is called.Sometimes, called system be also possible to due to network or
Person is the inadequate reason of own system capacity, and the response time is caused to extend, and such service request response system, which obtains, occupies always money
The called system return response result such as is gone in source, can occupy the vast resources of service request response system.In this case, it services
All service requests can not be all sent to called system by request response system, and only send a part to called system
Service request, in case system resource is wasted.
Upon receipt of a service request, certainly, this request can be the request of user's transmission, be also possible to other systems
Automatically the request sent, service request response system first can determine that the service request needs to call according to the content of service request
Which system processing, then determines the need for screening service request according to the response time for the system of being called.For example,
One request of called system text-processing only needs 300ms that can return to processing result, and each tune is directed in the proximal segment time
With request, processing result can just be returned to by requiring 3s, be illustrated, the response time for the system that is called is too long, thus in service request
When response system receives multiple service requests, the time, which can determine, according to response needs to screen service request.At some
It, can be using as shown in Figure 3 in order to more acurrate and objectively go to judge whether to need to screen service request in embodiment
Method go to determine the need for screening service request, specifically includes the following steps:
S302, for each service request received in preset time, determine the average response time of called system;
S304, the mesh for calling the called system is calculated according to the average response time and default fixed gradient algorithm
Mark flow;
S306, determine whether to screen service request according to the target flow.
Since the response time for the system response service request that is called in a period of time can reflect current network state
With the state of called system, it is possible to for each service request and called system received in preset time to this
The response time requested a bit determines the average response time of called system;For example it can be set interior called in record 1min
System responds the response time for each call request that service request response system is sent, and is then obtained according to these response times
One average response time.Certain time can go to be arranged according to the practical business situation of called system, and this specification is not made
Concrete restriction.After average response time is calculated, calculates and call further according to average response time and default fixed gradient algorithm
The target flow of the called system.Service request response system is counted as primary to the primary request of the every transmission of called system
Flow is requested, the call request that service request response system is sent to called system is more, and the request flow needed is also got over
More, the system resource for occupying service request response system is also more.One can be obtained based on a large number of experiments by the system that is called
Algorithm between response time and target flow, for calculating target flow.For example, fixed gradient algorithm, fixed ladder can be used
Degree algorithm is that an algorithm is obtained according to the rule of thumb, and input is called system response time, is exported as target flow tune
Whole ratio.After target flow is calculated, according to the quantity of target flow and service request determine whether to service request into
Row screening.For example, target flow is 2 call request flows, and the service request that service request response system receives is greater than 2
It is a, then it needs to screen service request, and the service request that service request response system receives does not need then less than 2
Screening.
In certain embodiments, response time of the fixed gradient algorithm based on the called system, target flow
It is obtained with the corresponding relationship of the stability indicator of the service request response system.For example, when the response time of called system
When for 300ms, service request response system has sent 5 call requests to called system, service request response system it is steady
It is qualitative preferable, and service request response system has sent 10 call requests to called system, system stability is poor, and works as
When the response time of called system is 30ms, service request response system has sent 50 call requests to called system,
System stability is preferable, therefore, can be according to the response time of calling system and the stability of the service request response system
The corresponding relationship of index obtains the request flow that service request response system sends call request to back-up system.Fixed gradient is calculated
Method is to respond the empirical formula based on a large number of experiments that factor obtains according to above three, based on a fixed base
A mesh can be calculated when inputting the response time of a called system in quasi- request flow according to the calculation formula
It marks flow and adjusts ratio, then flow and target flow adjustment ratio can be requested to obtain target flow according to benchmark.As an example
Son, benchmark request flow for 20 request flows, calculation formula such as following equation 1:
Wherein, F (x) indicates that target flow adjusts ratio, when x indicates response of the called system to a service request
Between, after determining called system response time, target flow adjustment ratio can be calculated according to formula 1, then base again
Flow is requested in benchmark, target flow can be calculated.Certainly, above-mentioned formula is an exemplary example, specific public
Formula can go to obtain with lot of experimental data according to the situation of each called system itself.
After determination needs to screen service request, service request response system needs to sieve service request
Choosing is then based on destination request that screening obtains to called to determine which request needs that called system is called to go to handle
System initiates call request, to obtain response results, and response results is returned to user's either system.Certainly, by which
Request is screened as destination request, and called system is called to go the Filtering system for handling these requests can be according to reality
Situation goes to limit.Such as in certain situations, screening destination request can be removed based on the ID of user, such as VIP user's
Request, needs to timely feedback, to improve the experience of user, at this moment called system can preferentially be called to go to handle these requests.
It in certain situations, can go to screen based on the urgency level of request, for example, the request high for urgency level, can preferentially adjust
It goes to handle with called system.Certainly exist, a part of request conduct also can be randomly selected in the little situation of all request difference
Destination request calls called system to go to handle.
Since the destination request screened is all to need that called system is called to go processing, so the number of destination request
Amount can be gone to determine by the target that calculates flow.For example target flow is the flow of 3 call requests, just filters out 3 clothes
Business request is used as destination request.Thus be not in service request response system resource is occupied, system stability not enough and
The problem of service ability declines.In addition, since preset fixed gradient algorithm is one obtained according to previous system mode
Empirical equation, only it is simple according to this algorithm go calculate target flow, with this come determine whether screen service request and
The quantity of target service requests may have less comprehensive defect, so, in certain embodiments, according to average response
It, can also be according to service response after time and default fixed gradient algorithm calculate the target flow for calling the called system
Cpu performance, memory and/or the loading condition of equipment are adjusted target flow where system, such as the load of system at this time
Seriously, there is overload phenomenon, then turn target flow down, and if loading at this time smaller, cpu performance is also preferable, then may be used
Target flow to be tuned up.In short, can be according to the state of current service request response system and the shape of called system
State goes this end system of adjust automatically that can both guarantee that service request was rung to the request flow of the transmission call request of called system
The stability of system is answered, and can be while guaranteeing service request response system stability by the benefit of service request response system
It is maximized with rate.
For each service request received, service request response system must all be given a response.So for screening
Service request, the response results that service request response system can call called system to go to handle, and called system is returned
Response result as these service requests.And for the non-targeted request in these service requests, service request response system
It can also respond.In some cases, response results can be preset, then return to preset response knot to these requests
Fruit, for example, user has sent out an Alipay red packet inside certain exchange group by mobile phone, multiple users in group can go to get
This red packet can call a red packet amount of money to calculate system after cell phone system, which receives user's click, gets the service request of red packet
System goes to calculate the red packet amount of money of each service request, then feeds back to user again.If red packet amount of money computing system is due to network
Or the problem of own load, causes the computing system response time very slow, at this moment cell phone system can be according to red packet amount of money computing system
Response time determines the need for screening these requests, therefore a part of target clothes are screened from the request that user sends
Business request, and call red packet amount of money computing system to go to handle these requests, and the red packet amount of money will be obtained and return to user.For surplus
Under service request, then user is returned to according to preset red packet volume, without call red packet amount of money computing system go
The red packet amount of money is calculated, to reduce the pressure of computing system.Certainly, in certain situations, if returning the result for each request is
Particular result, it is necessary to rely on called system and go to calculate, then this end system directly will return to characterization to these non-targeted requests
Processing failure as a result, such as system is busy, or report an error.
In addition, in one embodiment, in order to preferably go to determine the need for according to the response time for the system of being called
Service request is screened, service request response system calls called system to handle some service request every time, is called
After system returns to processing result, service request response system can all record the response time of called system, to be based on these
Response time goes to determine whether subsequent service request needs to carry out Screening Treatment.
The system call method under a kind of SOA system architecture in order to which this specification proposition is explained further, below in conjunction with
Fig. 4 and Fig. 5 is described in detail again with a specific embodiment.
Some user is exchanged at certain by mobile phone and sends out a red packet in group, it is assumed that red packet quantity is 100, and the amount of money is in total
100 pieces, the amount of money is randomly assigned, and at this moment each user in group can click the red packet to get red packet.User is integrated in mobile phone
Request detection system 41 and user request response system 42, it is assumed that and sometime there are 50 users while clicking red packet, user
Request detection system 41 can will request response system 42 to send neck red packet service after detecting the click red packet of user to user
It requests (S401), user requests response system 42 that can call a special red packet amount of money computing system 43 that calculating user is gone to get
The amount of money of red packet, i.e., send the request (S402) for calculating the red packet amount of money to red packet amount of money computing system 43, and the red packet amount of money calculates system
After system calculates the red packet amount of money, the red packet amount of money is returned into user and requests response system 42 (S403), user requests response system
The red packet amount of money 46 is returned to user's request detection system 41 again by 42, to be shown to user (S404).Due to red packet computing system
It is also possible to receive the call request of other systems or Network status is poor, at this time when the response of red packet amount of money computing system
Between may be relatively just longer, for example normal 300ms can be responded, it is now desired to 500ms.If system simultaneously takes this 50
Business request is sent to red packet computing system, and red packet computing system is not responding to for a long time, will occupy many resources of system and go to call
Red packet computing system can also will affect other services of system.So user requests response system receiving user's request
It, can be according to interior red packet computing system needle in the preceding 1min recorded before after the neck red packet service request that detection system is sent (S501)
One average response time (S502) is obtained to the response time of each service request, is then set according to average response time and in advance
The fixed gradient algorithm set calculates the target flow (S503) for calling red packet to calculate amount of money system, then further according to current system
Loading condition, cpu performance and memory situation framework are adjusted target flow, for example present load is smaller, can adjust big by one
Then (S504) a bit determines whether to be screened (S505) to this 50 service requests according to target flow, if necessary to sieve
Choosing then determines that the quantity for the destination request for needing that red packet amount of money computing system is called to handle, such as target are asked according to target flow
Seeking quantity is 35 (S506), then according to preset mechanism determine any 35 service requests as destination request (S507), than
35 requests can such as be randomly selected as destination request, the calculating of the red packet amount of money is then called to go to handle this 35 requests
(S508), and the response results (S509) of red packet amount of money computing system are obtained, record red packet amount of money computing system responds this 35
Response results are simultaneously returned to user (S510) by the response time of request.For remaining 15 non-targeted service requests, then root
User, such as 0.1 yuan (S511) are returned to as a result according to the pre-set red packet amount of money.It is appreciated that for destination service
Request and non-targeted service request result response results the two steps for returning to user be in no particular order sequence, it is above
An only exemplary embodiment.Certainly, if it is determined that without screening service request, then all service requests are sent to red packet
Then the calculated result that red packet amount of money computing system returns is sent to user (S512) by amount of money computing system.
Due to user request response system to the request flow for the service request that red packet amount of money computing system is sent be with
The state dynamic adjustment of the state and red packet computing system of time and current system, so, it can both guarantee the steady of system
It is qualitative, and utilizing for system will can be maximized, to guarantee system service quality.
Corresponding with the embodiment of the method that the system under the SOA framework that this specification provides is called, this explanation additionally provides
System calling device under a kind of SOA framework, as shown in fig. 6, described device 600 includes:
Judgment module 601 determines whether to ask service when receiving service request according to the response time of called system
It asks and is screened;
Screening module 602, if it is, being screened to the service request;
Module 603 is obtained, obtains the call result for called system based on the target service requests that screening obtains, with
Respond the target service requests.
In one embodiment, for the non-targeted service request after screening, default response results, the default sound are returned
Should result include characterize processing failure result.
In one embodiment, the target service requests are screened based on User ID;Or
Urgency level based on service request is screened.
In one embodiment, the response time of the called system of the basis determines whether to screen service request
It specifically includes:
For each service request received in preset time, the average response time of called system is determined;
The target stream for calling the called system is calculated according to the average response time and default fixed gradient algorithm
Amount;
Determine whether to screen service request according to the target flow.
In one embodiment, it is calculated according to the average response time and default fixed gradient algorithm and calls described adjusted
After the target flow of system, further includes:
The target flow is adjusted according to the cpu performance, memory of equipment where described this system and/or loading condition.
In one embodiment, response time and this system of the fixed gradient algorithm based on the called system
The corresponding relationship of stability indicator obtains.
In one embodiment, the quantity of the target service requests is determined based on the target flow.
In one embodiment, based on the target service requests that screening obtains obtain called system call result it
Afterwards, further includes:
Record the response time that called system responds the target service requests.
The function of each unit and the realization process of effect are specifically detailed in the above method and correspond to step in above-mentioned apparatus
Realization process, details are not described herein.
For device embodiment, since it corresponds essentially to embodiment of the method, so related place is referring to method reality
Apply the part explanation of example.The apparatus embodiments described above are merely exemplary, wherein described be used as separation unit
The unit of explanation may or may not be physically separated, and component shown as a unit can be or can also be with
It is not physical unit, it can it is in one place, or may be distributed over multiple network units.It can be according to actual
The purpose for needing to select some or all of the modules therein to realize application scheme.Those of ordinary skill in the art are not paying
Out in the case where creative work, it can understand and implement.
For hardware view, as shown in fig. 7, for a kind of hardware for preloading page device place equipment of this specification
Structure chart, it is real other than processor 701 shown in Fig. 7, network interface 704, memory 702 and nonvolatile memory 703
Applying the equipment in example where device usually can also include other hardware, such as be responsible for the forwarding chip of processing message;From hardware
The equipment is also possible to be distributed equipment from structure, may include multiple interface cards, to be reported in hardware view
The extension of text processing.
The nonvolatile memory 703 is stored with for storing executable computer instruction, and processor 704 executes institute
It is performed the steps of when stating computer instruction
When receiving service request, determine whether to screen service request according to the response time of called system;
If it is, being screened to the service request, and the target service requests acquisition obtained based on screening is directed to
The call result of called system, to respond the target service requests.
Since all or part of the application the part that contributes to existing technology or the technical solution can be with soft
The form of part product embodies, which is stored in a storage medium, including some instructions are to make
Obtain all or part of the steps that a terminal device executes each embodiment method of the application.And storage medium above-mentioned includes: U
Disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access
Memory, RAM), the various media that can store program code such as magnetic or disk.
Further present invention also provides a kind of SOA system architectures, as shown in figure 8, the SOA system includes that service is asked
Ask response system 801 and called system 802;
Service request response system 801 is used for when receiving service request 803, when according to the response of called system 802
Between determine whether to screen service request;If it is, the service request is screened, and obtained based on screening
Target service requests 804 obtain the call result 805 of called system, to respond the target service requests 804;
The called system 802 be used for by service request response system 801 calling when, return with the target take
Business 804 corresponding call results 805 of request.
The foregoing is merely the preferred embodiments of the application, not to limit the application, all essences in the application
Within mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the application protection.