CN111309485A - Service calling method and device, electronic equipment and computer readable storage medium - Google Patents
Service calling method and device, electronic equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN111309485A CN111309485A CN202010117839.9A CN202010117839A CN111309485A CN 111309485 A CN111309485 A CN 111309485A CN 202010117839 A CN202010117839 A CN 202010117839A CN 111309485 A CN111309485 A CN 111309485A
- Authority
- CN
- China
- Prior art keywords
- target
- time period
- service
- current time
- calling
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the invention discloses a service calling method, a service calling device, electronic equipment and a computer readable storage medium. An embodiment of the method comprises: acquiring the failure rate of calling the target service in the last time period; determining a target duration for suspending calling of the target service in the current time period based on the failure rate; determining one or more target time periods for suspending calling the target service in the current time period based on the target time length, wherein the time length is equal to the total time length of each target time period; in response to receiving a target request sent by a client, determining whether to invoke a target service based on a time period during which a current time is in a current time period. The method and the device can perform self-adaptive degradation and recovery of the service based on the health degree of the service in the last time period, shorten the duration of each service degradation and ensure the timeliness of responding to the user request in the service degradation process.
Description
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a service calling method, a service calling device, electronic equipment and a computer readable storage medium.
Background
The service degradation means that under the condition that the pressure of the server is increased sharply, some services are stopped or processed in a simple mode according to the actual business condition and flow, so that server resources are released to ensure normal or efficient operation of the servers. For example, in a video playing scenario, the more and more services are dependent, and once network jitter or a dependent service fails, the user playing experience is directly affected. At this time, service degradation needs to be performed temporarily.
In the existing method, generally, when the request amount reaches a certain preset value, the service is degraded by suspending part of user accesses, and when the access amount is lower than another preset value, the service is resumed. However, in this manner, the duration of service degradation is usually long, which results in that the access requests of some users cannot be responded for a long time, and especially for video playing and other scenes, this manner will result in that some users cannot obtain video content in time for a long time, which results in user churn.
Disclosure of Invention
The embodiment of the invention provides a service calling method, a service calling device, electronic equipment and a computer readable storage medium, and aims to solve the technical problem that a user request cannot be responded in time in a service degradation process in a video playing scene. The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a service invocation method, including: acquiring the failure rate of calling the target service in the last time period; determining a target duration for suspending calling of the target service in the current time period based on the failure rate; determining one or more target time periods for suspending calling the target service in the current time period based on the target time length, wherein the time length is equal to the total time length of each target time period; in response to receiving a target request sent by a client, determining whether to invoke a target service based on a time period during which a current time is in a current time period.
In a second aspect of the present invention, there is also provided a service invocation apparatus, including: an obtaining unit configured to obtain a failure rate of invoking a target service within a last time period; a first determination unit configured to determine a target duration for suspending the invocation of the target service within a current time period based on a failure rate; a second determination unit configured to determine one or more target time periods for which calling of the target service is suspended in the current time period based on the target time period, wherein the time period is equal to the total time period of the target time periods; and the third determination unit is configured to determine whether to call the target service based on a time period when the current time is in the current time cycle in response to receiving the data acquisition request sent by the client.
In a third aspect of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus; a memory for storing a computer program; a processor for implementing the method steps of any of claims 1 to 6 when executing a program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute any of the above-described service invocation methods.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above-described service invocation methods.
According to the service calling method, the service calling device, the electronic equipment and the computer readable storage medium provided by the embodiment of the invention, the failure rate of calling the target service in the previous time period is obtained, the target time length for pausing calling the target service in the current time period is determined based on the failure rate, and one or more target time periods for pausing calling the target service in the current time period are determined based on the target time length, so that when a target request sent by a client is received, whether the target service is called or not can be determined based on the time period of the current time in the current time period. Therefore, on one hand, the failure rate of calling the target service in the last time period can represent the health degree of the target service in the latest period of time, so that the time period for degrading the target service in the current time period is determined based on the failure rate, the target service can be degraded and recovered in a self-adaptive manner, and the service degradation is more flexible and timely. On the other hand, by setting the time period for the target service degradation processing in the current time period, the short-time service degradation and recovery can be performed for multiple times in the same period, the duration of each service degradation is shortened, and the timeliness of responding to the user request in the service degradation process is ensured.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flow diagram of one embodiment of a service invocation method according to the present application;
FIG. 2 is a flow diagram of yet another embodiment of a service invocation method according to the present application;
FIG. 3 is a schematic block diagram illustrating one embodiment of a service invocation device according to the present application;
FIG. 4 is a block diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Referring to FIG. 1, a flow 100 of one embodiment of a service invocation method according to the present application is shown. The service calling method comprises the following steps:
In this embodiment, the execution subject (e.g., an electronic device such as a server) of the service invocation method may set the time period in advance. For example, every 10 seconds may be taken as a time period. Thus, 00:00:00-00:00:10 per day is the first time period; 00:00:10-00:00:20 is the second time period; and so on.
At the beginning of each time period, the executing body may obtain a failure rate of invoking the target service in the previous time period. The failure rate of calling the target service in the last time period may be a ratio of the number of times of call failure in the last time period to the total number of times of call.
It should be noted that the target service may be a service provided by another server. For example, in a video playing scenario, the target service may be a video data acquisition service or the like. Generally, the more times the target service is called, the greater the access volume to the server, and the more stressed the server is, the more likely it is to fail.
In this embodiment, the execution body may record, in real time, a result of each invocation of the target service, where the result may be success of the invocation or failure of the invocation. At the beginning of each time period, the executing body may count the failure rate of calling the target service in the last time period based on the recorded calling result in the last time period.
In some optional implementation manners of this embodiment, the execution main body may first determine the number of times of calling and the number of times of failing to call the target service in the previous time period, and then determine a failure rate of calling the target service in the previous time period based on the number of times of calling and the number of times of failing to call. Here, the failure rate of invoking the target service in the last time period may be a ratio of the number of times of invocation failure to the total number of times of invocation in the last time period.
And 102, determining the duration of the suspended calling of the target service in the current time period based on the failure rate.
In this embodiment, the execution subject may determine, based on the failure rate, a duration of suspending the call to the target service in the current time period. Here, the duration of suspending the call of the target service in the current time period may be determined according to a preset formula or rule. For example, the product of the duration of the current time period and the failure rate may be used as the duration of the suspension of the call to the target service in the current time period.
In some optional implementations of the embodiment, the execution subject may determine a duration (which may be denoted as F) for suspending invoking the target service in the current time period by:
first, a first product of the duration (which may be denoted as T) of the current time period and the failure rate (which may be denoted as s%) is determined.
And secondly, determining a second product of the first product and a preset coefficient (which can be recorded as N), and taking the second product as the duration of suspending calling the target service in the current time period.
Thus, the calculation formula of the time length for suspending the calling of the target service in the current time period can be seen as follows:
F=T×s%×N
wherein the preset coefficient is set according to the importance of the target service. In practice, the higher the importance of the service, the larger the value of the corresponding preset coefficient is, so that the stability of the service can be ensured.
In this embodiment, the execution subject may determine one or more target time periods for suspending invoking the target service in the current time period based on the target time length. And the total duration of each target time period is equal to the target duration. The target time period is a time period for suspending the calling of the target service, that is, a time period for degrading the target service.
Because the failure rate of calling the target service in the last time period can represent the health degree of the target service in the last period of time, the greater the failure rate of calling the target service in the last time period is, the worse the health degree of the target service is, the more easily the fault occurs, and the longer the service degradation is required. Therefore, the time period for degrading the target service in the current time period is determined based on the failure rate, and the degradation time of the target service can be reasonably adjusted according to the health degree of the target service, so that the service degradation is more flexible.
In this embodiment, the execution subject may determine the target time period in the current time period by using various preset rules. As an example, one target period may be set at regular intervals. Therefore, the service degradation and recovery can be carried out for a short time for many times in the same period, the duration of each service degradation is shortened, and the timeliness of responding to the user request in the service degradation process is ensured. At the same time, the service degradation process can be made smoother.
In some optional implementations of this embodiment, the executing entity may determine the target time period in the current time period according to the following steps:
the method comprises the following steps that firstly, the current time period is divided into a plurality of time periods according to preset unit time length.
Here, the divided time periods may be fixed time periods, each of which has a duration equal to the set unit duration.
For example, the current time period is 00:00:00-00:00:10, and if 1 second is taken as a unit time length, 10 time periods of 00:00:00-00: 01, 00:00:01-00:00:02, 00:00:02-00:00:03 and the like can be divided. At this time, the number of unit time lengths included in the target time length is 10.
And secondly, determining the number of unit time lengths contained in the target time length.
Continuing with the above example, if the target duration is 4 seconds, the number of unit durations included in the target duration is 4.
And thirdly, uniformly selecting the time periods with the number from the time periods as target time periods for suspending calling the target service in the current time period.
It should be noted that, if the number of time periods cannot be uniformly selected from the plurality of time periods, the time periods can be selected approximately uniformly.
Continuing with the above example, if a non-target time period is represented by a "1" and a target time period is represented by a "0," then the 10 time periods may be represented as [1,0,1,0,1,0,1,0,1,1], where the target time periods are approximately evenly distributed in the current time cycle.
In the third step, optionally, the target time period may be determined in the following manner:
firstly, the number of unit time length contained in the target time length is added with one to obtain a target value. For example, if the number of unit time lengths included in the target time length is 4, the target value obtained by adding one is 5.
Then, a quotient of the total number of time segments in the current time period and the target value is determined. Continuing with the above example, if the number of time segments in the current time period is 10, the target value is 5, and the quotient is 2.
And finally, selecting a time period with the arrangement sequence equal to N times of the quotient from the current time period as a target time period for suspending calling the target service in the current time period, wherein N is a positive integer less than or equal to the number. Continuing with the above example, the time periods in which the rank order is equal to N times the quotient above are the 2 nd time period, the 4 th time period, the 6 th time period, and the 8 th time period. Thus, the results of [1,0,1,0,1,0,1,0,1,1] were obtained.
By uniformly selecting the target time period from the current time period, the flow (such as access requests and the like) can be uniformly transmitted to the target service, smooth degradation is further realized, and the timeliness of responding to the user request in the service degradation process is further ensured.
And step 104, in response to receiving the target request sent by the client, determining whether to invoke the target service based on the time period when the current time is in the current time cycle.
In this embodiment, in response to receiving a target request sent by a client, the execution subject may use the current time as a request time for invoking a target service, and determine whether to invoke the target service based on a time period in which the current time is located in the current time cycle.
Specifically, if the current time is in a non-target time period in the current time period, the target service may be invoked. If the current time is in the target time period in the current time cycle, the target service is not invoked. At this point, a service downgrade may be performed, suspending the invocation of the target service.
For example, a non-target time period is represented by "1", a target time period is represented by "0", 10 time periods included in the current time cycle are represented by [1,0,1,0,1,0,1,0,1,1], and each time period is 1 second. If the current time is within the first time period, it indicates that the current target service is available, and the target service may be invoked. After 3 seconds, the user's request is received again. The time at this time is in the 4 th time period, which is a target time period and represents that the current service is unavailable, and at this time, the calling of the target service is suspended.
In some optional implementations of this embodiment, in response to receiving a target request sent by a client, the execution main body may first determine whether a time period of a current time in the current time cycle is a target time period. If the target time period is not within the target time period, the target service can be called. If the target time period is reached, the alternative service can be called. Here, the alternative service may be an alternative service in which the target service is degraded.
As an example, in a video playing scene, the target request is a video data acquisition request. At this time, the target service may provide a service of acquiring the playing data of the user by a remote call, and acquiring the video data based on the playing data. The alternative service may be a service that obtains video data locally. Thereby, video data supply in the case of service degradation can be ensured.
According to the method provided by the embodiment of the application, the failure rate of calling the target service in the previous time period is obtained, then the target time length for pausing the calling of the target service in the current time period is determined based on the failure rate, and one or more target time periods for pausing the calling of the target service in the current time period are determined based on the target time length, so that when the target request sent by the client is received, whether the target service is called or not can be determined based on the time period of the current time in the current time period. Therefore, on one hand, the failure rate of calling the target service in the last time period can represent the health degree of the target service in the latest period of time, so that the time period for degrading the target service in the current time period is determined based on the failure rate, the target service can be degraded and recovered in a self-adaptive manner, and the service degradation is more flexible and timely. On the other hand, by setting the time period for the target service degradation processing in the current time period, the short-time service degradation and recovery can be performed for multiple times in the same period, the duration of each service degradation is shortened, and the timeliness of responding to the user request in the service degradation process is ensured.
With further reference to FIG. 2, a flow 200 of yet another embodiment of a service invocation method is illustrated. The flow 200 of the service invocation method includes the following steps:
In this embodiment, the execution subject (e.g., an electronic device such as a server) of the service invocation method may set the time period in advance. At the beginning of each time period, the executing body may obtain a failure rate of invoking the target service in the previous time period. The failure rate of calling the target service in the last time period may be a ratio of the number of times of call failure in the last time period to the total number of times of call.
It should be noted that step 201 may refer to step 101 in the embodiment corresponding to fig. 1, and this embodiment of the present application is not described again.
In this embodiment, the execution subject may determine, based on the failure rate, a duration of suspending the call to the target service in the current time period. Here, the duration of suspending the call of the target service in the current time period may be determined according to a preset formula or rule. For example, the product of the duration of the current time period and the failure rate may be used as the duration of the suspension of the call to the target service in the current time period. For another example, a first product of the duration of the current time period and the failure rate may be determined; and then determining a second product of the first product and a preset coefficient, and taking the second product as the duration of the suspended calling of the target service in the current time period.
It should be noted that step 202 may refer to step 102 in the embodiment corresponding to fig. 1, and details thereof are not repeated in this embodiment of the application.
In this embodiment, the execution subject may determine one or more target time periods for suspending invoking the target service in the current time period based on the target time length. And the total duration of each target time period is equal to the target duration. The target time period is a time period for suspending the calling of the target service, that is, a time period for degrading the target service.
As an example, the current time period may be first divided into a plurality of time periods according to a preset unit time length. Then, the number of unit time lengths included in the target time length is determined. And then, uniformly selecting the time periods of the number from the plurality of time periods as target time periods for suspending calling the target service in the current time period.
Because the failure rate of calling the target service in the last time period can represent the health degree of the target service in the last period of time, the greater the failure rate of calling the target service in the last time period is, the worse the health degree of the target service is, the more easily the fault occurs, and the longer the service degradation is required. Therefore, the time period for degrading the target service in the current time period is determined based on the failure rate, and the degradation time of the target service can be reasonably adjusted according to the health degree of the target service, so that the service degradation is more flexible and timely.
It should be noted that step 203 may refer to step 103 in the embodiment corresponding to fig. 1, and this embodiment of the present application is not described again.
And step 205, if not, calling the target service.
In this embodiment, if the current time is in a non-target time period in the current time cycle, that is, not in any target time period, the execution subject may invoke the target service.
As an example, in a video playing scene, the target request is a video data acquisition request. The target service is a service for acquiring the playing data of the user in a remote calling mode and acquiring the video data based on the playing data. At this time, the execution agent may perform the service provided by the target service by calling the service.
And step 206, if yes, calling the alternative service.
In this embodiment, if the current time is located in any target time period in the current time cycle, the execution subject may invoke the alternative service. At this time, the procedure of service degradation is adopted, and the calling of the target service is suspended in the procedure.
As an example, in a video playing scene, the target request is a video data acquisition request. The alternative service may be a service that obtains video data locally. Thereby, video data supply in the case of service degradation can be ensured.
As can be seen from fig. 2, compared to the corresponding embodiment of fig. 1, the flow 200 of the service invocation method in the present embodiment involves the step of invoking an alternative service when the service is downgraded. Thus, the scheme described in the present embodiment can guarantee video data supply in the case of service degradation.
With further reference to fig. 3, as an implementation of the method shown in the above-mentioned figures, the present application provides an embodiment of a service invocation apparatus, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 1, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 3, the service invocation device 300 according to the embodiment includes: an obtaining unit 301 configured to obtain a failure rate of invoking a target service in a last time period; a first determining unit 302, configured to determine a target duration for suspending the invocation of the target service in a current time period based on the failure rate; a second determining unit 303, configured to determine one or more target time periods for suspending invoking the target service in the current time period based on the target time period, where the time period is equal to a total time period of the target time periods; a third determining unit 304, configured to determine, in response to receiving the data obtaining request sent by the client, whether to invoke the target service based on a time period in which the current time is located in the current time cycle.
In some optional implementations of this embodiment, the obtaining unit 301 is further configured to: determining the calling times and the calling failure times of the target service in the last time period; and determining the failure rate of calling the target service in the last time period based on the calling times and the calling failure times.
In some optional implementations of the present embodiment, the first determining unit 302 is further configured to: determining a first product of a duration of the current time period and the failure rate; and determining a second product of the first product and a preset coefficient, and taking the second product as a target duration for pausing to invoke the target service in the current time period, wherein the preset coefficient is set according to the importance of the target service.
In some optional implementations of the present embodiment, the second determining unit 303 is further configured to: dividing the current time period into a plurality of time periods according to preset unit time length; determining the number of unit time lengths contained in the target time length; and uniformly selecting the time periods of the number from the plurality of time periods as target time periods for suspending calling the target service in the current time period.
In some optional implementations of the present embodiment, the second determining unit 303 is further configured to: adding one to the number to obtain a target value; determining a quotient of a total number of time periods in the current time period and the target value; and selecting a time period with the arrangement sequence equal to N times of the quotient from the current time period as a target time period for suspending calling the target service in the current time period, wherein N is a positive integer less than or equal to the number.
In some optional implementations of the present embodiment, the third determining unit 304 is further configured to: in response to receiving a target request sent by a client, determining whether a time period of which the current time is in the current time cycle is a target time period; if not, calling the target service; if yes, the alternative service is called.
In some optional implementation manners of this embodiment, the target request is a video data acquisition request; the target service is a service for acquiring playing data of a user in a remote calling mode and acquiring video data based on the playing data; the alternative service is a service for locally acquiring video data.
The device provided by the above embodiment of the application determines the target time duration for pausing the invocation of the target service in the current time period by obtaining the failure rate of invoking the target service in the previous time period, and determines one or more target time periods for pausing the invocation of the target service in the current time period based on the failure rate, so that when a target request sent by a client is received, whether the target service is invoked or not can be determined based on the time period of the current time in the current time period. Therefore, on one hand, the failure rate of calling the target service in the last time period can represent the health degree of the target service in the latest period of time, so that the time period for degrading the target service in the current time period is determined based on the failure rate, the target service can be degraded and recovered in a self-adaptive manner, and the service degradation is more flexible and timely. On the other hand, by setting the time period for the target service degradation processing in the current time period, the short-time service degradation and recovery can be performed for multiple times in the same period, the duration of each service degradation is shortened, and the timeliness of responding to the user request in the service degradation process is ensured.
An embodiment of the present invention further provides an electronic device, as shown in fig. 4, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404,
a memory 403 for storing a computer program;
the processor 401, when executing the program stored in the memory 403, implements the following steps:
acquiring the failure rate of calling the target service in the last time period;
determining a target duration for suspending the calling of the target service in the current time period based on the failure rate;
determining one or more target time periods for suspending the calling of the target service in the current time period based on the target time length, wherein the total time length of each target time period is equal to the target time length;
and in response to receiving a target request sent by a client, determining whether to call the target service based on a time period when the current time is in the current time cycle.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which has instructions stored therein, and when the instructions are executed on a computer, the instructions cause the computer to execute the service calling method in any one of the above embodiments.
In yet another embodiment, a computer program product containing instructions is provided, which when run on a computer, causes the computer to perform the service invocation method described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.
Claims (10)
1. A method for service invocation, characterized in that the method comprises:
acquiring the failure rate of calling the target service in the last time period;
determining a target duration for suspending the calling of the target service in the current time period based on the failure rate;
determining one or more target time periods for suspending the calling of the target service in the current time period based on the target time length, wherein the total time length of each target time period is equal to the target time length;
and in response to receiving a target request sent by a client, determining whether to call the target service based on a time period when the current time is in the current time cycle.
2. The method of claim 1, wherein obtaining the failure rate of invoking the target service within the last time period comprises:
determining the calling times and the calling failure times of the target service in the last time period;
and determining the failure rate of calling the target service in the last time period based on the calling times and the calling failure times.
3. The method of claim 2, wherein the determining a target duration for suspending the invocation of the target service within a current time period based on the failure rate comprises:
determining a first product of a duration of the current time period and the failure rate;
and determining a second product of the first product and a preset coefficient, and taking the second product as the target duration of the suspended calling of the target service in the current time period, wherein the preset coefficient is set according to the importance of the target service.
4. The method of claim 1, wherein the determining one or more target time periods within the current time period for which invoking the target service is suspended based on the target duration comprises:
dividing the current time period into a plurality of time periods according to preset unit duration;
determining the number of unit time lengths contained in the target time length;
and uniformly selecting the number of time periods from the plurality of time periods as target time periods for suspending calling the target service in the current time period.
5. The method of claim 4, wherein the uniformly selecting the number of time segments from the plurality of time segments as the target time segment for suspending the invocation of the target service in the current time period comprises:
adding one to the quantity to obtain a target value;
determining a quotient of a total number of time segments in the current time period and the target value;
and selecting a time period with the arrangement sequence equal to N times of the quotient from the current time period as a target time period for suspending calling the target service in the current time period, wherein N is a positive integer less than or equal to the number.
6. The method of claim 1, wherein the determining whether to invoke the target service based on a time period during which a current time is in the current time cycle in response to receiving a target request sent by a client comprises:
in response to receiving a target request sent by a client, determining whether a time period of which the current time is in the current time cycle is a target time period;
if not, calling the target service;
if yes, the alternative service is called.
7. The method of claim 6, wherein the target request is a video data acquisition request; the target service is a service for acquiring playing data of a user in a remote calling mode and acquiring video data based on the playing data; the alternative service is a service for locally acquiring video data.
8. An apparatus for invoking a service, the apparatus comprising:
an obtaining unit configured to obtain a failure rate of invoking a target service within a last time period;
a first determination unit configured to determine a target duration for suspending the invocation of the target service within a current time period based on the failure rate;
a second determining unit configured to determine one or more target time periods for suspending the calling of the target service in the current time period based on the target time period, wherein the time period is equal to the total time period of the target time periods;
a third determining unit configured to determine whether to invoke the target service based on a time period in which a current time is in the current time cycle in response to receiving a data acquisition request sent by a client.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 7 when executing a program stored in the memory.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010117839.9A CN111309485A (en) | 2020-02-25 | 2020-02-25 | Service calling method and device, electronic equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010117839.9A CN111309485A (en) | 2020-02-25 | 2020-02-25 | Service calling method and device, electronic equipment and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111309485A true CN111309485A (en) | 2020-06-19 |
Family
ID=71149335
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010117839.9A Pending CN111309485A (en) | 2020-02-25 | 2020-02-25 | Service calling method and device, electronic equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111309485A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111866129A (en) * | 2020-07-20 | 2020-10-30 | 北京百度网讯科技有限公司 | Method, device and medium for determining service availability index based on cloud platform |
CN112636971A (en) * | 2020-12-21 | 2021-04-09 | 北京字跳网络技术有限公司 | Service degradation method and device, electronic equipment and storage medium |
CN112732540A (en) * | 2020-12-11 | 2021-04-30 | 地平线征程(杭州)人工智能科技有限公司 | Method and device for determining hardware utilization rate, storage medium and electronic equipment |
CN113610372A (en) * | 2021-07-27 | 2021-11-05 | 远景智能国际私人投资有限公司 | Method, device, terminal and readable storage medium for determining service level agreement |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140325517A1 (en) * | 2013-04-02 | 2014-10-30 | Canon Kabushiki Kaisha | Server system, method for controlling the same, and program for executing parallel distributed processing |
CN107527244A (en) * | 2017-08-30 | 2017-12-29 | 微梦创科网络科技(中国)有限公司 | The autocontrol method and system of advertisement putting flow |
CN108683605A (en) * | 2018-06-12 | 2018-10-19 | 阿里巴巴集团控股有限公司 | A kind of current-limiting method and device of service call |
CN109144700A (en) * | 2018-09-03 | 2019-01-04 | 阿里巴巴集团控股有限公司 | Determination method, apparatus, server and the data processing method of overtime duration |
CN109218369A (en) * | 2017-07-05 | 2019-01-15 | 阿里巴巴集团控股有限公司 | remote procedure call request control method and device |
CN109257294A (en) * | 2018-09-07 | 2019-01-22 | 武汉斗鱼网络科技有限公司 | Service dynamic down method, device, server and storage medium based on redis |
-
2020
- 2020-02-25 CN CN202010117839.9A patent/CN111309485A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140325517A1 (en) * | 2013-04-02 | 2014-10-30 | Canon Kabushiki Kaisha | Server system, method for controlling the same, and program for executing parallel distributed processing |
CN109218369A (en) * | 2017-07-05 | 2019-01-15 | 阿里巴巴集团控股有限公司 | remote procedure call request control method and device |
CN107527244A (en) * | 2017-08-30 | 2017-12-29 | 微梦创科网络科技(中国)有限公司 | The autocontrol method and system of advertisement putting flow |
CN108683605A (en) * | 2018-06-12 | 2018-10-19 | 阿里巴巴集团控股有限公司 | A kind of current-limiting method and device of service call |
CN109144700A (en) * | 2018-09-03 | 2019-01-04 | 阿里巴巴集团控股有限公司 | Determination method, apparatus, server and the data processing method of overtime duration |
CN109257294A (en) * | 2018-09-07 | 2019-01-22 | 武汉斗鱼网络科技有限公司 | Service dynamic down method, device, server and storage medium based on redis |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111866129A (en) * | 2020-07-20 | 2020-10-30 | 北京百度网讯科技有限公司 | Method, device and medium for determining service availability index based on cloud platform |
CN111866129B (en) * | 2020-07-20 | 2023-03-14 | 北京百度网讯科技有限公司 | Method, device and medium for determining service availability index based on cloud platform |
CN112732540A (en) * | 2020-12-11 | 2021-04-30 | 地平线征程(杭州)人工智能科技有限公司 | Method and device for determining hardware utilization rate, storage medium and electronic equipment |
CN112636971A (en) * | 2020-12-21 | 2021-04-09 | 北京字跳网络技术有限公司 | Service degradation method and device, electronic equipment and storage medium |
CN112636971B (en) * | 2020-12-21 | 2023-01-10 | 北京字跳网络技术有限公司 | Service degradation method and device, electronic equipment and storage medium |
CN113610372A (en) * | 2021-07-27 | 2021-11-05 | 远景智能国际私人投资有限公司 | Method, device, terminal and readable storage medium for determining service level agreement |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111309485A (en) | Service calling method and device, electronic equipment and computer readable storage medium | |
CN111030936B (en) | Current-limiting control method and device for network access and computer-readable storage medium | |
CN107872489B (en) | File slice uploading method and device and cloud storage system | |
CN111046310A (en) | Page processing method, device, server and computer readable storage medium | |
CN110213653B (en) | Method and device for playing video | |
CN110417910B (en) | Notification message sending method, device, server and storage medium | |
CN110008050B (en) | Method and device for processing information | |
CN112837088B (en) | Advertisement putting method, advertisement putting device, advertisement putting medium and electronic equipment | |
CN110781149A (en) | Method, device, equipment and storage medium for managing live broadcast room information | |
CN108108126B (en) | Data processing method, device and equipment | |
CN112653736B (en) | Parallel source returning method and device and electronic equipment | |
CN109600254A (en) | The generation method and related system of full link log | |
CN107846429B (en) | File backup method, device and system | |
CN114221807B (en) | Access request processing method, device, monitoring equipment and storage medium | |
CN114756698A (en) | Play behavior detection method, equipment and storage medium | |
CN111400327B (en) | Data synchronization method and device, electronic equipment and storage medium | |
CN114745277A (en) | Elastic expansion method and device for public cloud cross-domain private line, electronic equipment and medium | |
JP6553650B2 (en) | Data processing method and system | |
CN114385354A (en) | Weight calculation method, system and medium based on server resource use condition | |
CN111625375A (en) | Account reservation method and device, storage medium and electronic equipment | |
CN112910936A (en) | Data processing method, device and system, electronic equipment and readable storage medium | |
CN113572824B (en) | Dynamic updating method and device for timeout duration, electronic equipment and storage medium | |
CN110912720B (en) | Information generation method and device | |
CN111291296B (en) | Content issuing method and device | |
CN107360441A (en) | Made a speech between a kind of user live broadcast control method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |