CN113179188A - Service degradation dynamic realization method and device, computer equipment and storage medium - Google Patents

Service degradation dynamic realization method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113179188A
CN113179188A CN202110575120.4A CN202110575120A CN113179188A CN 113179188 A CN113179188 A CN 113179188A CN 202110575120 A CN202110575120 A CN 202110575120A CN 113179188 A CN113179188 A CN 113179188A
Authority
CN
China
Prior art keywords
degradation
service
logic
preset
message
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.)
Granted
Application number
CN202110575120.4A
Other languages
Chinese (zh)
Other versions
CN113179188B (en
Inventor
魏梦召
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Pingan Zhihui Enterprise Information Management Co ltd
Original Assignee
Shenzhen Pingan Zhihui Enterprise Information Management 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 Shenzhen Pingan Zhihui Enterprise Information Management Co ltd filed Critical Shenzhen Pingan Zhihui Enterprise Information Management Co ltd
Priority to CN202110575120.4A priority Critical patent/CN113179188B/en
Publication of CN113179188A publication Critical patent/CN113179188A/en
Application granted granted Critical
Publication of CN113179188B publication Critical patent/CN113179188B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/50Network service management, e.g. ensuring proper service fulfilment according to agreements
    • H04L41/5003Managing SLA; Interaction between SLA and QoS
    • H04L41/5019Ensuring fulfilment of SLA
    • H04L41/5025Ensuring fulfilment of SLA by proactively reacting to service quality change, e.g. by reconfiguration after service quality degradation or upgrade

Abstract

The embodiment of the application belongs to the field of software monitoring, and relates to a dynamic realization method for service degradation, which comprises the following steps: receiving a service degradation message; responding to the service degradation message, and acquiring degradation logic from a degradation container in a preset degradation plug-in; calling a preset dynamic compiler, and dynamically compiling the degradation logic to generate a degradation class; and operating the degradation class to realize service degradation. The method comprises the steps of storing the degradation logic in a degradation container, decoupling the degradation logic code from the core service code, interfacing the degradation logic, versioning, multiplexing the degradation logic and switching versions. Meanwhile, the dynamic configuration of the degradation logic in the degradation container can switch the degradation logic in real time according to the service logic, so that the service requirement is met. The method solves the defects that the existing degradation scheme can not be dynamically switched and can not meet the service timeliness. The application also provides a device for dynamically realizing the service degradation, computer equipment and a storage medium.

Description

Service degradation dynamic realization method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of software monitoring technologies, and in particular, to a method and an apparatus for dynamically implementing service degradation, a computer device, and a storage medium.
Background
The microservice architecture is an emerging software architecture style, and a complete application system is formed by developing some microservices. And the service degradation is the degradation of some services and pages with policies according to the current service condition and flow under the condition that the pressure of the server is increased, so that the server resources are released to ensure the normal operation of the core task. The current remote invocation framework dubbo (open source distributed service framework) or micro service governance framework Hystrix provides corresponding service degradation logic, and aims to invoke a degradation method when a service invocation problem occurs. The existing degradation logic is usually included in a core business code in a hard coding mode, the requirements of business cannot be dynamically adapted, and when the degradation logic needs to be changed, the whole process of writing, compiling and version releasing of the business code needs to be carried out, so that the time consumption is long.
Disclosure of Invention
An embodiment of the present application provides a method, an apparatus, a computer device, and a storage medium for dynamically implementing service degradation, so as to solve the problem that time consumption is long when a service degradation logic is dynamically changed.
In order to solve the above technical problem, an embodiment of the present application provides a method for dynamically implementing service degradation, which adopts the following technical solutions:
receiving a service degradation message;
responding to the service degradation message, and acquiring degradation logic from a degradation container in a preset degradation plug-in;
calling a preset dynamic compiler, and dynamically compiling the degradation logic to generate a degradation class;
and operating the degradation class to realize service degradation.
Further, the step of receiving the service degradation message further includes:
receiving return data of a service request target;
analyzing the returned data to obtain the state parameters of the request target;
and comparing the state parameter with a preset service degradation condition, and triggering a service degradation message when the state parameter is consistent with the service degradation condition.
Further, the preset service degradation condition includes N service degradation rules, each service degradation rule is in a preset matching relationship with the state parameter of the request target, and the step of comparing the state parameter with the preset service degradation condition, and when the state parameter is consistent with the service degradation condition, triggering the service degradation message includes:
comparing the state parameters with preset service degradation conditions to obtain service degradation rules matched with the state parameters;
analyzing a degradation logic parameter in a service degradation rule, and writing the degradation logic parameter into a service degradation message;
triggering a service downgrade message including the downgrade logic parameter.
Further, the service downgrading message includes interface information, and the step of acquiring the downgrading logic from the downgrading container in the preset downgrading plug-in response to the service downgrading message specifically includes:
and acquiring the degradation logic corresponding to the interface information from the degradation container according to the interface information.
Further, before the step of obtaining the demotion logic from the demotion container in the preset demotion plug-in response to the service demotion message, the method further includes:
receiving a configuration change notification sent by a preset degradation logic configuration center;
and responding to the configuration change notification, calling a synchronization thread, and synchronizing the configuration change of the downgrade logic configuration center to the downgrade container.
Further, the configuration change notification includes an interface corresponding to the updated downgrade logic, and the step of receiving the configuration change notification sent by the preset downgrade logic configuration center further includes:
analyzing the configuration change notification to obtain an interface corresponding to the updated degradation logic;
and calling a synchronization thread, and synchronizing the updated demotion logic into the demotion container according to the interface.
Further, the configuration change notification further includes updated version information of updated downgrade logic, and the step of receiving the configuration change notification sent by the preset downgrade logic configuration center further includes:
analyzing the configuration change notification to obtain updated version information of the updated downgraded logic;
reading current version information of the degradation logic corresponding to the interface in the degradation container according to the interface;
and comparing the updated version information with the current version information, calling a synchronization thread when the updated version information is inconsistent with the current version information, and synchronizing the updated downgrade logic into the downgrade container according to the interface.
In order to solve the above technical problem, an embodiment of the present application further provides a device for dynamically implementing service degradation, which adopts the following technical solutions:
a receiving module for receiving a service degradation message;
the obtaining module is used for responding to the service degradation instruction and obtaining degradation logic from a degradation container in a preset degradation plug-in;
the compiling module is used for calling a preset dynamic compiler and dynamically compiling the degradation logic to generate a degradation class;
and the operation module is used for operating the degradation class to realize service degradation.
Further, the receiving module further includes:
the first receiving submodule is used for receiving the return data of the service request target;
the first analysis submodule is used for analyzing the return data to obtain the state parameters of the request target;
and the first triggering submodule is used for comparing the state parameter with a preset service degradation condition and triggering a service degradation message when the state parameter is consistent with the service degradation condition.
Further, the preset service degradation condition includes N service degradation rules, and each service degradation rule is preset with a matching relationship with the state parameter of the request target, and the first triggering sub-module includes:
the first comparison subunit is used for comparing the state parameter with a preset service degradation condition to obtain a service degradation rule matched with the state parameter;
the first analysis subunit is used for analyzing the degradation logic parameter in the service degradation rule and writing the degradation logic parameter into the service degradation message;
a first triggering subunit, configured to trigger a service downgrading message including the downgrading logic parameter.
Further, the service degradation message includes interface information, and the obtaining module includes:
and the first obtaining submodule is used for obtaining the degradation logic corresponding to the interface information from the degradation container according to the interface information.
Further, the service degradation dynamic implementation apparatus further includes:
the second receiving submodule is used for receiving a configuration change notice sent by a preset degradation logic configuration center;
and the first synchronization submodule is used for responding to the configuration change notification, calling a synchronization thread and synchronizing the configuration change of the degradation logic configuration center to the degradation container.
Further, the second receiving sub-module further includes:
the second analysis subunit is used for analyzing the configuration change notification to obtain an interface corresponding to the updated degradation logic;
and the first synchronization subunit is used for calling a synchronization thread and synchronizing the updated downgrade logic into the downgrade container according to the interface.
Further, the configuration change notification further includes updated version information of updated downgrade logic, and the second receiving submodule further includes:
a third parsing subunit, configured to parse the configuration change notification to obtain update version information of the updated downgrade logic;
the first reading subunit is used for reading the current version information of the degradation logic corresponding to the interface in the degradation container according to the interface;
and the second synchronization subunit is used for comparing the updated version information with the current version information, calling a synchronization thread when the updated version information is inconsistent with the current version information, and synchronizing the updated downgrade logic into the downgrade container according to the interface.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
a computer device comprising a memory and a processor, the memory having stored therein computer readable instructions, the processor implementing the steps of the service degradation dynamic implementation method as described above when executing the computer readable instructions.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
a computer readable storage medium, having computer readable instructions stored thereon, which when executed by a processor, implement the steps of the service degradation dynamic implementation method as described above.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects: by receiving a service downgrade message; responding to the service degradation message, and acquiring degradation logic from a degradation container in a preset degradation plug-in; calling a preset dynamic compiler, and dynamically compiling the degradation logic to generate a degradation class; and operating the degradation class to realize service degradation. The method comprises the steps of storing the degradation logic in a degradation container, decoupling the degradation logic code from the core service code, interfacing the degradation logic, versioning, multiplexing the degradation logic and switching versions. Meanwhile, the dynamic configuration of the degradation logic in the degradation container can switch the degradation logic in real time according to the service logic, so that the service requirement is met. The method solves the defects that the existing degradation scheme can not be dynamically switched and can not meet the service timeliness.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for dynamic implementation of service downgrades according to the present application;
FIG. 3 is a block diagram illustrating an embodiment of an apparatus for dynamically implementing service downgrades according to the present application;
FIG. 4 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the service degradation dynamic implementation method provided by the embodiments of the present application is generally implemented byServer/terminal Terminal equipmentImplementation, accordingly, the service degradation dynamic implementation means is generally arrangedServer/terminal deviceIn (1).
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continuing reference to FIG. 2, a flow diagram of one embodiment of a method for dynamic implementation of service downgrades is shown, according to the present application. The dynamic realization method for the service degradation comprises the following steps:
step S201, a service degradation message is received.
In this embodiment, the method for dynamically implementing service degradationElectronic devices running thereon (e.g. as shown in FIG. 1)Garment Server/terminal device) The service degradation message may be received through a wired connection or a wireless connection. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, a uwb (ultra wideband) connection, and other wireless connection means now known or developed in the future.
And the service degradation is the degradation of some services and pages with policies according to the current service condition and flow under the condition that the pressure of the server is increased, so that the server resources are released to ensure the normal operation of the core task. When the service calls other targets and the target returns data exception, the current service is triggered to degrade. The service degradation message refers to a message for performing service degradation on the current service triggered according to parameters contained in return data when target return data is abnormal.
The ways of service degradation include: page rejection service (i.e. page prompt service is busy), page delay service, interface rejection service (page is normally displayed, but addition and deletion operations cannot be performed), and the like.
Step S202, responding to the service degradation message, and acquiring degradation logic from a degradation container in a preset degradation plug-in.
In this embodiment, the downgrade plug-in is preset and decoupled from the core business code of the service. The preset degradation plug-in comprises a degradation container, and degradation logic is stored in the degradation container. And when receiving the service degradation message, reading the degradation logic from the degradation container in the preset degradation plug-in. Destaging logic is synchronized into a destaging container from a preset destaging logic configuration center. When the downgrade logic needs to be changed, a code writer or an operator uploads new downgrade logic or switches the downgrade logic to a preset downgrade logic configuration center, the downgrade logic configuration center sends a change notice, and the downgrade plug-in responds to the change notice, calls a synchronization thread and synchronizes the change of the downgrade logic to a downgrade container. By presetting the degradation plug-in and the degradation logic configuration center, the degradation logic is decoupled from the core service code of the service, so that the change of the degradation logic can be dynamically realized without recompiling the service code, and the service timeliness is improved.
Step S203, a preset dynamic compiler is called to dynamically compile the degradation logic, and generate a degradation class.
Compilation is the process of generating a target program from a source program written in source speech using a compiler program, i.e., translating a program written in a high level language into binary code executable by a computer. Static compiling: when compiling the executable file, the compiler extracts the part of the corresponding dynamic link library (.so or. ilb) which needs to be used, and links the part to the executable file, and all codes are embedded into the host program after compiling. Making the executable file not need to rely on a dynamically linked library at runtime.
The dynamically compiled executable file needs to be attached with a dynamically linked library, and when the dynamically compiled executable file is executed, a command in the corresponding dynamically linked library needs to be called. The method has the advantages of reducing the volume of the execution file, accelerating the compiling speed and saving system resources.
In this embodiment, the demotion logic is dynamically compiled by java compiler or java sist, and a demotion class is generated. Dynamic compilation of Java generates Java classes when a program runs.
And step S204, operating the degradation class to realize service degradation.
And loading the dynamically compiled degradation class into a memory and executing a degradation logic.
The method comprises the steps of receiving a service degradation message; responding to the service degradation message, and acquiring degradation logic from a degradation container in a preset degradation plug-in; calling a preset dynamic compiler, and dynamically compiling the degradation logic to generate a degradation class; and operating the degradation class to realize service degradation. The method comprises the steps of storing the degradation logic in a degradation container, decoupling the degradation logic code from the core service code, interfacing the degradation logic, versioning, multiplexing the degradation logic and switching versions. Meanwhile, the dynamic configuration of the degradation logic in the degradation container can switch the degradation logic in real time according to the service logic, so that the service requirement is met. The method solves the defects that the existing degradation scheme can not be dynamically switched and can not meet the service timeliness.
In some optional implementation manners of this embodiment, in step S201, the electronic device may further perform the following steps:
receiving return data of a service request target;
analyzing the returned data to obtain the state parameters of the request target;
and comparing the state parameter with a preset service degradation condition, and triggering a service degradation message when the state parameter is consistent with the service degradation condition.
In this embodiment, when the service requests another target, the return data of the target is analyzed to obtain the status parameter of the requested target. The state parameter is used to indicate whether the processing of the target end is normal or not, and which kind of problem occurs. And comparing the state parameter of the request target with a preset service degradation condition, and triggering a service degradation message when the state parameter in the received return data is consistent with the service degradation condition.
In some optional implementation manners, if the preset service degradation condition includes N service degradation rules, and each service degradation rule is in a preset matching relationship with the status parameter of the request target, in the step of comparing the status parameter with the preset service degradation condition, and triggering the service degradation message when the status parameter is consistent with the service degradation condition, the electronic device may further perform the following steps:
comparing the state parameters with preset service degradation conditions to obtain service degradation rules matched with the state parameters;
analyzing a degradation logic parameter in a service degradation rule, and writing the degradation logic parameter into a service degradation message;
triggering a service downgrade message including the downgrade logic parameter.
In this embodiment, the preset service degradation condition includes a plurality of service degradation rules, and each service degradation rule is in a preset matching relationship with the state parameter of the request target. The service degradation rules define a service degradation policy, and different service degradation logics are distinguished through degradation logic parameters, namely, different service degradation logics are adopted to perform service degradation for different state parameters of the current service. Therefore, different degradation logics can be set according to different states of the target, the possibility of normal operation of the service is improved under the condition that the server resources are in shortage, and the user experience is improved.
In some optional implementations, if the service degradation message includes interface information, in step S202, the electronic device may further perform the following steps:
and acquiring the degradation logic corresponding to the interface information from the degradation container according to the interface information.
In this embodiment, a service requests different targets through different interfaces, data communication between a server and a target includes interface information, and when data returned by the target is abnormal, the abnormal returned data is analyzed, a degradation message is triggered, and the interface information is written in the degradation message. And when responding to the degradation message, acquiring the degradation logic corresponding to the interface information from the degradation container according to the interface information. Therefore, different degradation logics are adopted for different target exceptions, service degradation is more targeted, the utilization rate of computer resources is improved, and user experience is improved.
In some optional implementations, before step S202, the electronic device may further perform the following steps:
receiving a configuration change notification sent by a preset degradation logic configuration center;
and responding to the configuration change notification, calling a synchronization thread, and synchronizing the configuration change of the downgrade logic configuration center to the downgrade container.
In this embodiment, a downgrading configuration center is preset, the downgrading configuration center is decoupled from a service core code, a storage of the downgrading configuration center may be (zookeeper, redis, mysql), and a storage technology is not limited, so that expansion is facilitated. And compiling the latest degradation logic by a degradation logic code writer according to the business requirements, and uploading the latest degradation logic to a degradation configuration center. When a code writer or an operator uploads new downgrade logic or switches downgrade logic, a configuration change notification is triggered, the configuration change notification is received, a synchronous thread is called, and a downgrade logic configuration center acquires updated downgrade logic and synchronizes the updated downgrade logic to a downgrade container.
In some optional implementation manners, if the configuration change notification includes an interface corresponding to an updated downgrade logic, in the step of receiving the configuration change notification sent by the preset downgrade logic configuration center, the electronic device may further perform the following steps:
analyzing the configuration change notification to obtain an interface corresponding to the updated degradation logic;
and calling a synchronization thread, and synchronizing the updated demotion logic into the demotion container according to the interface.
In this embodiment, the configuration change notification includes an interface corresponding to the updated destaging logic, and the updated destaging logic is synchronized to the destaging container according to the interface. The configuration change notification includes an interface corresponding to the updated downgrade logic, so that the synchronization process only needs to synchronize the downgrade logic for the interface, and the synchronization efficiency is improved.
In some optional implementation manners, if the configuration change notification further includes updated version information of updated downgrade logic, in the step of receiving the configuration change notification sent by the preset downgrade logic configuration center, the electronic device may further perform the following steps:
analyzing the configuration change notification to obtain updated version information of the updated downgraded logic;
reading current version information of the degradation logic corresponding to the interface in the degradation container according to the interface;
and comparing the updated version information with the current version information, calling a synchronization thread when the updated version information is inconsistent with the current version information, and synchronizing the updated downgrade logic into the downgrade container according to the interface.
In this embodiment, the configuration change notification further includes updated version information of the updated demotion logic. Reading the current version information of the downgrade logic corresponding to the interface in the downgrade container according to the interface, comparing the updated version information with the current version information, calling a synchronization thread when the updated version information and the current version information are not consistent, and synchronizing the updated downgrade logic into the downgrade container. When the two are identical, no synchronization is performed. By comparing the version information, when the version information is consistent, synchronization is not performed, so that unnecessary synchronization process and waste of computer resources are avoided. By presetting the degradation logic configuration center, wherein the stored degradation logic corresponds to the interface and contains version information, the degradation logic can be configured according to the interface and the version, and can be inquired according to the interface and the version, so that the visualization and the configurability of the degradation logic are improved.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a computer readable storage medium, and when executed, the processes of the embodiments of the methods described above can be included. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a device for dynamically implementing service degradation, where the embodiment of the device corresponds to the embodiment of the method shown in fig. 2, and the device may be specifically applied to various electronic devices.
As shown in fig. 3, the service degradation dynamic implementation apparatus 300 according to this embodiment includes: a receiving module 301, an obtaining module 302, a compiling module 303 and an executing module 304. Wherein:
a receiving module 301, configured to receive a service downgrade message;
an obtaining module 302, configured to respond to the service degradation instruction, and obtain a degradation logic from a degradation container in a preset degradation plugin;
the compiling module 303 is configured to invoke a preset dynamic compiler, dynamically compile the degradation logic, and generate a degradation class;
and the operation module 304 is used for operating the degradation class to realize service degradation.
The present embodiment operates by receiving a service downgrade message; responding to the service degradation message, and acquiring degradation logic from a degradation container in a preset degradation plug-in; calling a preset dynamic compiler, and dynamically compiling the degradation logic to generate a degradation class; and operating the degradation class to realize service degradation. The method comprises the steps of storing the degradation logic in a degradation container, decoupling the degradation logic code from the core service code, interfacing the degradation logic, versioning, multiplexing the degradation logic and switching versions. Meanwhile, the dynamic configuration of the degradation logic in the degradation container can switch the degradation logic in real time according to the service logic, so that the service requirement is met. The method solves the defects that the existing degradation scheme can not be dynamically switched and can not meet the service timeliness.
In some optional implementations of this embodiment, the receiving module 301 further includes:
the first receiving submodule is used for receiving the return data of the service request target;
the first analysis submodule is used for analyzing the return data to obtain the state parameters of the request target;
and the first triggering submodule is used for comparing the state parameter with a preset service degradation condition and triggering a service degradation message when the state parameter is consistent with the service degradation condition.
In some optional implementation manners of this embodiment, the preset service degradation condition includes N service degradation rules, and each service degradation rule is in a preset matching relationship with a state parameter of a request target, where the first triggering sub-module includes:
the first comparison subunit is used for comparing the state parameter with a preset service degradation condition to obtain a service degradation rule matched with the state parameter;
the first analysis subunit is used for analyzing the degradation logic parameter in the service degradation rule and writing the degradation logic parameter into the service degradation message;
a first triggering subunit, configured to trigger a service downgrading message including the downgrading logic parameter.
In some optional implementations of this embodiment, the service degradation message includes interface information, and the obtaining module 302 includes:
and the first obtaining submodule is used for obtaining the degradation logic corresponding to the interface information from the degradation container according to the interface information.
In some optional implementations of the present embodiment, the service degradation dynamic implementation apparatus 300 further includes:
the second receiving submodule is used for receiving a configuration change notice sent by a preset degradation logic configuration center;
and the first synchronization submodule is used for responding to the configuration change notification, calling a synchronization thread and synchronizing the configuration change of the degradation logic configuration center to the degradation container.
In some optional implementations of this embodiment, the second receiving sub-module further includes:
the second analysis subunit is used for analyzing the configuration change notification to obtain an interface corresponding to the updated degradation logic;
and the first synchronization subunit is used for calling a synchronization thread and synchronizing the updated downgrade logic into the downgrade container according to the interface.
In some optional implementations of this embodiment, the configuration change notification further includes updated version information of updated downgrade logic, and the second receiving submodule further includes:
a third parsing subunit, configured to parse the configuration change notification to obtain update version information of the updated downgrade logic;
the first reading subunit is used for reading the current version information of the degradation logic corresponding to the interface in the degradation container according to the interface;
and the second synchronization subunit is used for comparing the updated version information with the current version information, calling a synchronization thread when the updated version information is inconsistent with the current version information, and synchronizing the updated downgrade logic into the downgrade container according to the interface.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 4, fig. 4 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It is noted that only computer device 4 having components 41-43 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Of course, the memory 41 may also include both internal and external storage devices of the computer device 4. In this embodiment, the memory 41 is generally used for storing an operating system and various application software installed on the computer device 4, such as computer readable instructions of the service degradation dynamic implementation method. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute computer readable instructions stored in the memory 41 or process data, for example, execute computer readable instructions of the service degradation dynamic implementation method.
The network interface 43 may comprise a wireless network interface or a wired network interface, and the network interface 43 is generally used for establishing communication connection between the computer device 4 and other electronic devices.
By receiving a service downgrade message; responding to the service degradation message, and acquiring degradation logic from a degradation container in a preset degradation plug-in; calling a preset dynamic compiler, and dynamically compiling the degradation logic to generate a degradation class; and operating the degradation class to realize service degradation. The method comprises the steps of storing the degradation logic in a degradation container, decoupling the degradation logic code from the core service code, interfacing the degradation logic, versioning, multiplexing the degradation logic and switching versions. Meanwhile, the dynamic configuration of the degradation logic in the degradation container can switch the degradation logic in real time according to the service logic, so that the service requirement is met. The method solves the defects that the existing degradation scheme can not be dynamically switched and can not meet the service timeliness.
The present application further provides another embodiment, which is to provide a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the service degradation dynamic implementation method as described above.
By receiving a service downgrade message; responding to the service degradation message, and acquiring degradation logic from a degradation container in a preset degradation plug-in; calling a preset dynamic compiler, and dynamically compiling the degradation logic to generate a degradation class; and operating the degradation class to realize service degradation. The method comprises the steps of storing the degradation logic in a degradation container, decoupling the degradation logic code from the core service code, interfacing the degradation logic, versioning, multiplexing the degradation logic and switching versions. Meanwhile, the dynamic configuration of the degradation logic in the degradation container can switch the degradation logic in real time according to the service logic, so that the service requirement is met. The method solves the defects that the existing degradation scheme can not be dynamically switched and can not meet the service timeliness.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A dynamic realization method for service degradation is characterized by comprising the following steps:
receiving a service degradation message;
responding to the service degradation message, and acquiring degradation logic from a degradation container in a preset degradation plug-in;
calling a preset dynamic compiler, and dynamically compiling the degradation logic to generate a degradation class;
and operating the degradation class to realize service degradation.
2. The method of claim 1, wherein the step of receiving the service degradation message further comprises:
receiving return data of a service request target;
analyzing the returned data to obtain the state parameters of the request target;
and comparing the state parameter with a preset service degradation condition, and triggering a service degradation message when the state parameter is consistent with the service degradation condition.
3. The method according to claim 2, wherein the preset service degradation condition includes N service degradation rules, each service degradation rule is in a preset matching relationship with a status parameter of a request target, and the step of comparing the status parameter with the preset service degradation condition and triggering a service degradation message when the status parameter is consistent with the service degradation condition comprises:
comparing the state parameters with preset service degradation conditions to obtain service degradation rules matched with the state parameters;
analyzing a degradation logic parameter in a service degradation rule, and writing the degradation logic parameter into a service degradation message;
triggering a service downgrade message including the downgrade logic parameter.
4. The method according to claim 1, wherein the service downgrading message includes interface information, and the step of obtaining downgrading logic from a downgrading container in a preset downgrading plug-in response to the service downgrading message specifically includes:
and acquiring the degradation logic corresponding to the interface information from the degradation container according to the interface information.
5. The method of claim 1, wherein the step of obtaining demotion logic from a demotion container in a predetermined demotion plug-in response to the service demotion message further comprises:
receiving a configuration change notification sent by a preset degradation logic configuration center;
and responding to the configuration change notification, calling a synchronization thread, and synchronizing the configuration change of the downgrade logic configuration center to the downgrade container.
6. The method according to claim 5, wherein the configuration change notification includes an interface corresponding to an updated downgrade logic, and the step of receiving the configuration change notification sent by the preset downgrade logic configuration center further includes:
analyzing the configuration change notification to obtain an interface corresponding to the updated degradation logic;
and calling a synchronization thread, and synchronizing the updated demotion logic into the demotion container according to the interface.
7. The method according to claim 6, wherein the configuration change notification further includes updated version information of updated downgrade logic, and the step of receiving the configuration change notification sent by the preset downgrade logic configuration center further includes:
analyzing the configuration change notification to obtain updated version information of the updated downgraded logic;
reading current version information of the degradation logic corresponding to the interface in the degradation container according to the interface;
and comparing the updated version information with the current version information, calling a synchronization thread when the updated version information is inconsistent with the current version information, and synchronizing the updated downgrade logic into the downgrade container according to the interface.
8. An apparatus for dynamically implementing service degradation, comprising:
a receiving module for receiving a service degradation message;
the obtaining module is used for responding to the service degradation instruction and obtaining degradation logic from a degradation container in a preset degradation plug-in;
the compiling module is used for calling a preset dynamic compiler and dynamically compiling the degradation logic to generate a degradation class;
and the operation module is used for operating the degradation class to realize service degradation.
9. A computer device comprising a memory having computer-readable instructions stored therein and a processor that when executed implements the steps of the dynamic service degradation implementation method of any one of claims 1 to 7.
10. A computer-readable storage medium, having computer-readable instructions stored thereon, which, when executed by a processor, implement the steps of the service degradation dynamic implementation method according to any one of claims 1 to 7.
CN202110575120.4A 2021-05-26 2021-05-26 Service degradation dynamic realization method and device, computer equipment and storage medium Active CN113179188B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110575120.4A CN113179188B (en) 2021-05-26 2021-05-26 Service degradation dynamic realization method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110575120.4A CN113179188B (en) 2021-05-26 2021-05-26 Service degradation dynamic realization method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113179188A true CN113179188A (en) 2021-07-27
CN113179188B CN113179188B (en) 2022-09-13

Family

ID=76928484

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110575120.4A Active CN113179188B (en) 2021-05-26 2021-05-26 Service degradation dynamic realization method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113179188B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090037A (en) * 2021-11-12 2022-02-25 北京字节跳动网络技术有限公司 Service degradation method, device, computer equipment and storage medium
CN114578727A (en) * 2022-01-29 2022-06-03 深圳市云鼠科技开发有限公司 Service logic control method for cleaning robot
WO2024082875A1 (en) * 2022-10-17 2024-04-25 华为云计算技术有限公司 Service governance method and apparatus

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080155336A1 (en) * 2006-12-20 2008-06-26 International Business Machines Corporation Method, system and program product for dynamically identifying components contributing to service degradation
CN102073520A (en) * 2010-12-30 2011-05-25 中国民航信息网络股份有限公司 Dynamic management system and method for C++ application program version
CN104598266A (en) * 2014-12-11 2015-05-06 百度在线网络技术(北京)有限公司 Client application service logic updating method and device and equipment
CN104834541A (en) * 2015-03-30 2015-08-12 百度在线网络技术(北京)有限公司 Function module mounting method, mounting system and mounting system updating method
US20150227544A1 (en) * 2014-02-13 2015-08-13 International Business Machines Corporation Efficient data storage utilization and recycling by gradual data degradation
CN105677466A (en) * 2015-12-31 2016-06-15 百度在线网络技术(北京)有限公司 Method and device for degrading handling of third-party application interface
US20190102717A1 (en) * 2017-09-29 2019-04-04 At&T Intellectual Property I, L.P. Microservice auto-scaling for achieving service level agreements
CN111262898A (en) * 2018-12-01 2020-06-09 阿里巴巴集团控股有限公司 Service degradation processing method and device and electronic equipment
CN112187505A (en) * 2020-08-17 2021-01-05 杭州安恒信息技术股份有限公司 Adaptive service degradation method, electronic device and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080155336A1 (en) * 2006-12-20 2008-06-26 International Business Machines Corporation Method, system and program product for dynamically identifying components contributing to service degradation
CN102073520A (en) * 2010-12-30 2011-05-25 中国民航信息网络股份有限公司 Dynamic management system and method for C++ application program version
US20150227544A1 (en) * 2014-02-13 2015-08-13 International Business Machines Corporation Efficient data storage utilization and recycling by gradual data degradation
CN104598266A (en) * 2014-12-11 2015-05-06 百度在线网络技术(北京)有限公司 Client application service logic updating method and device and equipment
CN104834541A (en) * 2015-03-30 2015-08-12 百度在线网络技术(北京)有限公司 Function module mounting method, mounting system and mounting system updating method
CN105677466A (en) * 2015-12-31 2016-06-15 百度在线网络技术(北京)有限公司 Method and device for degrading handling of third-party application interface
US20190102717A1 (en) * 2017-09-29 2019-04-04 At&T Intellectual Property I, L.P. Microservice auto-scaling for achieving service level agreements
CN111262898A (en) * 2018-12-01 2020-06-09 阿里巴巴集团控股有限公司 Service degradation processing method and device and electronic equipment
CN112187505A (en) * 2020-08-17 2021-01-05 杭州安恒信息技术股份有限公司 Adaptive service degradation method, electronic device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘渊等: "云环境下基于Kubernetes集群系统的容器网络研究与优化", 《信息网络安全》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090037A (en) * 2021-11-12 2022-02-25 北京字节跳动网络技术有限公司 Service degradation method, device, computer equipment and storage medium
CN114090037B (en) * 2021-11-12 2023-07-18 抖音视界有限公司 Service degradation method, device, computer equipment and storage medium
CN114578727A (en) * 2022-01-29 2022-06-03 深圳市云鼠科技开发有限公司 Service logic control method for cleaning robot
WO2024082875A1 (en) * 2022-10-17 2024-04-25 华为云计算技术有限公司 Service governance method and apparatus

Also Published As

Publication number Publication date
CN113179188B (en) 2022-09-13

Similar Documents

Publication Publication Date Title
CN113179188B (en) Service degradation dynamic realization method and device, computer equipment and storage medium
CN111158818B (en) Page rendering method and device
CN113254445B (en) Real-time data storage method, device, computer equipment and storage medium
CN111045901A (en) Container monitoring method and device, storage medium and electronic equipment
CN114996619A (en) Page display method and device, computer equipment and storage medium
CN112199442A (en) Distributed batch file downloading method and device, computer equipment and storage medium
CN111782304A (en) Logic control method and device for paging loading data, computer equipment and medium
CN112506854A (en) Method, device, equipment and medium for storing page template file and generating page
CN115455058A (en) Cache data processing method and device, computer equipment and storage medium
CN114443076A (en) Mirror image construction method, device, equipment and storage medium
CN107657155B (en) Method and device for authenticating user operation authority
CN111352644A (en) Applet updating method, device, server and storage medium
CN111857782B (en) Interface updating method and device, computer equipment and storage medium
CN113779122B (en) Method and device for exporting data
CN114138401A (en) Container configuration method, device, equipment and medium based on artificial intelligence
CN113778659A (en) Multithreading processing method and device
CN110851192A (en) Method and device for responding to configuration of degraded switch
CN116108814B (en) Gantt chart processing method and device, computer equipment and storage medium
CN112860235B (en) Method, device, equipment and storage medium for processing text
CN110825992B (en) System theme replacement method based on smart city operation platform
CN112035335A (en) Method, device, equipment and medium for automatic testing
CN116382719A (en) Plug-in processing method, device, computer equipment and storage medium
CN114238466A (en) Message pushing method and device, computer equipment and storage medium
CN117111957A (en) Code generation method, device, computer equipment and storage medium
CN115686475A (en) Standardized service SDK automatic generation method and related equipment thereof

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
GR01 Patent grant
GR01 Patent grant