CN106294073B - Service calling method and device - Google Patents

Service calling method and device Download PDF

Info

Publication number
CN106294073B
CN106294073B CN201610670885.5A CN201610670885A CN106294073B CN 106294073 B CN106294073 B CN 106294073B CN 201610670885 A CN201610670885 A CN 201610670885A CN 106294073 B CN106294073 B CN 106294073B
Authority
CN
China
Prior art keywords
service
calling
case
availability parameters
malloc
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.)
Expired - Fee Related
Application number
CN201610670885.5A
Other languages
Chinese (zh)
Other versions
CN106294073A (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.)
Alibaba China Co Ltd
Original Assignee
Heyi Intelligent Technology (shenzhen) 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 Heyi Intelligent Technology (shenzhen) Co Ltd filed Critical Heyi Intelligent Technology (shenzhen) Co Ltd
Priority to CN201610670885.5A priority Critical patent/CN106294073B/en
Publication of CN106294073A publication Critical patent/CN106294073A/en
Application granted granted Critical
Publication of CN106294073B publication Critical patent/CN106294073B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • G06F9/548Object oriented; Remote method invocation [RMI]

Abstract

The present invention relates to service calling method and devices.This method comprises: obtaining the availability parameters of the service in the case where receiving the request for calling service;In the case where the availability parameters is available situation, the service is called, and obtain the response results of the service;In the case where the availability parameters is not available situation, alternative operation is executed.By in the case where receiving the request for calling service, obtain the availability parameters of the service, in the case where availability parameters is available situation, the service is then called, and obtains the response results of the service, in the case where availability parameters is not available situation, execute alternative operation, service calling method and device according to the present invention can reduce distribution application system to the dependence of the service, so as to improve the stability and reliability of distribution application system when service occurs abnormal.

Description

Service calling method and device
Technical field
The present invention relates to computer software technical field more particularly to a kind of service calling methods and device.
Background technique
Distributed Application (Distributed Application) refers to that application program is distributed on different computers, The working method to be accomplished a task jointly by network.In distribution application system, in order to reduce coupling and maintenance Cost, while the collaborative work between different departments for convenience, are usually split as multiple services with simple function.Example Such as, for large-scale Internet advertising distribution application, load balancing, front end, backstage, caching, database and third are usually split as Multiple services such as side's service.Different services would generally be deployed on the multiple servers of different computer rooms, by altogether between service The modes such as database and RPC (Remote Process Call, remote procedure call) are enjoyed to be communicated.When Distributed Application system When the service that system relies on occurs abnormal, for example, service can not normal response when, will affect the performance and surely of distribution application system It is qualitative, it even results in entire distribution application system and exception occurs, to cause greater loss.
To sum up, the stability and reliability of existing distribution application system depend on inside and out the stability that services And reliability influences the service quality of distribution application system when the service that distribution application system relies on occurs abnormal It is larger, it is unavailable to result even in distribution application system.
Summary of the invention
Technical problem
In view of this, the technical problem to be solved by the present invention is to, the stability of existing distribution application system and reliable Property is lower.
Solution
In order to solve the above-mentioned technical problem, an embodiment according to the present invention provides a kind of service calling method, packet It includes:
In the case where receiving the request for calling service, the availability parameters of the service is obtained;
In the case where the availability parameters is available situation, the service is called, and obtain the response results of the service;
In the case where the availability parameters is not available situation, alternative operation is executed.
For the above method, in one possible implementation, in the case where the availability parameters is not available situation, Execute alternative operation, comprising:
In the case where the availability parameters is not available situation, judge whether the request needs to visit the service It surveys;
If it is determined that needing to detect the service, then the service is called, and obtain the response results of the service;
If it is determined that not needing to detect the service, then the alternate data and/or alternating logic of the service are called.
For the above method, in one possible implementation, judge it is described request whether need to it is described service into Row detection, comprising:
First interval is set according to preset detection flow proportional, and according to the detection flow proportional described the The 4th preset value is set in one section;
Random number is generated in the first interval for the request, if the random number is identical as the 4th preset value, Determine to need to detect the service, otherwise determines not needing to detect the service.
It is in one possible implementation, described after the response results for obtaining the service for the above method Method further include:
The corresponding calling total degree of the service is added 1;
If the response results of the service are exception, the corresponding malloc failure malloc number of the service is added 1;
It is default that time interval between present system time and the detection time of service stamp is greater than or equal to first Value, and the callings total degree be greater than or equal to the second preset value in the case where, according to the malloc failure malloc number update described in Availability parameters.
For the above method, in one possible implementation, can be used according to malloc failure malloc number update Property parameter, comprising:
In the case where the malloc failure malloc number and the ratio for calling total degree are greater than or equal to third preset value, The availability parameters is updated to unavailable;
It, will in the case where the malloc failure malloc number and the ratio for calling total degree are less than the third preset value The availability parameters is updated to can be used.
For the above method, in one possible implementation, according to the malloc failure malloc number update described in can After property parameter, the method also includes:
Detection time stamp is updated to the present system time, and the calling total degree and the calling are lost Lose number clearing.
It is in one possible implementation, described after the response results for obtaining the service for the above method Method further include:
If the response results of the service be it is normal, the newest calling state of the service is updated to normal condition, Otherwise the newest calling state is updated to abnormality.
In order to solve the above-mentioned technical problem, according to another embodiment of the present invention, a kind of service call device is provided, is wrapped It includes:
Availability parameters obtains module, for obtaining the service in the case where receiving the request for calling service Availability parameters;
Service calling module, for calling the service, and obtain institute in the case where the availability parameters is available situation State the response results of service;
Alternative operation execution module, for executing alternative operation in the case where the availability parameters is not available situation.
For above-mentioned apparatus, in one possible implementation, the alternative operation execution module includes:
Judging submodule is detected, for whether judging the request in the case where the availability parameters is not available situation It needs to detect the service;
Service call submodule, for if it is determined that need the service is detected, then call the service, and obtain The response results of the service;
It is alternative to call submodule, for if it is determined that do not need to detect the service, then calling the standby of the service Select data and/or alternating logic.
For above-mentioned apparatus, in one possible implementation, the detection judging submodule is specifically used for:
In the case where the availability parameters is not available situation, the firstth area is arranged according to preset detection flow proportional Between, and the 4th preset value is set in the first interval according to the detection flow proportional;
Random number is generated in the first interval for the request, if the random number is identical as the 4th preset value, Determine to need to detect the service, otherwise determines not needing to detect the service.
For above-mentioned apparatus, in one possible implementation, described device further include:
Total degree accumulator module is called, for the corresponding calling total degree of the service to be added 1;
Malloc failure malloc number accumulator module corresponds to the service if the response results for the service are exception Malloc failure malloc number add 1;
Availability parameters update module, for the time between present system time and the detection time of service stamp In the case that interval is greater than or equal to the first preset value, and the calling total degree is greater than or equal to the second preset value, according to institute It states malloc failure malloc number and updates the availability parameters.
For above-mentioned apparatus, in one possible implementation, the availability parameters update module includes:
First availability parameters updates submodule, in the malloc failure malloc number and the ratio for calling total degree In the case where more than or equal to third preset value, the availability parameters is updated to unavailable;
Second availability parameters updates submodule, in the malloc failure malloc number and the ratio for calling total degree In the case where less than the third preset value, the availability parameters is updated to can be used.
For above-mentioned apparatus, in one possible implementation, described device further include:
Dump block for detection time stamp to be updated to the present system time, and is called described total time The several and malloc failure malloc number is reset.
For above-mentioned apparatus, in one possible implementation, described device further include:
Newest calling state update module, if the response results for the service be it is normal, most by the service New calling state is updated to normal condition, and the newest calling state is otherwise updated to abnormality.
Beneficial effect
By obtaining the availability parameters of the service in the case where receiving the request for calling service, join in availability Number is then to call the service, and obtain the response results of the service in available situation, is not available feelings in availability parameters Under condition, alternative operation is executed, service calling method and device according to an embodiment of the present invention can be when service occur abnormal, drop Low distribution application system is to the dependence of the service, so as to improve the stability and reliability of distribution application system.
According to below with reference to the accompanying drawings becoming to detailed description of illustrative embodiments, other feature of the invention and aspect It is clear.
Detailed description of the invention
Comprising in the description and constitute the attached drawing of part of specification and specification together illustrate it is of the invention Exemplary embodiment, feature and aspect, and principle for explaining the present invention.
Fig. 1 shows the implementation flow chart of service calling method according to an embodiment of the invention;
One Fig. 2 shows service calling method step S103 according to an embodiment of the invention illustratively implements stream Cheng Tu;
Fig. 3 shows judge whether the request needs pair in service calling method step S201 according to an embodiment of the invention The illustrative specific implementation flow chart that the service is detected;
Fig. 4 shows an illustrative implementation flow chart of service calling method according to an embodiment of the invention;
Fig. 5 shows the implementation flow chart of the another exemplary of service calling method according to an embodiment of the invention;
Fig. 6 shows the implementation flow chart of the another exemplary of service calling method according to an embodiment of the invention;
Fig. 7 shows the implementation flow chart of the another exemplary of service calling method according to an embodiment of the invention;
Fig. 8 shows the structural block diagram of service call device according to another embodiment of the present invention;
Fig. 9 shows an illustrative structural block diagram of service call device according to another embodiment of the present invention;
Figure 10 shows a kind of structural block diagram of service call equipment of another embodiment of the invention.
Specific embodiment
Below with reference to attached drawing various exemplary embodiments, feature and the aspect that the present invention will be described in detail.It is identical in attached drawing Appended drawing reference indicate element functionally identical or similar.Although the various aspects of embodiment are shown in the attached drawings, remove It non-specifically points out, it is not necessary to attached drawing drawn to scale.
Dedicated word " exemplary " means " being used as example, embodiment or illustrative " herein.Here as " exemplary " Illustrated any embodiment should not necessarily be construed as preferred or advantageous over other embodiments.
In addition, in order to better illustrate the present invention, numerous details is given in specific embodiment below. It will be appreciated by those skilled in the art that without certain details, the present invention equally be can be implemented.In some instances, for Method, means, element and circuit well known to those skilled in the art are not described in detail, in order to highlight purport of the invention.
Embodiment 1
Fig. 1 shows the implementation flow chart of service calling method according to an embodiment of the invention.As shown in Figure 1, this method It specifically includes that
In step s101, in the case where receiving the request for calling service (Service), the available of the service is obtained Property parameter (Available).
It should be noted that service calling method provided in an embodiment of the present invention can be applied to distribution application system, It is not limited thereto.ID (Identification, mark can be respectively created in distribution application system for its each service relied on Knowledge number).
In embodiments of the present invention, in the case where receiving the request for calling service, the availability ginseng of the service is obtained Number.Wherein, the service which can be relied on by distribution application system.The availability parameters of service may include it is available and Unavailable two kinds of value conditions.
In step s 102, in the case where availability parameters is available situation, the service is called, and obtain the response of the service As a result.
In step s 103, in the case where availability parameters is not available situation, alternative operation is executed.
In embodiments of the present invention, in the case where the availability parameters of service is not available situation, which can be carried out Degrade, and execute alternative operation, thus, it is possible to reduce distribution application system to the dependence of the service, improves Distributed Application The stability and reliability of system.
One Fig. 2 shows service calling method step S103 according to an embodiment of the invention illustratively implements stream Cheng Tu.As shown in Fig. 2, executing alternative operation in the case where availability parameters is not available situation, comprising:
In step s 201, in the case where availability parameters is not available situation, judge whether the request needs to the service It is detected, if so, S202 is thened follow the steps, it is no to then follow the steps S203.
In step S202, the service is called, and obtains the response results of the service.
As an example of the embodiment of the present invention, in the case where determining that request needs detect the service, The service is called, and obtains the response results of the service.Thus in the service exception that distribution application system relies on, to the clothes The call request that business retains sub-fraction is detected, can be in time by the service if the service is switched to normally by abnormal Availability parameters is updated to can be used by unavailable, so as to restore the service in time, without artificial reparation and intervention, is reduced Manpower maintenance cost, and application quality fall time caused by service exception is minimized.
In step S203, the alternate data and/or alternating logic of the service are called.
As an example of the embodiment of the present invention, in judgement, the request does not need the case where detecting to the service Under, the alternate data and/or alternating logic of the service are called, thus for most of call request, this can be called directly The alternate data and/or alternating logic of service, thus to distribution when reducing the service exception of distribution application system dependence Influence and loss caused by application system.
As an example of the embodiment of the present invention, after step S202, this method further include: if the response of the service As a result it is exception, then calls the alternate data and/or alternating logic of the service.
In alternatively possible implementation, in the case where availability parameters is not available situation, alternative operation is executed, it can With are as follows: in the case where availability parameters is not available situation, call the alternate data and/or alternating logic of the service.In the realization In mode, service availability parameters be not available situation under, for it is each call the service request, call the clothes The alternate data and/or alternating logic of business, to reduce the abnormal influence caused by distribution application system of the service and lose. In this implementation, in the case where the availability parameters of service is not available situation, a thread, the line can also in addition be used Journey detects the service with preset calling frequency and content, can will if it is normal to detect the service recovery The availability parameters of the service is updated to can be used by unavailable.
Fig. 3 shows judge whether the request needs pair in service calling method step S201 according to an embodiment of the invention The illustrative specific implementation flow chart that the service is detected.As shown in figure 3, judging whether the request needs to the service It is detected, comprising:
In step S301, first interval is arranged according to preset detection flow proportional (Flow), and according to detection Flow proportional sets the 4th preset value in first interval.
For example, preset detection flow proportional can be 1% or 0.1%, it is not limited thereto.
For example, preset detection flow proportional is 2%, then can be set according to the preset detection flow proportional Setting first interval is [0,99], and the 4th preset value can choose any number in [0,99], makes its numerical value accounting and detection flow Ratio is identical, such as 23 and 84.
In step s 302, random number is generated in first interval for the request, if the random number and the 4th preset value phase Together, then determine to need to detect the service, otherwise determine not needing to detect the service.For example, the 4th preset value For 23 and 84, it is 23 or 84 if the random number that the request generates in first interval [0,99], then determines to need to the service It is detected, otherwise determines not needing to detect the service.Random number can be according to the request corresponding timestamp next life At.For example, first interval range is [0,99] if the corresponding timestamp of the request is 1469414684, then it can choose this and ask Latter two 84 of corresponding timestamp are asked to be used as random number.
Fig. 4 shows an illustrative implementation flow chart of service calling method according to an embodiment of the invention.Such as Fig. 4 institute Show, this method comprises:
In step S401, in the case where receiving the request for calling service, judge that the availability parameters of the service is No is available, if so, S402 is thened follow the steps, it is no to then follow the steps S403.
In step S402, the service is called, and obtains the response results of the service.
In step S403, judge whether the request needs to detect the service, if so, S402 is thened follow the steps, It is no to then follow the steps S404.
In step s 404, the alternate data and/or alternating logic of the service are called.
In step S405, by the corresponding calling total degree (such as InvokeTimes) of the service plus 1.
Wherein, the calling total degree of the service can be for from the time that the detection time stamp of the service is recorded to current system Time calls the total degree of the service.
In step S406, if the response results of the service are exception, by the corresponding malloc failure malloc number (example of the service Such as FailedTimes) plus 1.
When the malloc failure malloc number of the service can be for from the time that the detection time stamp of the service is recorded to current system Between call the number of the serv-fail.
Wherein, the response results of service are that abnormal reason may include request timed out, not respond, disconnecting or clothes Be engaged in unavailable etc., it is not limited thereto.
In step S 407, when between present system time (CurrentTime) and the detection time of the service stabbing Between interval (such as Duration) be greater than or equal to the first preset value, and call total degree be greater than or equal to the second preset value (example Such as CheckTimes) in the case where, availability parameters is updated according to malloc failure malloc number.
Wherein, the detection time stamp of the service can be the timestamp of the last availability parameters for updating the service.
As an example of the embodiment of the present invention, between present system time and the detection time of service stamp when Between interval be greater than or equal to the first preset value, and call total degree be greater than or equal to the second preset value in the case where, that is, meet (in the case where CurrentTime-TimeStamp >=Duration) && (InvokeTimes >=CheckTimes), triggering can With the update step of property parameter.
In one possible implementation, availability parameters is updated according to malloc failure malloc number, comprising: in malloc failure malloc In the case that the ratio of number and calling total degree is greater than or equal to third preset value (such as FailRate), that is, meet In the case where FailedTimes/InvokeTimes >=FailRate, availability parameters is updated to unavailable;It is lost calling Lose number and call total degree ratio be less than third preset value in the case where, that is, meet FailedTimes/InvokeTimes < In the case where FailRate, availability parameters is updated to can be used.
Fig. 5 shows the implementation flow chart of the another exemplary of service calling method according to an embodiment of the invention.Such as Fig. 5 It is shown, this method comprises:
In step S501, in the case where receiving the request for calling service, judge that the availability parameters of the service is No is available, if so, S502 is thened follow the steps, it is no to then follow the steps S503.
In step S502, the service is called, and obtains the response results of the service.
In step S503, judge whether the request needs to detect the service, if so, S502 is thened follow the steps, It is no to then follow the steps S504.
In step S504, the alternate data and/or alternating logic (such as Backup) of the service are called.
In step S505, the corresponding calling total degree of the service is added 1.
In step S506, if the response results of the service are exception, the corresponding malloc failure malloc number of the service is added 1。
In step s 507, between present system time and the detection time of service stamp (such as TimeStamp) In the case that time interval is greater than or equal to the first preset value, and calling total degree is greater than or equal to the second preset value, according to tune Availability parameters is updated with the frequency of failure.
In step S508, will test update of time stamp is present system time, and will call total degree and malloc failure malloc Number is reset.
As an example of the embodiment of the present invention, after updating availability parameters according to malloc failure malloc number, by this The detection time stamp of service is updated to present system time, and total degree and malloc failure malloc number will be called to reset.
Fig. 6 shows the implementation flow chart of the another exemplary of service calling method according to an embodiment of the invention.Such as Fig. 6 It is shown, this method comprises:
In step s 601, in the case where receiving the request for calling service, judge that the availability parameters of the service is No is available, if so, S602 is thened follow the steps, it is no to then follow the steps S603.
In step S602, the service is called, and obtains the response results of the service.
In step S603, in the case where availability parameters is not available situation, judge whether the request needs to the service It is detected, if so, S602 is thened follow the steps, it is no to then follow the steps S604.
In step s 604, the alternate data and/or alternating logic of the service are called.
In step s 605, if the response results of the service be it is normal, by the newest calling state of the service (such as Status it) is updated to normal condition, newest calling state is otherwise updated to abnormality.
As an example of the embodiment of the present invention, the newest calling shape of the service is updated according to the response results of service State.If the newest calling state of the service is abnormality, the newest calling state of the service can also include abnormal cause Mark.
Fig. 7 shows the implementation flow chart of the another exemplary of service calling method according to an embodiment of the invention.Such as Fig. 7 It is shown, this method comprises:
In step s 701, in the case where receiving the request for calling service, judge that the availability parameters of the service is No is available, if so, S702 is thened follow the steps, it is no to then follow the steps S703.
In step S702, the service is called, and obtains the response results of the service.
In step S703, judge whether the request needs to detect the service, if so, S702 is thened follow the steps, It is no to then follow the steps S704.
In step S704, the alternate data and/or alternating logic of the service are called.
In step S705, the time interval between present system time and the detection time of service stamp is greater than or waits In the first preset value, and call total degree more than or equal in the case where the second preset value, being updated according to malloc failure malloc number can With property parameter.
In step S706, if the response results of the service be it is normal, the newest calling state of the service is updated to Otherwise newest calling state is updated to abnormality by normal condition.
In step S707, the newest calling state of the service is fed back into user.
As an example of the embodiment of the present invention, the newest calling state of each service can be counted, and by suitable Data structure packed, user is returned in last response, so that user and exploitation, test and operation maintenance personnel are all It can intuitively be well understood and abnormal service and abnormal cause occur, thus, it is possible to intuitively recognize application quality decline Reason, so as to the exception service and link in quick positioning distributed application system, and it is caused to assess the exception It influences.
In this way, the availability parameters of the service is obtained by the case where receiving the request for calling service, available Property parameter be available situation under, then call the service, and obtain the response results of the service, availability parameters be it is unavailable In the case where, alternative operation is executed, service calling method according to an embodiment of the present invention can be reduced when service occurs abnormal Distribution application system is to the dependence of the service, so as to improve the stability and reliability of distribution application system.
Embodiment 2
Fig. 8 shows the structural block diagram of service call device according to another embodiment of the present invention.The device can be used for transporting Row service calling method shown in FIG. 1.For ease of description, only parts related to embodiments of the present invention are shown in fig. 8.
As shown in figure 8, the service call device includes: that availability parameters obtains module 81, for receiving calling clothes In the case where the request of business, the availability parameters of the service is obtained;Service calling module 82, in the availability parameters To call the service in available situation, and obtain the response results of the service;Alternative operation execution module 83, is used for In the case where the availability parameters is not available situation, alternative operation is executed.
Fig. 9 shows an illustrative structural block diagram of service call device according to another embodiment of the present invention, the device It can be used for running Fig. 1 to service calling method shown in Fig. 8.For ease of description, it is illustrated only in Fig. 9 and present invention reality Apply the relevant part of example.Label component function having the same identical with Fig. 8 in Fig. 9 is omitted to these groups for simplicity The detailed description of part.It is as shown in Figure 9:
In one possible implementation, the alternative operation execution module 83 includes: detection judging submodule 831, For judging whether the request needs to detect the service in the case where the availability parameters is not available situation; Service call submodule 832, for if it is determined that need to detect the service, then calling the service, and described in obtaining The response results of service;It is alternative to call submodule 833, for if it is determined that do not need to detect the service, then calling institute State the alternate data and/or alternating logic of service.
In one possible implementation, the detection judging submodule 831 is specifically used for: in the availability parameters For first interval is arranged according to preset detection flow proportional in not available situation, and according to the detection flow proportional The 4th preset value is set in the first interval;For it is described request generate random number in the first interval, if it is described with Machine number is identical as the 4th preset value, then determine need the service is detected, otherwise determine do not need to it is described service into Row detection.
In one possible implementation, described device further include: call total degree accumulator module 84, being used for will be described It services corresponding calling total degree and adds 1;Malloc failure malloc number accumulator module 85, if the response results for the service are different Often, then the corresponding malloc failure malloc number of the service is added 1;Availability parameters update module 86, in present system time Time interval between the detection time stamp of the service is greater than or equal to the first preset value, and the calling total degree is greater than Or in the case where being equal to the second preset value, the availability parameters is updated according to the malloc failure malloc number.
In one possible implementation, the availability parameters update module 86 include: the first availability parameters more New submodule 861, for being greater than or equal to third preset value in the malloc failure malloc number and the ratio for calling total degree In the case where, the availability parameters is updated to unavailable;Second availability parameters updates submodule 862, for described In the case that malloc failure malloc number and the ratio for calling total degree are less than the third preset value, by the availability parameters It is updated to can be used.
In one possible implementation, described device further include: dump block 87, for the detection time to be stabbed It is updated to the present system time, and the calling total degree and the malloc failure malloc number are reset.
In one possible implementation, described device further include: newest calling state update module 98, if being used for institute State service response results be it is normal, then the newest calling state of the service is updated to normal condition, otherwise will it is described most New calling state is updated to abnormality.
It should be noted that in this way, obtaining the available of the service by the case where receiving the request for calling service Property parameter then call the service, and obtain the response results of the service in the case where availability parameters is available situation, available Property parameter be to execute alternative operation in not available situation, service call device according to an embodiment of the present invention can service When occurring abnormal, distribution application system is reduced to the dependence of the service, so as to improve the steady of distribution application system Qualitative and reliability.
Embodiment 3
Figure 10 shows a kind of structural block diagram of service call equipment of another embodiment of the invention.The service is adjusted It can be the host server for having computing capability, personal computer PC or portable portable computing with equipment 1100 Machine or terminal etc..The specific embodiment of the invention does not limit the specific implementation of calculate node.
The service call equipment 1100 includes processor (processor) 1110, communication interface (Communications Interface) 1120, memory (memory) 1130 and bus 1140.Wherein, processor 1110, communication interface 1120 and Memory 1130 completes mutual communication by bus 1140.
Communication interface 1120 is used for and network device communications, and wherein the network equipment includes such as Virtual Machine Manager center, is total to Enjoy storage etc..
Processor 1110 is for executing program.Processor 1110 may be a central processor CPU or dedicated collection At circuit ASIC (Application Specific Integrated Circuit), or it is arranged to implement the present invention One or more integrated circuits of embodiment.
Memory 1130 is for storing file.Memory 1130 may include high speed RAM memory, it is also possible to further include non- Volatile memory (non-volatile memory), for example, at least a magnetic disk storage.Memory 1130 is also possible to deposit Memory array.Memory 1130 is also possible to by piecemeal, and described piece can be combined into virtual volume by certain rule.
In a kind of possible embodiment, above procedure can be the program code for including computer operation instruction.The journey Sequence is particularly used in: realizing the operation of each step in embodiment 1.
Those of ordinary skill in the art may be aware that each exemplary cell and algorithm in embodiment described herein Step can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions actually with hardware also It is software form to realize, the specific application and design constraint depending on technical solution.Professional technician can be directed to It is specific that described function is realized using different methods is selected, but this realization is it is not considered that exceed model of the invention It encloses.
If realizing the function and when sold or used as an independent product in the form of computer software, To a certain extent it is believed that all or part (such as the part that contributes to existing technology) of technical solution of the present invention is It embodies in form of a computer software product.The computer software product is generally stored inside computer-readable non-volatile In storage medium, including some instructions are used so that computer equipment (can be personal computer, server or network to set It is standby etc.) execute all or part of the steps of various embodiments of the present invention method.And storage medium above-mentioned include USB flash disk, mobile hard disk, Read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic The various media that can store program code such as dish or CD.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain Lid is within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.

Claims (12)

1. a kind of service calling method characterized by comprising
In the case where receiving the request for calling service, the availability parameters of the service is obtained;
In the case where the availability parameters is available situation, the service is called, and obtain the response results of the service;
In the case where the availability parameters is not available situation, alternative operation is executed;
Wherein, in the case where the availability parameters is not available situation, alternative operation is executed, comprising:
In the case where the availability parameters is not available situation, judge whether the request needs to detect the service;
If it is determined that needing to detect the service, then the service is called, and obtain the response results of the service;
If it is determined that not needing to detect the service, then the alternate data and/or alternating logic of the service are called.
2. the method according to claim 1, wherein judging whether the request needs to visit the service It surveys, comprising:
First interval is set according to preset detection flow proportional, and according to the detection flow proportional in firstth area Between the 4th preset value of middle setting;
Random number is generated in the first interval for the request, if the random number is identical as the 4th preset value, is determined It needs to detect the service, otherwise determines not needing to detect the service.
3. method according to claim 1 or 2, which is characterized in that described after the response results for obtaining the service Method further include:
The corresponding calling total degree of the service is added 1;
If the response results of the service are exception, the corresponding malloc failure malloc number of the service is added 1;
Time interval between present system time and the detection time of service stamp is greater than or equal to the first preset value, and In the case that the calling total degree is greater than or equal to the second preset value, the availability is updated according to the malloc failure malloc number Parameter.
4. according to the method described in claim 3, joining it is characterized in that, updating the availability according to the malloc failure malloc number Number, comprising:
In the case where the malloc failure malloc number and the ratio for calling total degree are greater than or equal to third preset value, by institute State availability parameters be updated to it is unavailable;
It, will be described in the case where the malloc failure malloc number and the ratio for calling total degree are less than the third preset value Availability parameters is updated to can be used.
5. according to the method described in claim 3, it is characterized in that, updating the availability according to the malloc failure malloc number After parameter, the method also includes:
Detection time stamp is updated to the present system time, and the calling total degree and the malloc failure malloc is secondary Number is reset.
6. method according to claim 1 or 2, which is characterized in that described after the response results for obtaining the service Method further include:
If the response results of the service be it is normal, the newest calling state of the service is updated to normal condition, otherwise The newest calling state is updated to abnormality.
7. a kind of service call device characterized by comprising
Availability parameters obtains module, in the case where receiving the request for calling service, obtaining the available of the service Property parameter;
Service calling module, for calling the service, and obtain the clothes in the case where the availability parameters is available situation The response results of business;
Alternative operation execution module, for executing alternative operation in the case where the availability parameters is not available situation;
Wherein, the alternative operation execution module includes:
Judging submodule is detected, for judging whether the request needs in the case where the availability parameters is not available situation The service is detected;
Service call submodule, for if it is determined that need to detect the service, then calling the service, and described in obtaining The response results of service;
It is alternative to call submodule, for if it is determined that do not need to detect the service, then calling the alternative number of the service According to and/or alternating logic.
8. device according to claim 7, which is characterized in that the detection judging submodule is specifically used for:
In the case where the availability parameters is not available situation, first interval is arranged according to preset detection flow proportional, And the 4th preset value is set in the first interval according to the detection flow proportional;
Random number is generated in the first interval for the request, if the random number is identical as the 4th preset value, is determined It needs to detect the service, otherwise determines not needing to detect the service.
9. device according to claim 7 or 8, which is characterized in that described device further include:
Total degree accumulator module is called, for the corresponding calling total degree of the service to be added 1;
Malloc failure malloc number accumulator module, if the response results for the service are exception, by the corresponding tune of the service With the frequency of failure plus 1;
Availability parameters update module, for the time interval between present system time and the detection time of service stamp More than or equal to the first preset value, and in the case that the calling total degree is greater than or equal to the second preset value, according to the tune The availability parameters is updated with the frequency of failure.
10. device according to claim 9, which is characterized in that the availability parameters update module includes:
First availability parameters updates submodule, for being greater than in the malloc failure malloc number and the ratio for calling total degree Or in the case where being equal to third preset value, the availability parameters is updated to unavailable;
Second availability parameters updates submodule, for being less than in the malloc failure malloc number and the ratio for calling total degree In the case where the third preset value, the availability parameters is updated to can be used.
11. device according to claim 9, which is characterized in that described device further include:
Dump block, for detection time stamp to be updated to the present system time, and by the callings total degree with The malloc failure malloc number is reset.
12. device according to claim 7 or 8, which is characterized in that described device further include:
Newest calling state update module, if the response results for the service be it is normal, by the newest tune of the service It is updated to normal condition with state, the newest calling state is otherwise updated to abnormality.
CN201610670885.5A 2016-08-15 2016-08-15 Service calling method and device Expired - Fee Related CN106294073B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610670885.5A CN106294073B (en) 2016-08-15 2016-08-15 Service calling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610670885.5A CN106294073B (en) 2016-08-15 2016-08-15 Service calling method and device

Publications (2)

Publication Number Publication Date
CN106294073A CN106294073A (en) 2017-01-04
CN106294073B true CN106294073B (en) 2019-03-12

Family

ID=57671582

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610670885.5A Expired - Fee Related CN106294073B (en) 2016-08-15 2016-08-15 Service calling method and device

Country Status (1)

Country Link
CN (1) CN106294073B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107092532B (en) * 2017-03-22 2020-08-04 武汉斗鱼网络科技有限公司 Remote calling method and remote calling device
CN109936613B (en) * 2017-12-19 2021-11-05 北京京东尚科信息技术有限公司 Disaster recovery method and device applied to server
CN110071952B (en) * 2018-01-24 2023-08-08 北京京东尚科信息技术有限公司 Service call quantity control method and device
CN108681476A (en) * 2018-05-08 2018-10-19 广州品唯软件有限公司 A kind of automatic blowout method of physical layer interface and device
CN109120686A (en) * 2018-08-08 2019-01-01 联动优势电子商务有限公司 A kind of method and device servicing pre-authentication
CN109343955B (en) * 2018-09-14 2021-03-16 阿里巴巴(中国)有限公司 Recommendation service calling method, medium, device and computing equipment
CN109358996B (en) * 2018-10-08 2021-09-24 北京天弘瑞智科技有限公司 Processing method and processing system for change request
CN109450691B (en) * 2018-11-20 2022-01-11 深圳前海微众银行股份有限公司 Service gateway monitoring method, device and computer readable storage medium
CN110309016B (en) * 2019-06-13 2022-03-04 北京奇艺世纪科技有限公司 Fusing recovery method and device and server
CN110618889A (en) * 2019-08-14 2019-12-27 网联清算有限公司 Service availability detection method and device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024058A (en) * 2012-12-19 2013-04-03 中国电子科技集团公司第十五研究所 Method and system for invoking web services
CN105306507A (en) * 2014-07-18 2016-02-03 阿里巴巴集团控股有限公司 Disaster tolerance processing method and disaster tolerance processing device in distributed architecture
CN105656962A (en) * 2014-11-11 2016-06-08 阿里巴巴集团控股有限公司 Service calling method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8650326B2 (en) * 2009-11-11 2014-02-11 Microsoft Corporation Smart client routing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024058A (en) * 2012-12-19 2013-04-03 中国电子科技集团公司第十五研究所 Method and system for invoking web services
CN105306507A (en) * 2014-07-18 2016-02-03 阿里巴巴集团控股有限公司 Disaster tolerance processing method and disaster tolerance processing device in distributed architecture
CN105656962A (en) * 2014-11-11 2016-06-08 阿里巴巴集团控股有限公司 Service calling method and device

Also Published As

Publication number Publication date
CN106294073A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN106294073B (en) Service calling method and device
CN106911483B (en) Charging method based on block chain and cloud computing platform
US9071535B2 (en) Comparing node states to detect anomalies
US8938489B2 (en) Monitoring system performance changes based on configuration modification
CN110213371A (en) Information consumption method, apparatus, equipment and computer storage medium
CN111193605B (en) Fault positioning method and device and storage medium
EP3822790B1 (en) Data processing method and device
CN106331098A (en) Server cluster system
CN104618147B (en) A kind of vertical stack method for managing system and system
CN105337780B (en) A kind of server node configuration method and physical node
CN105446827A (en) Data storage method and device for database at failure
CN110377459A (en) A kind of disaster tolerance system, disaster tolerance processing method, monitoring node and backup cluster
CN108038005A (en) Shared resource access method, client, server-side, system based on zookeeper
CN105700975A (en) Heat removing method and device as well as heat adding method and device for CPUs
CN105871588A (en) Load balance configuration method, device and system
WO2017118318A1 (en) Data storage and service processing method and device
CN108259195A (en) The determining method and system of the coverage of anomalous event
CN109542627A (en) Node switching method, device, supervisor, node device and distributed system
CN107656847A (en) Node administration method, system, device and storage medium based on distributed type assemblies
CN110519354A (en) A kind of distributed objects storage system and its method for processing business and storage medium
CN108089968A (en) A kind of method of host&#39;s machine monitoring virtual-machine data storehouse state
CN109962914B (en) Firewall configuration method and device
CN107426012A (en) A kind of fault recovery method and its device based on super fusion architecture
CN107015767A (en) A kind of NAS device, distributed processing system(DPS) and method
CN107547622B (en) Resource adjusting method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200526

Address after: 310052 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Alibaba (China) Co.,Ltd.

Address before: 518030, Sannuo building, 19L02, 3012 Binhai Avenue, Shenzhen, Guangdong, Nanshan District

Patentee before: HEYI INTELLIGENT TECHNOLOGY (SHENZHEN) Co.,Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190312

Termination date: 20200815