CN113282392A - Interface service calling method and device, electronic equipment and storage medium - Google Patents

Interface service calling method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113282392A
CN113282392A CN202110565791.2A CN202110565791A CN113282392A CN 113282392 A CN113282392 A CN 113282392A CN 202110565791 A CN202110565791 A CN 202110565791A CN 113282392 A CN113282392 A CN 113282392A
Authority
CN
China
Prior art keywords
interface
interface service
abnormal
service
degradation
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
Application number
CN202110565791.2A
Other languages
Chinese (zh)
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.)
Guahao Net Hangzhou Technology Co Ltd
Original Assignee
Guahao Net Hangzhou Technology 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 Guahao Net Hangzhou Technology Co Ltd filed Critical Guahao Net Hangzhou Technology Co Ltd
Priority to CN202110565791.2A priority Critical patent/CN113282392A/en
Publication of CN113282392A publication Critical patent/CN113282392A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Abstract

The application provides a calling method, a calling device, electronic equipment and a storage medium of an interface service, wherein the method comprises the following steps: responding an interface service call request, and determining degradation strategies configured correspondingly to an interface identifier and an input parameter according to the interface identifier and the input parameter carried by the call request; determining whether the interface service corresponding to the interface identifier is abnormal or not according to the degradation strategy; and executing the service operation indicated by the degradation strategy according to whether the interface service corresponding to the interface identifier is abnormal or not. According to the technical scheme provided by the embodiment of the application, different degradation strategies can be adapted to the interface service request through the interface identification and the input parameters carried in the call request, whether the interface service is abnormal or not is judged according to the degradation rule, and the interface service call request can be degraded in time when the interface service is abnormal.

Description

Interface service calling method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of internet, and in particular, to a method and an apparatus for invoking an interface service, an electronic device, and a storage medium.
Background
When the interface service is unavailable or the response time is long, the corresponding interface service call request needs to be degraded, so that the condition that a large number of requests are blocked in a server to cause downtime is avoided.
In the prior art, an interface service is defined as a protected resource through a Dubbo-Sentinel-support component provided by Sentinel, a user declares an interface service to be protected and a corresponding degradation rule when an application program is initialized, an Entry object is automatically created when the resource is called each time, and a series of functional slots are created simultaneously when the Entry is created. Such as: the Cluster BuilderSlot is used for storing statistical information of response time, abnormal constants, success numbers, calling amounts, thread numbers and the like of resources; the statesisticSlot realizes real-time statistics of call data by a sliding window data structure Leaparray, but in the prior art, a degradation strategy for an interface service call request matches different degradation strategies for the interface service call request through interface identification, service degradation is only supported to interface granularity, and the degradation mode is single.
Disclosure of Invention
The embodiment of the application aims to provide an interface service calling method, which adapts different degradation strategies through interface identifiers and input parameters carried in an interface service calling request.
A first aspect of an embodiment of the present application provides a method for calling an interface service, where the method includes:
responding an interface service call request, and determining degradation strategies configured correspondingly to an interface identifier and an input parameter according to the interface identifier and the input parameter carried by the call request;
determining whether the interface service corresponding to the interface identifier is abnormal or not according to the degradation strategy;
and executing the service operation indicated by the degradation strategy according to whether the interface service corresponding to the interface identifier is abnormal or not.
In an embodiment, before the determining the interface identifier and the configured downgrade policy corresponding to the input parameter, the method further includes:
and receiving the degradation strategy which is correspondingly configured by different interface identifications and input parameters pushed by the background.
In an embodiment, after receiving the interface identifier and the configured downgrading policy corresponding to the input parameter pushed in the background, the method further includes:
writing the different interface identifications and the degradation strategies configured correspondingly to the input parameters into a rule manager.
In an embodiment, the determining whether the interface service corresponding to the interface identifier is abnormal according to the degradation policy includes:
calculating the average response time of the interface service according to the response time of the interface service when calling each time and the calling times of the interface service;
when the average response time of the interface service is greater than a set threshold, the interface service is abnormal.
In an embodiment, the determining, according to the degradation policy, whether the interface service corresponding to the interface identifier is abnormal further includes:
and calculating the abnormal proportion of the interface service according to the abnormal times when the interface service is called and the total times of calling the interface service.
And when the abnormal proportion of the interface service is greater than the set threshold value, the interface service is abnormal.
In an embodiment, the performing, according to whether the interface service corresponding to the interface identifier is abnormal, the service operation indicated by the degradation policy includes:
and when the interface service is abnormal, refusing to access the interface service within the specified time, and displaying abnormal information or returning a fixed result.
In an embodiment, the executing, according to whether the interface service corresponding to the interface identifier is abnormal, the service operation indicated by the degradation policy further includes:
and when the interface service is not abnormal, controlling the interface service to respond to the calling request.
A second aspect of an embodiment of the present application provides an interface service invoking device, including:
the strategy matching module is used for responding to an interface service calling request, and determining a degradation strategy which is correspondingly configured by an interface identifier and an input parameter according to the interface identifier and the input parameter which are carried by the calling request;
the strategy judgment module is used for determining whether the interface service corresponding to the interface identifier is abnormal or not according to the degradation strategy;
and the strategy execution module executes the service operation indicated by the degradation strategy according to whether the interface service corresponding to the interface identifier is abnormal or not.
A third aspect of embodiments of the present application provides an electronic device, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to execute a calling method of the interface service of the first aspect of the embodiments of the present application and any embodiment thereof.
A fourth aspect of the present embodiments provides a computer-readable storage medium, where a computer program is stored, and the computer program is executable by a processor to perform the method for invoking an interface service described above.
According to the technical scheme provided by the embodiment of the application, the interface identification and the input parameters carried in the interface service calling request can be used for adapting different degradation strategies for the interface service calling request, whether the interface service corresponding to the interface identification is abnormal or not is determined according to the degradation strategies, the interface service calling request can be timely degraded when the interface service is abnormal, and the interface service calling request can be adapted to the degradation strategies from a plurality of latitudes when the interface service calling request is degraded by adopting the mode.
When interface services are unavailable or response times are long, this can result in no response or long waiting times for access by the user, resulting in a large number of requests being blocked in the server and thus causing a downtime condition. Therefore, the calling request of the unavailable interface service can be failed quickly by configuring the degradation strategy for the interface service, so that a large number of requests are prevented from being blocked in the server, and the main process can run normally.
Drawings
In order to more clearly explain the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that for those skilled in the art, other related drawings can be obtained from these drawings without inventive effort.
Fig. 1 is a schematic view of an application scenario of an interface service invocation method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 3 is a schematic flowchart illustrating a method for calling an interface service according to an embodiment of the present application;
FIG. 4 is a detailed flowchart of step S310 in the corresponding embodiment of FIG. 3;
fig. 5 is a block diagram illustrating an interface service invoking device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
Like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and cannot be construed as indicating or implying relative importance.
Fig. 1 is a schematic view of an application scenario of a method for calling an interface service according to an embodiment of the present application. As depicted in fig. 1, the method may include a server 110, a backend 120, and a client 130. The server 110 and the background 130 may be a desktop computer, etc., and the client 130 may be a smart phone, a notebook computer, or a desktop computer, etc.
The server 130 may perform the matching degradation policy by using the method provided in the embodiment of the present application, and determine whether the interface service is abnormal and execute a corresponding service operation.
Fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 200 may serve as the server 110, and the electronic device 200 may be configured to execute a method for calling an interface service provided in the embodiment of the present application. As shown in fig. 2, the electronic device 200 includes: one or more processors 202, and one or more memories 204 storing processor-executable instructions. Wherein the processor 202 is configured to execute a calling method of an interface service provided by the following embodiments of the present application.
The processor 202 may be a device containing a Central Processing Unit (CPU), a Graphics Processing Unit (GPU) or other form of processing unit having data processing and/or instruction execution capabilities, may process data for other components in the electronic device 200, and may control other components in the electronic device 200 to perform desired functions.
The memory 204 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. On which one or more computer program instructions may be stored that may be executed by processor 202 to implement the calling methods of the interface service described below. Various applications and various data, such as various data used and/or generated by the applications, may also be stored in the computer-readable storage medium.
In one embodiment, the electronic device 200 shown in FIG. 2 may also include an input device 206, an output device 208, and a data acquisition device 210, which may be interconnected via a bus system 212 and/or other type of connection mechanism (not shown). It should be noted that the components and configuration of the electronic device 200 shown in FIG. 2 are exemplary only, and not limiting, and the electronic device 200 may have other components and configurations as desired.
The input device 206 may be a device used by a user to input instructions and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like. The output device 208 may output various information (e.g., images or sounds) to the outside (e.g., a user), and may include one or more of a display, a speaker, and the like. The data acquisition device 210 may acquire an image of a subject and store the acquired image in the memory 204 for use by other components. Illustratively, the data acquisition device 210 may be a camera.
In an embodiment, the components in the example electronic device 200 for implementing the method for calling the interface service according to the embodiment of the present application may be integrally disposed or may be separately disposed, such as the processor 202, the memory 204, the input device 206, and the output device 208 are integrally disposed, and the data acquisition device 210 is separately disposed.
In an embodiment, the example electronic device 200 for implementing the calling method of the interface service of the embodiment of the present application may be implemented as an intelligent device such as a computer and a server.
Fig. 3 is a flowchart illustrating a method for calling an interface service according to an embodiment of the present application. The method may be performed by a server, as shown in fig. 3, and includes the following steps S310 to S330.
Step S310: responding to a call request of an interface service, and determining a degradation strategy configured correspondingly to an interface identifier and an input parameter according to the interface identifier and the input parameter carried by the call request.
In one embodiment, the interface service is an interface for providing access calls to other application systems, and the number of the interface services may be multiple.
When a user initiates a call request of an interface service at a client, a server responds to the call request of the interface service, analyzes the call request of the interface service to obtain an interface identifier and an input parameter carried in the call request, and determines a degradation strategy configured correspondingly by the interface identifier and the input parameter.
The interface identifier is used for distinguishing different interface services, and the input parameter is used for indicating data called by the interface services.
For example, when a user requests to query the scheduling information of all doctors in a certain hospital at a client, the user requests to call an interface service for providing the scheduling information of doctors, and when the user inputs a hospital ID of a doctor scheduling information table to be queried at the client, the following steps are performed: and when the user inputs the third hospital, the server responds to the calling request of the doctor scheduling information of the third hospital, and analyzes that the interface identifier carried in the calling request is the doctor scheduling information and the input parameter is the third hospital, and then the server determines a degradation strategy which is correspondingly configured for providing the interface service of the doctor scheduling information of the third hospital according to the interface identifier and the input parameter, namely the doctor scheduling information of the third hospital.
In an embodiment, when a user initiates a call request of an interface service at a client, the call request of the interface service first enters an interceptor of a server, and a corresponding degradation policy is searched in a rule manager through an interface identifier and an input parameter carried in the call request.
For example, if the user requests to query "doctor shift scheduling information of the third hospital", the request for querying "doctor shift scheduling information of the third hospital" will enter the interceptor of the server, and the interface identifier "doctor shift scheduling information" and the input parameter "third hospital" are used to determine the degradation policy configured corresponding to the interface service providing "doctor shift scheduling information of the third hospital".
For example, when a user requests to query inventory of children's tops of a certain brand, the user requests to call an interface service for providing inventory of children's tops, when the user inputs a name of a brand of the inventory of children's tops to be queried, the name of the brand input by the user is a zebra board, the server responds to the call request of the inventory information of children's tops of the zebra board, and resolves that an interface identifier carried in the call request is the inventory information of children's tops and an input parameter is the zebra board, and the server determines a degradation strategy corresponding to the configuration of the interface service for providing the inventory information of children's tops of the zebra board according to the interface identifier of the inventory information of children's tops and the input parameter of the zebra board.
In one embodiment, the user may configure the interface service to be protected in the background, and configure the corresponding degradation policy for the interface service to be protected. When the interface service requested to be called by the user is the interface service to be protected, executing the step S310; when the interface service which is requested to be called by the user is the interface service which does not need protection, the interface service can be normally accessed at the moment.
In an embodiment, when the interface identifier and the input parameter carried in the call request are not matched with the degradation policy configured corresponding to the interface service, the interface service requested to be called by the user is the interface service which does not need to be protected, and the interface service can be normally accessed at this time.
In one embodiment, the purpose of setting the interface service to be protected by the user through the background is to save the running time of the server, if all the interface services are set as the interface services to be protected, the user needs to configure corresponding degradation strategies for all the interface services at the background, and the client needs to execute the steps when requesting to call the corresponding interface services, which greatly increases the running time of the server; however, when the running performance of the server is high, all the interface services can also be set as the interface services to be protected.
The method and the device have different degradation strategies according to different input parameters, and compared with the prior art that only one degradation strategy is available for one interface service, the diversity of the degradation strategies is realized, so that the method and the device can be adapted to various different application scenes.
Step S320: and determining whether the interface service corresponding to the interface identifier is abnormal or not according to the degradation strategy.
And determining a degradation strategy configured corresponding to the interface service according to the interface identifier and the input parameters carried in the call request, and determining whether the interface service corresponding to the interface identifier is abnormal or not according to the degradation strategy.
For example, when the user requests to query "doctor scheduling information of the third hospital", the server determines the degradation strategy configured corresponding to the interface service providing the "doctor scheduling information of the third hospital" according to the interface identifier "doctor scheduling information" and the input parameter "third hospital", and determines whether the interface service providing the "doctor scheduling information of the third hospital" is abnormal or not according to the degradation strategy.
The degradation strategy is used as a measure for judging whether the interface service is abnormal, and the abnormal interface service refers to no response or long-time waiting state when the user calls the interface service.
In one embodiment, the degradation policy may be to determine whether the interface service corresponding to the interface identifier is abnormal by calculating an average response time of the interface service invocation request.
The average response time can be calculated according to the response time of the interface service when calling each time and the calling times of the interface service, that is, the server can count the response time and the total calling times of the interface service when calling each time, sum the response times to obtain the total response time of the interface service when calling, and perform ratio operation on the total response time of the interface service when calling and the calling times of the interface service to obtain the average response time of the interface service when calling.
When the average response time of the interface service is larger than the set average response time threshold, the interface service is abnormal; and when the average response time of the interface service is smaller than the set threshold, the interface service is not abnormal, and the threshold corresponding to the average response time is stored in the server.
For example: when a user requests to inquire 'zebra child jacket inventory information', and a degradation strategy corresponding to an interface service providing the 'zebra child jacket inventory information' is to determine whether the interface service is abnormal or not through average response time, a server counts response time and total call times of the interface service providing the 'zebra child jacket inventory information' when the interface service is called each time, when the response time of the interface service providing the 'zebra child jacket inventory information' when the interface service is called is respectively 2s, 3s, 2s and 3s, the total response time of the interface service providing the 'zebra child jacket inventory information' is 10s, the call times are 4, and the average response time of the interface service providing the 'zebra child jacket inventory information' is 2.5 s.
When the set average response time threshold is 2s, the interface service providing the zebra-card children jacket inventory information is abnormal; and when the set average response time threshold is 3s, the interface service of the zebra child jacket inventory information is not abnormal.
In an embodiment, when the average response time of the interface service invocation request is 0, the average response time is a time difference between the current time and the time when the interface service invocation request is first issued.
For example, after the user issues a call request of "scheduling information of a doctor in a third hospital", the server does not respond to the request for a long time, if the user calls an interface service providing the "scheduling information of the doctor in the third hospital" for the first time, the average response time at this time is 0, if the time difference between the current time and the time when the call request of the interface service is issued is 10 minutes, the average response time at this time is 10 minutes, and on this basis, the average response time is compared with the average response time threshold value to determine whether the interface service is abnormal.
After the user sends out the calling request of 'doctor in third hospital' scheduling information ', the server does not respond to the request for a long time, at the moment, the user sends out the calling request of' doctor in third hospital 'scheduling information' for a plurality of times, but the server does not respond to the request, if the time difference between the current time and the time when the interface service calling request is sent out for the first time is 15 minutes, the average response time is 15 minutes, and on the basis, the average response time is compared with the average response time threshold value so as to determine whether the interface service is abnormal or not.
In another embodiment, the downgrading policy may be to determine whether the interface service corresponding to the interface identifier is abnormal by calculating an abnormal proportion of the interface service call requests.
The abnormal proportion can be calculated according to the abnormal times of the interface service during calling and the total calling times of the interface service, namely the server counts the abnormal times and the total calling times of the interface service during calling, and performs ratio operation on the abnormal times of the interface service during calling and the total calling times of the interface service to obtain the abnormal proportion of the interface service during calling.
When the abnormal proportion of the interface service during calling is larger than the set abnormal proportion threshold value, the interface service is abnormal; when the abnormal proportion of the interface service during calling is smaller than the set threshold, the interface service is not abnormal, and the abnormal proportion threshold is stored in the server.
For example, when a user requests to query "zebra child jacket inventory information", and the degradation policy corresponding to the interface service providing the "zebra child jacket inventory information" is to determine whether the interface service is abnormal or not according to an abnormal ratio, the server may count the number of times of abnormality and the total number of times of call of the interface service providing the "zebra child jacket inventory information", when the interface service providing the "zebra child jacket inventory information" is called, the number of times of abnormality is 2, and the total number of times of call is 10, then the abnormal ratio of the interface service providing the zebra child jacket inventory information "when called is 0.2.
When the set abnormal proportion threshold value is 0.1, the interface service providing the zebra board children jacket inventory information is abnormal; when the set abnormal proportion threshold value is 0.3, the interface service providing the zebra child jacket inventory information is not abnormal.
Step S330: and executing the service operation indicated by the degradation strategy according to whether the interface service corresponding to the interface identifier is abnormal or not.
The downgrading strategy comprises downgrading rules and a rollback strategy, wherein the downgrading rules can be used for judging whether the interface service corresponding to the interface identification is abnormal, and the rollback strategy can be used for indicating the specific content of a fixed result to be returned when the interface service is abnormal.
In an embodiment, according to the degradation rule, when it is determined that the interface service corresponding to the interface identifier is not abnormal, a call request of the interface service is responded.
For example, when a user requests to query "zebra child jacket inventory information" and it is determined according to the degradation policy that the interface service providing the "zebra child jacket inventory information" is not abnormal, the server responds to the call request of the "zebra child jacket inventory information".
In an embodiment, when the interface service corresponding to the interface identifier is abnormal, access to the interface service is denied within a specified time, and a rollback policy is executed to display abnormal information or return a fixed result.
In an embodiment, according to the degradation rule, if it is determined that the interface service corresponding to the interface identifier is not abnormal, access to the interface service is denied within a specified time, and abnormal information is displayed or a fixed result is returned.
In one embodiment, the specified time may be 5 s.
For example, when a user requests to query "zebra child jacket inventory information", and determines that the interface service providing the "zebra child jacket inventory information" is abnormal according to the degradation policy, the user rejects the call request of the "zebra child jacket inventory information" within a specified time, and displays abnormal information such as "Error" or returns a fixed result such as "ACCESS _ 999999" to the client, so that the user can perform subsequent processing on the abnormal condition in time.
When part of the interface services are unavailable, returning a fixed result can enable the main process to continue, for example, the comment list query interface service of the commodity is down at the moment, but the commodity query and ordering service is normal, the commodity comment list can be returned to be empty, the user can still normally access the commodity information to perform ordering operation, and the condition that the commodity ordering service is unavailable due to the unavailable comment list interface service is avoided.
In an embodiment, as shown in fig. 4, before the step S310, the method provided in the embodiment of the present application may further include:
step S410: and receiving the degradation strategies which are correspondingly configured by different interface identifications and input parameters pushed by the background.
And the user can configure the degradation strategies corresponding to the different interface identifiers and the input parameters in the background and push the corresponding degradation strategies to the server, wherein the degradation strategies are in one-to-one correspondence with the interface identifiers and the input parameters.
For example, when the user requests to query "doctor scheduling information of the third hospital", the server receives the degradation policy, which is pushed by the background and configured corresponding to the interface identifier "doctor scheduling information" and the input parameter "third hospital", in advance.
In an embodiment, a user may configure an interface service to be protected in the background, configure a corresponding degradation policy for the interface service to be protected, dynamically adjust the protected interface service and the degradation policy thereof during the running process of a program, and push corresponding configuration information to a server through the background.
Step S420: writing the different interface identifications and the degradation strategies configured correspondingly to the input parameters into a rule manager.
When the server receives the degradation strategies correspondingly configured by different interface identifiers and input parameters pushed by the background, the corresponding degradation strategies are written into the rule manager of the server.
For example, when the user requests to query "doctor scheduling information of the third hospital", the server writes the interface identifier "doctor scheduling information" pushed by the background and the degradation policy configured corresponding to the input parameter "third hospital" into the rule manager of the server.
Fig. 5 is a block diagram of a calling device of an interface service according to an embodiment of the present application. As shown in fig. 5, the apparatus includes a policy matching module 610, a policy determining module 620, and a policy executing module 630.
The policy matching module 610 responds to an interface service call request, and determines a degradation policy configured corresponding to an interface identifier and an input parameter according to the interface identifier and the input parameter carried by the call request.
The policy determining module 620 determines whether the interface service corresponding to the interface identifier is abnormal according to the degradation policy.
The policy executing module 630 executes the service operation indicated by the degradation policy according to whether the interface service corresponding to the interface identifier is abnormal.
The implementation process of the function and the action of each module in the device is specifically described in detail in the implementation process of the corresponding step in the interface service calling method, and is not described herein again.
In the embodiments provided in the present application, the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

Claims (10)

1. A method for invoking an interface service, the method comprising:
responding an interface service call request, and determining degradation strategies configured correspondingly to an interface identifier and an input parameter according to the interface identifier and the input parameter carried by the call request;
determining whether the interface service corresponding to the interface identifier is abnormal or not according to the degradation strategy;
and executing the service operation indicated by the degradation strategy according to whether the interface service corresponding to the interface identifier is abnormal or not.
2. The method of claim 1, wherein prior to said determining the configured degradation policy corresponding to the interface identifier and the input parameter, the method further comprises:
and receiving the degradation strategies which are correspondingly configured by different interface identifications and input parameters pushed by the background.
3. The method of claim 2, wherein after receiving the configured downgrade policy corresponding to the different interface identifiers and input parameters of the background push, the method further comprises:
writing the different interface identifications and the degradation strategies configured correspondingly to the input parameters into a rule manager.
4. The method of claim 1, wherein said determining whether the interface service corresponding to the interface identifier is abnormal according to the degradation policy comprises:
calculating the average response time of the interface service according to the response time of the interface service when calling each time and the calling times of the interface service;
when the average response time of the interface service is greater than a set threshold, the interface service is abnormal.
5. The method of claim 1, wherein said determining whether the interface service corresponding to the interface identifier is abnormal according to the degradation policy further comprises:
and calculating the abnormal proportion of the interface service according to the abnormal times when the interface service is called and the total times of calling the interface service.
And when the abnormal proportion of the interface service is greater than the set threshold value, the interface service is abnormal.
6. The method according to claim 1, wherein the performing the service operation indicated by the degradation policy according to whether the interface service corresponding to the interface identifier is abnormal or not comprises:
and when the interface service is abnormal, refusing to access the interface service within the specified time, and displaying abnormal information or returning a fixed result.
7. The method according to claim 1, wherein the performing the service operation indicated by the degradation policy according to whether the interface service corresponding to the interface identifier is abnormal further comprises:
and when the interface service is not abnormal, controlling the interface service to respond to the calling request.
8. An apparatus for invoking an interface service, the apparatus comprising:
the strategy matching module is used for responding to an interface service calling request, and determining a degradation strategy which is correspondingly configured by an interface identifier and an input parameter according to the interface identifier and the input parameter which are carried by the calling request;
the strategy judgment module is used for determining whether the interface service corresponding to the interface identifier is abnormal or not according to the degradation strategy;
and the strategy execution module is used for executing the service operation indicated by the degradation strategy according to whether the interface service corresponding to the interface identifier is abnormal or not.
9. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to execute the calling method of the interface service of any one of claims 1-7.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program executable by a processor to perform the method of calling the interface service of any one of claims 1 to 7.
CN202110565791.2A 2021-05-24 2021-05-24 Interface service calling method and device, electronic equipment and storage medium Pending CN113282392A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110565791.2A CN113282392A (en) 2021-05-24 2021-05-24 Interface service calling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110565791.2A CN113282392A (en) 2021-05-24 2021-05-24 Interface service calling method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113282392A true CN113282392A (en) 2021-08-20

Family

ID=77281185

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110565791.2A Pending CN113282392A (en) 2021-05-24 2021-05-24 Interface service calling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113282392A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500301A (en) * 2022-01-13 2022-05-13 珠海紫讯信息科技有限公司 Service degradation method and system based on service scene
CN115934479A (en) * 2023-03-15 2023-04-07 天聚地合(苏州)科技股份有限公司 Interface service control method, device, storage medium and equipment
CN116233250A (en) * 2022-11-28 2023-06-06 荣耀终端有限公司 Service calling method and gateway equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677466A (en) * 2015-12-31 2016-06-15 百度在线网络技术(北京)有限公司 Method and device for degrading handling of third-party application interface
CN107454138A (en) * 2017-06-19 2017-12-08 阿里巴巴集团控股有限公司 The implementation method and device that business degrades
CN112134721A (en) * 2020-08-17 2020-12-25 福建天泉教育科技有限公司 API gateway degradation method and terminal
CN112398700A (en) * 2020-12-07 2021-02-23 平安普惠企业管理有限公司 Service degradation method and device, storage medium and computer equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677466A (en) * 2015-12-31 2016-06-15 百度在线网络技术(北京)有限公司 Method and device for degrading handling of third-party application interface
CN107454138A (en) * 2017-06-19 2017-12-08 阿里巴巴集团控股有限公司 The implementation method and device that business degrades
CN112134721A (en) * 2020-08-17 2020-12-25 福建天泉教育科技有限公司 API gateway degradation method and terminal
CN112398700A (en) * 2020-12-07 2021-02-23 平安普惠企业管理有限公司 Service degradation method and device, storage medium and computer equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500301A (en) * 2022-01-13 2022-05-13 珠海紫讯信息科技有限公司 Service degradation method and system based on service scene
CN116233250A (en) * 2022-11-28 2023-06-06 荣耀终端有限公司 Service calling method and gateway equipment
CN116233250B (en) * 2022-11-28 2023-12-15 荣耀终端有限公司 Service calling method and gateway equipment
CN115934479A (en) * 2023-03-15 2023-04-07 天聚地合(苏州)科技股份有限公司 Interface service control method, device, storage medium and equipment
CN115934479B (en) * 2023-03-15 2023-07-25 天聚地合(苏州)科技股份有限公司 Interface service control method, device, storage medium and equipment

Similar Documents

Publication Publication Date Title
CN113282392A (en) Interface service calling method and device, electronic equipment and storage medium
US10698559B2 (en) Method and apparatus for displaying content on same screen, and terminal device
CN113285883A (en) Access request current limiting method and device, electronic equipment and storage medium
CN108881396B (en) Network data loading method, device, equipment and computer storage medium
US10178194B2 (en) Intelligent notifications to devices with multiple applications
CN104937584A (en) Providing optimized quality of service to prioritized virtual machines and applications based on quality of shared resources
CN112836152B (en) Page rendering method, system, computer device and computer readable storage medium
US20220109605A1 (en) Implementing Affinity and Anti-Affinity with Kubernetes
CN107038194B (en) Page jump method and device
US11263107B2 (en) Application development support system and application development support method
CN113765980A (en) Current limiting method, device, system, server and storage medium
US20080005143A1 (en) Methods and apparatus for automatically creating composite configuration items in configuration management database
CN111324471A (en) Service adjusting method, device, equipment and storage medium
CN109800261B (en) Dynamic control method and device for double-database connection pool and related equipment
US20230171329A1 (en) Systems and methods for rendering interactive web pages
CN114398631A (en) Business processing method and device, electronic equipment and storage medium
CN109871260B (en) Multi-dimensional service current limiting method and system based on shared memory between containers
US11836528B2 (en) Throttling thread resources of service computing platform
CN113536168B (en) Component processing method and device
CN114827157A (en) Cluster task processing method, device and system, electronic equipment and readable medium
CN113377548A (en) Identification generation method and device, computer equipment and storage medium
CN115052168B (en) Label acquisition method, device, server and storage medium
CN114860350B (en) Data processing method and device based on cloud diskless tree-like mirror image
CN108536438B (en) Dotting module, method and computer readable medium for processing user behavior data
US20240089339A1 (en) Caching across multiple cloud environments

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