Service multi-level degradation method, system, device, and medium
By using pre-degradation and post-degradation processing and configuring pre-processing and post-processing using a degradation configuration table, the user experience problem when internet platform services are unavailable is solved. This achieves non-intrusive multi-level degradation, avoids server overload, and ensures timely user response.
Patent Information
- Application Number
- CN201910058630.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-01-22
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2039-01-22
AI Technical Summary
When internet platforms are unavailable, existing technologies are unable to effectively degrade services, resulting in a reduced user experience.
By using pre-degradation and post-degradation processing and configuring pre-processing and post-processing using a degradation configuration table, configurable and non-intrusive multi-level degradation can be achieved, avoiding large traffic surges to upstream application servers and ensuring timely responses for users.
It achieves the ability to avoid large traffic surges to upstream servers through pre-degradation processing without affecting core functions, and to ensure timely user response through post-degradation processing, thus realizing configurable multi-level degradation.
Smart Images

Figure CN111459652B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of Internet, more particularly, to a service multi-level degradation method, system, device and medium. BACKGROUND
[0002] Internet platforms will encounter some services occasionally unavailable, such as machine load is too high, machine downtime, network is not connected, access is too large, etc., and if directly returning an error to the user will lead to the whole experience reduction, in this case, some services should be degraded without affecting the core function, to ensure service available with loss. Service degradation refers to, when the server pressure increases, according to the actual business situation and traffic, some services and pages are not processed or processed in a simple way with strategy, so as to release server resources to ensure the normal operation or efficient operation of core transactions. SUMMARY
[0003] In view of the problems in the prior art, the purpose of the present application is to provide a service multi-level degradation method, system, device and medium, which can perform pre-degradation processing and post-degradation processing on the service request issued, avoid the upstream application server from being impacted by large traffic through pre-degradation processing, ensure that the user can get timely response through post-degradation processing, and realize configurable and non-intrusive multi-level degradation through degradation configuration table to configure post-degradation processing and pre-degradation processing.
[0004] According to one aspect of the present application, a service multi-level degradation method is provided, comprising:
[0005] receiving a service request issued by a user;
[0006] According to the service request, a degradation configuration table corresponding to the service request is matched in a degradation controller, the degradation configuration table including pre-processing degradation conditions and post-processing degradation conditions;
[0007] determining whether the pre-processing degradation conditions in the degradation configuration table are met:
[0008] if yes, pre-degradation processing is performed, and the degradation result is returned to the user;
[0009] if no, the service request is sent to the corresponding application server;
[0010] receiving response data issued by the application server in response to the service request; and
[0011] determining whether the post-processing degradation conditions in the degradation configuration table are met:
[0012] If yes, a post-degradation process is performed, and a degradation result is returned to the user;
[0013] If no, the received response data is returned to the user.
[0014] Preferably, the user is a client or the application server.
[0015] Preferably, the matching of the degradation configuration table corresponding to the service request in a degradation controller according to the service request comprises the following steps:
[0016] Obtaining a degradation keyword according to a request URL in the service request;
[0017] Matching the degradation configuration table in the degradation controller according to the degradation keyword.
[0018] Preferably, the pre-degradation condition comprises a first identifier, and the pre-degradation condition is satisfied if the first identifier of the pre-degradation condition is 1.
[0019] Preferably, the pre-degradation condition comprises a time window and a first threshold value, and the pre-degradation condition is satisfied if the number of invocations of data pointed to by the request URL in the time window is greater than the first threshold value.
[0020] Preferably, the pre-degradation process comprises the following steps:
[0021] Matching data corresponding to the request URL in a cache database according to the request URL in the service request;
[0022] Returning the matched data corresponding to the request URL to the user.
[0023] Preferably, the response data comprises an http status code, and the post-degradation condition is that the http status code is 200, 404, 500 or 502.
[0024] Preferably, the post-degradation condition is that the response time of the application server receiving the service request is greater than a preset second threshold value.
[0025] Preferably, the returning of the received response data to the user further comprises caching the response data in the cache database.
[0026] Preferably, the post-degradation process comprises the following steps:
[0027] matching the request URL in the service request with a cache database to obtain data corresponding to the request URL;
[0028] returning the data corresponding to the request URL to the user.
[0029] Preferably, the post-fallback processing and returning the fallback result to the user comprises the following steps: returning the hard-coded fallback content pre-stored in the fallback configuration table as the fallback result to the user.
[0030] Preferably, the post-fallback processing and returning the fallback result to the user comprises the following steps:
[0031] running a Groovy script pre-stored in the fallback configuration table and returning the running result to the user.
[0032] According to an aspect of the present application, there is provided a service multi-level fallback system for implementing the service multi-level fallback method, comprising:
[0033] a request receiving module for receiving a service request sent by a user;
[0034] a fallback configuration obtaining module for matching a fallback configuration table corresponding to the service request in a fallback controller according to the service request, wherein the fallback configuration table comprises pre-processing fallback conditions and post-processing fallback conditions;
[0035] a first judging module for judging whether the pre-processing fallback conditions in the fallback configuration table are satisfied;
[0036] a pre-processing module for performing pre-fallback processing and returning the fallback result to the user;
[0037] a request forwarding module for sending the service request to a corresponding application server;
[0038] a data receiving module for receiving response data sent by the application server in response to the service request;
[0039] a second judging module for judging whether the post-processing fallback conditions in the fallback configuration table are satisfied;
[0040] a post-processing module for performing post-fallback processing and returning the fallback result to the user;
[0041] a data returning module for returning the received response data to the user.
[0042] According to an aspect of the present application, there is provided a service multi-level fallback device, comprising:
[0043] a processor;
[0044] a memory having stored therein executable instructions of the processor;
[0045] wherein the processor is configured to perform the steps of the service multi-level degradation method via execution of the executable instructions.
[0046] According to an aspect of the present application, there is provided a computer readable storage medium for storing a program which, when executed, implements the steps of the service multi-level degradation method.
[0047] The above technical solution has the following advantages:
[0048] The present application can perform pre-degradation processing and post-degradation processing on the outgoing service request, avoids the upstream application server from being impacted by large traffic through pre-degradation processing, and guarantees that the user can obtain timely response through post-degradation processing; the post-degradation processing and pre-degradation processing are configured through a degradation configuration table, and the multi-level degradation is realized in a configurable and non-intrusive manner.
[0049] Other features and advantages of the present application as well as the structure and operation of various embodiments of the present application will be more fully understood from the following detailed description taken in conjunction with the accompanying drawings. It should be noted that the present application is not limited to the specific embodiments described herein. The embodiments given herein are merely for illustrative purposes. BRIEF DESCRIPTION OF DRAWINGS
[0050] Other features, objects and advantages of the present application will become more apparent from the following detailed description when read in conjunction with the accompanying drawings.
[0051] Figure 1 For a preferred embodiment of the present application, a specific implementation scenario of a service multi-level degradation method;
[0052] Figure 2 For a preferred embodiment of the present application, a flowchart of a service multi-level degradation method;
[0053] Figure 3 For a preferred embodiment of the present application, a timing diagram of a service multi-level degradation method;
[0054] Figure 4 For a preferred embodiment of the present application, a structural block diagram of a service multi-level degradation system;
[0055] Figure 5 For a preferred embodiment of the present application, a structural diagram of a service multi-level degradation device;
[0056] Figure 6 For a preferred embodiment of the present application, a structural diagram of a computer readable storage medium.
[0057] The features and advantages of the present application will become more apparent from the detailed description set forth below when taken in conjunction with the drawings. Throughout the drawings, identical reference numerals are used to designate similar, equivalent, and / or identical components. In the drawings: DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0059] The terms "first", "second", and similar terms used in the present disclosure do not denote any order, quantity, or importance, but are used to distinguish different constituent parts. The terms "include", "comprise", and similar terms mean that the elements or objects before the terms encompass the elements or objects listed after the terms and their equivalents, and do not exclude other elements or objects. The terms "connect" and "couple" and similar terms are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. The terms "upper", "lower", "left", "right", and the like are used only to indicate relative positional relationships, and when the absolute positions of the described objects are changed, the relative positional relationships can also be changed accordingly.
[0060] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0061] The present application will be further described below with reference to the drawings and specific embodiments, but is not limited to the present application.
[0062] Figure 1 It is a specific implementation scenario of a service multi-level degradation method according to an embodiment of the present application. Figure 1The illustrated implementation scenario includes a client 101, an access server 102, a degradation controller 103, and application servers (104, 105, 106), each of which can provide a service, for example, in an e-commerce platform, the application server 104 is used to provide order settlement services, the application server 105 is used to provide a commodity detail page, and the application server 106 is used to provide inventory deduction services. The access server 102 is a reverse proxy server, which can be a Nignx reverse proxy server, used to receive service requests sent by the client 101. After receiving the service request, the access server 102 will search for the corresponding degradation configuration table in the degradation controller 103, and perform pre-degradation processing and post-degradation processing according to the content of the degradation configuration table. If the access server 102 does not need to perform pre-degradation processing according to the degradation configuration table, it will send the service request to the corresponding application server, for example, the client 101 requests to provide a commodity detail page, if it does not need to perform pre-degradation processing, the access server 102 will send the service request to the application server 105. The response data of the application server is sent to the access server 102, and then the access server 102 sends the response data to the client 101.
[0063] Figure 2 A flowchart of a service multi-level degradation method according to an embodiment of the present application. Figure 3 For Figure 2 A timing diagram of the service multi-level degradation method in Figure 1 The service multi-level degradation method will be described in detail below based on the implementation scenario in
[0064] Reference is made to the accompanying drawings Figure 2 and the accompanying drawings Figure 3 The service multi-level degradation method in the present application includes: step S101, receiving a service request sent by a user; step S102, according to the service request, matching a degradation configuration table corresponding to the service request in a degradation controller 103, the degradation configuration table including pre-processing degradation conditions and post-processing degradation conditions; step S103, judging whether the pre-processing degradation conditions in the degradation configuration table are met: step S104, if yes, performing pre-degradation processing, and returning the degradation result to the user; step S105, if not, sending the service request to the corresponding application server; step S106, receiving response data sent by the application server in response to the service request; step S107, judging whether the post-processing degradation conditions in the degradation configuration table are met: step S108, if yes, performing post-degradation processing, and returning the degradation result to the user; step S109, if not, returning the received response data to the user.
[0065] In step S101, the access server 102 receives a service request sent by a user. The client 101 sends a service request to the access server 102, and the service request is used to visit and obtain corresponding services.
[0066] In step S102, the access server 102 matches a downgrade configuration table corresponding to the service request in the downgrade controller 103 according to the received service request. The downgrade configuration table includes pre-processing downgrade conditions and post-processing downgrade conditions. The request URL is included in the service request. The access server 102 obtains a downgrade key (KEY) according to the request URL in the service request. The KEY can be selected from part of the parameters in the request URL, for example, the characters in the request URL $url?$arg_shopId. Then the access server 102 matches the downgrade configuration table in the downgrade controller 103 according to the downgrade key. Each downgrade configuration table is identified by a KEY. The downgrade controller 103 selects the corresponding downgrade configuration table according to the KEY sent by the access server 102, and returns the downgrade configuration table to the access server 102.
[0067] The downgrade configuration table includes items: KEY, force, strategy (text; cache; mock), cacheTime, call, status, and timeout. The KEY is used to identify the entire downgrade configuration table, and the request URL can be directly used as the content of the KEY item. The force item stores a first identifier, and the first identifier has a value of 0 or 1. When the first identifier is 1, pre-processing is performed. The strategy (text; cache; mock) item stores a downgrade strategy. The text indicates a hard-coded downgrade content, the cache indicates that the cache content is used as the downgrade result, and the mock indicates a Groovy script. The status stores a status code. The call item stores a first threshold value, and the timeout item stores a second threshold value.
[0068] In step 103, the access server 102 judges whether the pre-processing downgrade condition in the downgrade configuration table is satisfied. If yes, the process goes to step S104. If no, the process goes to step S105. The pre-processing downgrade condition is stored in the force or call in the downgrade configuration table.
[0069] The pre-processing downgrade condition can be the content stored in the force item. If the first identifier of the pre-processing downgrade condition is 1, the pre-processing downgrade condition is satisfied.
[0070] The pre-processing degradation condition can be the content stored in the call item, which includes a time window, a first threshold value, and a degradation percentage. If the number of invocations of the data pointed to by the request URL within the time window is greater than the first threshold value, the pre-processing degradation condition is satisfied. For example, the time window can be selected as 5m, the first threshold value is 1000 times, and the percentage is 100%. If the number of invocations of the data pointed to by the request URL within 5m is greater than 1000 times, the service request is pre-degraded.
[0071] In step S104, the access server 102 performs pre-degradation processing on the service request. The degradation strategy of the pre-degradation processing is the content of the strategy (text; cache; mock) item in the degradation configuration table. The access server 102 can perform pre-degradation processing according to any one of text; cache; mock, or sequentially.
[0072] When the text item stores corresponding content, the access server 102 returns the hard-coded degradation content pre-stored in the degradation configuration table to the user as the degradation result of the pre-degradation processing.
[0073] When the cache item stores corresponding content, the pre-degradation processing of the access server 102 is to match the data corresponding to the request URL in a cache database according to the request URL in the service request; and return the matched data corresponding to the request URL to the user. The access server 102 will periodically store the response data in the cache database of the access server 102, and the cacheTime item in the degradation configuration table stores the cache time of the response data corresponding to the request URL. The cache database can also be a distributed cache, such as a Redis database, set in other server clusters.
[0074] The mock item stores a Groovy script, and the pre-degradation processing performed by the access server 102 is to run the Groovy script in the degradation configuration table, and return the running result to the user.
[0075] The above three pre-degradation processing methods can be used alone, or two or three can be used simultaneously. As long as the maintenance personnel sets the corresponding content in the degradation configuration table, the access server 102 can perform the corresponding pre-degradation processing.
[0076] In step S105, the access server 102 sends the service request to the corresponding application server 105. After the access server 102 sends the service request to the application server 105, the application server 105 responds to the service request. For example, the service request of the user is to request the product detail page of the product, and the access server 102 sends the service request to the application server 105.
[0077] In step S106, the access server 102 receives the response data sent by the application server 105. The application server 105 finds the corresponding response data according to the request URL in the service request, and sends the response data to the access server 102, which receives the response data.
[0078] In step S107, the access server 102 judges whether the post-processing downgrade condition in the downgrade configuration table is met. If the post-processing downgrade condition is met, the process goes to step S108. If the post-processing downgrade condition is not met, the process goes to step S109.
[0079] The post-processing downgrade condition is the content stored in the status item or the content stored in the timeout item in the downgrade configuration table. The status stores the http status code, which is 200, 404, 500 or 502. The post-processing downgrade condition is that the http status code in the response data is included in the status. The http status code in the response data is any one of 200, 404, 500 or 502, which satisfies the post-processing downgrade condition corresponding to the status item.
[0080] The post-processing downgrade condition can also be that the response time of the application server 105 receiving the service request is greater than a preset second threshold value. The second threshold value is stored in the timeout item of the downgrade configuration table, and the second threshold value can be 10s, 5s or 6s. The response time of the application server 105 to the service request sent by the access server 102 exceeds the second threshold value, i.e. the application server 105 does not send response data to the access server 102 within 10s, 5s or 6s.
[0081] In step S108, the access server 102 performs post-downgrade processing and returns the downgrade result to the user. After the post-processing downgrade condition configured in the downgrade configuration table is met, the access server 102 performs post-downgrade processing.
[0082] The post-downgrade processing includes:
[0083] When the text item stores the corresponding content, the access server 102 returns the hard-coded downgrade content pre-stored in the downgrade configuration table as the downgrade result of the post-downgrade processing to the user;
[0084] When the cache item stores corresponding content, the post-fallback processing of the access server 102 is to match the request URL in the service request with data corresponding to the request URL in a cache database, and return the matched data corresponding to the request URL to the user. The access server 102 stores the response data in the cache database of the access server 102 at regular intervals, and the cacheTime item in the fallback configuration table stores the cache time of the response data corresponding to the request URL. The cache database can also be a distributed cache, such as a Redis database, set in other server clusters.
[0085] The Mock item stores a Groovy script, and the post-fallback processing performed by the access server 102 is to run the Groovy script in the fallback configuration table and return the running result to the user.
[0086] In step S109, the received response data is returned to the user. When the post-processing fallback condition is not met, the access server 102 returns the response data to the user.
[0087] The user in the present application can be the client 101 or other application servers. For example, the application server 104 for providing order settlement services can call part of the data of the application server 105 for providing product detail pages, at which time the application server 104 serves as a user to issue a service request, and the access server 102 performs steps S101 to S109 to provide response data for the application server 104. The information interaction between the client 101 and the application server is performed through the access server 102. The information interaction between the various application servers is also performed through the access server 102.
[0088] According to an aspect of the present application, a service multi-level fallback system is provided for implementing the service multi-level fallback method described above.
[0089] Figure 4 A structural block diagram of the service multi-level fallback system. The service multi-level fallback system 400 includes:
[0090] The request receiving module 401 receives a service request issued by a user;
[0091] The fallback configuration obtaining module 402 matches a fallback configuration table corresponding to the service request in a fallback controller according to the service request, and the fallback configuration table includes pre-processing fallback conditions and post-processing fallback conditions;
[0092] The first judgment module 403 judges whether the pre-processing fallback conditions in the fallback configuration table are met:
[0093] The pre-processing module 404 performs pre-fallback processing and returns the fallback result to the user;
[0094] The request forwarding module 405 sends the service request to the corresponding application server 105;
[0095] The data receiving module 406 receives the response data sent by the application server in response to the service request;
[0096] The second judging module 407 judges whether the post-processing downgrade condition in the downgrade configuration table is met;
[0097] The post-processing module 408 performs post-downgrade processing and returns the downgrade result to the user;
[0098] The data returning module 409 returns the received response data to the user.
[0099] According to an aspect of the present application, a service multi-level downgrade device is provided, comprising:
[0100] a processor;
[0101] a memory, wherein executable instructions of the processor are stored;
[0102] The processor is configured to execute the steps of the above service multi-level downgrade method via execution of the executable instructions.
[0103] Reference Figure 5 , Figure 5 is a structural schematic diagram of the service multi-level downgrade device of the present application. The electronic device 600 according to this embodiment of the present application will be described below with reference to Figure 5 . Figure 5 The electronic device 600 shown is merely an example and should not impose any limitation on the function and use range of the embodiments of the present application.
[0104] As shown in Figure 5 , the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 can include but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.
[0105] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps of various exemplary embodiments according to the present application described in the above electronic prescription flow processing method part of the specification. For example, the processing unit 610 can execute the steps as shown in Figure 2 .
[0106] Storage 620 can include a readable medium in the form of volatile memory, such as random access memory (RAM) 6201 and / or cache memory 6202, and can further include non-volatile memory, such as read only memory (ROM) 6203.
[0107] Storage 620 can also include program / utility 6204 having a set of at least one program modules 6205, such as an operating system, one or more application programs, other program modules, and program data, each of which
[0108] Bus 630 can represent one or more of several types of bus structures, including a storage bus or bus controller, a peripheral bus, an accelerated graphics port, an input / output bus, and a local bus using any of a variety of bus architectures.
[0109] Electronic device 600 can also communicate with one or more external devices 700 such as a keyboard or pointing device, using one or more communication interfaces 650. Communication interfaces 650 can also enable electronic device 600 to communicate with one or more devices that enable user interaction with electronic device 600 (for example, remote control or weaponry) and / or communication with one or more other computing devices. Such communication can be facilitated, for example, by an input / output (I / O) interface 650. Electronic device 600 can also communicate with one or more networks (for example, a local area network (LAN), a wide area network (WAN), and / or the public network, such as the Internet) through a network adapter 660. Network adapter 660 can communicate with the other modules of electronic device 600 through bus 630. It should be appreciated that other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms, etc.
[0110] According to an aspect of the present application, a computer readable storage medium for storing a program, the program being executed to implement the steps of the service multi-level degradation method described above.
[0111] Figure 6 is a structural diagram of the computer readable storage medium of the present application. Referring to Figure 6As shown, a program product 800 for implementing the above-described method according to an embodiment of the present application is described, which can take the form of a portable compact disc read-only memory (CD-ROM) and includes a program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto, and in the present document, the readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus or device.
[0112] The program product can take any combination of one or more readable media. The readable media can be a readable signal medium or a readable storage medium. The readable storage medium, for example, can be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0113] The computer readable storage medium can include a data signal carried by a carrier wave or a propagated signal, where the readable program code is carried by the data signal. Such a propagated signal can take any of a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination thereof. The readable storage medium can also be any readable medium that is not a storage medium and that can be used to carry or store program code in any form, where the program code can be utilized or directed by an instruction execution system, apparatus or device. Program code carried by the readable storage medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical fiber, RF, or any suitable combination of the above.
[0114] The program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++, or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computing device, such as through the Internet using an Internet Service Provider.
[0115] In summary, the application can perform pre-degradation processing and post-degradation processing on the service request, avoid the upstream application server from being impacted by large traffic through pre-degradation processing, and ensure that the user can obtain timely response through post-degradation processing; the post-degradation processing and pre-degradation processing are configured through a degradation configuration table, and multi-level degradation in a configurable and non-invasive manner is achieved.
[0116] The above is a further detailed description of the application in combination with specific preferred embodiments, and the specific implementation of the application should not be limited to these descriptions. For ordinary skilled persons in the technical field of the application, some simple deductions or substitutions can be made without departing from the concept of the application, and all of them should be considered as falling within the protection scope of the application.
Claims
1. A method for service multi-level degradation, the method comprising: Applied to an access server, comprising: receiving a service request sent by a user; according to the service request, matching a downgrade configuration table corresponding to the service request in a downgrade controller, the downgrade configuration table including pre-processing downgrade conditions, post-processing downgrade conditions and downgrade strategies, wherein the downgrade strategies include hard-coded downgrade content, cache content as downgrade result, Groovy script, and the post-processing downgrade conditions are the content stored in the status item or the content stored in the timeout item in the downgrade configuration table; determining whether the pre-processing downgrade conditions in the downgrade configuration table are met: if yes, performing pre-downgrade processing and returning the downgrade result to the user; if no, sending the service request to the corresponding application server; receiving response data sent by the application server in response to the service request; determining whether the post-processing downgrade conditions in the downgrade configuration table are met: if yes, performing post-downgrade processing and returning the downgrade result to the user; if no, returning the received response data to the user; wherein the pre-downgrade processing and returning the downgrade result to the user include: returning the hard-coded downgrade content pre-stored in the downgrade configuration table as the downgrade result of pre-downgrade processing to the user; matching the data corresponding to the request URL in a cache database according to the request URL in the service request, and returning the matched data corresponding to the request URL to the user; running the Groovy script in the downgrade configuration table, and returning the running result to the user.
2. The service multi-level degradation method of claim 1, wherein, The user is a client or the application server.
3. The service multi-level degradation method of claim 1, wherein, The matching of the downgrade configuration table corresponding to the service request in the downgrade controller according to the service request includes the following steps: obtaining a downgrade keyword according to the request URL in the service request; matching the downgrade configuration table in the downgrade controller according to the downgrade keyword.
4. The method of claim 1, wherein, The pre-processing downgrade condition includes a first identifier, and if the first identifier of the pre-processing downgrade condition is 1, the pre-processing downgrade condition is met.
5. The method of claim 3, wherein, The pre-processing downgrade condition includes a time window and a first threshold value, and if the number of calls of the data pointed to by the request URL in the time window is greater than the first threshold value, the pre-processing downgrade condition is met.
6. The method of claim 1, wherein, The pre-downgrade processing and returning the downgrade result to the user include the following steps: matching the data corresponding to the request URL in a cache database according to the request URL in the service request; returning the matched data corresponding to the request URL to the user.
7. The service multi-level degradation method of claim 1, wherein, The response data includes an http status code, and the post-processing downgrade condition is that the http status code is 200, 404, 500 or 502.
8. The service multi-level degradation method of claim 1, wherein, The post-processing downgrade condition is that the response time of the application server receiving the service request is greater than a preset second threshold value.
9. The method of claim 1, wherein, After returning the received response data to the user, the method further includes caching the response data in the cache database.
10. The method of claim 1, wherein, The post-processing is performed, and the degradation result is returned to the user, including the following steps: According to the request URL in the service request, data corresponding to the request URL is matched in a cache database; The data corresponding to the request URL is returned to the user.
11. The method of claim 1, wherein, The post-processing is performed, and the degradation result is returned to the user, including the following steps: the hard-coded degradation content pre-stored in the degradation configuration table is returned to the user as the degradation result.
12. The method of claim 1, wherein, The post-processing is performed, and the degradation result is returned to the user, including the following steps: A Groovy script pre-stored in the degradation configuration table is run, and the running result is returned to the user.
13. A service multi-level degradation system for implementing the service multi-level degradation method according to any one of claims 1 to 12, characterized in that, Applied to an access server, including: A request receiving module receives a service request sent by a user; A degradation configuration obtaining module matches a degradation configuration table corresponding to the service request in a degradation controller according to the service request, the degradation configuration table including pre-processing degradation conditions, post-processing degradation conditions, and degradation strategies, wherein the degradation strategies include hard-coded degradation content, cache content as degradation result, and Groovy script, and the post-processing degradation conditions are the content stored in the status item or the content stored in the timeout item in the degradation configuration table; A first judging module judges whether the pre-processing degradation conditions in the degradation configuration table are met: A pre-processing module performs pre-degradation processing, and returns the degradation result to the user; A request forwarding module sends the service request to a corresponding application server; A data receiving module receives response data sent by the application server in response to the service request; A second judging module judges whether the post-processing degradation conditions in the degradation configuration table are met; A post-processing module performs post-degradation processing, and returns the degradation result to the user; A data returning module returns the received response data to the user; The pre-processing module is further configured to return the hard-coded degradation content pre-stored in the degradation configuration table to the user as the degradation result of pre-degradation processing; match data corresponding to the request URL in a cache database according to the request URL in the service request, and return the matched data corresponding to the request URL to the user; and run the Groovy script in the degradation configuration table, and return the running result to the user.
14. A service multi-level degradation device, characterized by, Including: A processor; A memory having executable instructions of the processor stored therein; The processor is configured to execute the steps of the service multi-level degradation method of any one of claims 1-12 by executing the executable instructions.
15. A computer readable storage medium for storing a program, characterized in that, The program is executed to implement the steps of the service multi-level degradation method of any one of claims 1-12.
Citation Information
Patent Citations
Data transmission method and device
CN108259526A