CN116578359A - Micro-service state adjustment method, device, equipment and storage medium - Google Patents
Micro-service state adjustment method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN116578359A CN116578359A CN202310558189.5A CN202310558189A CN116578359A CN 116578359 A CN116578359 A CN 116578359A CN 202310558189 A CN202310558189 A CN 202310558189A CN 116578359 A CN116578359 A CN 116578359A
- Authority
- CN
- China
- Prior art keywords
- service
- micro
- state information
- state
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 47
- 230000004044 response Effects 0.000 claims abstract description 42
- 238000004590 computer program Methods 0.000 claims description 15
- 238000007639 printing Methods 0.000 claims description 10
- 230000036541 health Effects 0.000 abstract description 7
- 239000002699 waste material Substances 0.000 abstract description 6
- 238000012545 processing Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000009471 action Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 3
- 238000012423 maintenance Methods 0.000 description 3
- 230000003862 health status Effects 0.000 description 2
- 230000004083 survival effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3055—Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Quality & Reliability (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application discloses a method, a device, equipment and a storage medium for adjusting a micro-service state, which relate to the technical field of micro-services and comprise the following steps: acquiring interface state information of each service interface provided by the current target micro-service pair, and acquiring resource state information of a target server deployed by the target micro-service; judging whether the target micro-service is in an unhealthy state or not according to the interface state information and the resource state information, if so, adaptively adjusting the configuration parameters of the current thread pool according to the pre-established configuration rules to obtain adjusted thread pool parameters, and storing the adjusted thread pool parameters into a log. The application judges the health state of the micro-service through the interface state information and the resource state information, and carries out self-adaptive adjustment on the configuration parameters of the thread pool through the pre-established configuration rule when the micro-service is in an unhealthy state, thereby realizing automatic adjustment of the micro-service state, greatly reducing the waste of human resources and improving the response speed of the micro-service.
Description
Technical Field
The present application relates to the field of micro services, and in particular, to a method, an apparatus, a device, and a storage medium for adjusting a micro service state.
Background
Currently, in large distributed micro-service development, a plurality of servers are deployed for each service, and when the access amount of the service is increased and the number of existing servers is insufficient to support the normal completion of the response of the service, server capacity expansion is usually performed by using an HPA (Horizontal Pod Autoscaler, horizontal auto-scaling) technology, so that the number of servers is increased to enable the response to be completed normally. However, increasing the number of servers directly increases the cost, and expanding this operation is not instantaneous, and typically requires several minutes or even tens of minutes to elapse, and the response of the service within this time is in a slow state, affecting the user experience.
In order to improve the response speed of the service, a plurality of thread pools are used in the micro-service development at present, however, the operation modes of the thread pools are affected by configuration parameters of some thread pools, and when the access amount of the service is increased, a server can inform a developer or an operation and maintenance person in an alarm mode, so that the developer or the operation and maintenance person can ensure the normal response of the service by manually adjusting the parameters of the thread pools. However, this manual parameter adjustment method requires developers and operation and maintenance personnel to pay attention to the alarm information of the on-line server for 24 hours and follow up the adjustment parameters in real time, thereby wasting a great deal of human resources. In addition, in the micro-service development process, in order to facilitate problem investigation of the server system, log printing is usually performed in many places of the code in the code compiling process, however, the log printing needs to occupy some resources of the server and affect some performances of the server. When the access amount of a certain interface of the service is increased, the server also performs log printing for the interface, and when the access amount of the interface is high, the printed log amount is increased, which occupies some precious resources of the server, such as a CPU (Central Processing Unit ), a memory, a disk, a network and the like.
Therefore, how to adjust the state of a micro service so as to improve the response speed of the service is a problem that is still further solved in the art.
Disclosure of Invention
Accordingly, the present application is directed to a method, apparatus, device and storage medium for adjusting micro service state, which can implement automatic adjustment of micro service state, greatly reduce waste of human resources, and improve response speed of micro service. The specific scheme is as follows:
in a first aspect, the present application discloses a method for adjusting a micro-service state, including:
acquiring interface state information of each service interface provided by the current target micro-service outside, and acquiring resource state information of a target server deployed by the target micro-service;
judging whether the target micro-service is in an unhealthy state or not according to the interface state information and the resource state information;
if the target micro-service is in an unhealthy state, the configuration parameters of the current thread pool are adaptively adjusted according to a pre-established configuration rule, the adjusted thread pool parameters are obtained, and the adjusted thread pool parameters are saved in a log.
Optionally, the obtaining interface state information of each service interface provided by the current target micro-service outside the service interface, and collecting resource state information of the target server deployed by the target micro-service, includes:
and acquiring the per-second access quantity and average response time of each service interface provided by the current target micro-service outside, and acquiring the CPU state information and the memory state information of the target server deployed by the target micro-service.
Optionally, the obtaining the per second access amount and the average response time of each service interface provided by the current target micro-service outside the service interface comprises the following steps:
the micro-service flow control component Sentinel is used for counting the per-second access quantity and average response time of each service interface provided outside the current target micro-service.
Optionally, the collecting the CPU state information and the memory state information of the target server of the target micro service deployment includes:
and acquiring CPU state information and memory state information of the target server deployed by the target micro-service through oshi.
Optionally, before adaptively adjusting the configuration parameters of the current thread pool according to the pre-created configuration rule, the method further includes:
current log printing is paused.
Optionally, the determining whether the target micro-service is in an unhealthy state according to the interface state information and the resource state information includes:
judging whether the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach corresponding trigger points or not respectively;
correspondingly, judging whether the target micro-service is in an unhealthy state according to the interface state information and the resource state information, including:
and if the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach the corresponding trigger point, judging that the target micro-service is in an unhealthy state.
Optionally, the micro service state adjustment method further includes:
and adding the configuration rule in a configuration center Apollo of the micro service.
In a second aspect, the present application discloses a micro-service state adjustment device, comprising:
the information acquisition module is used for acquiring interface state information of each service interface provided by the current target micro-service outside, and acquiring resource state information of a target server deployed by the target micro-service;
the state judging module is used for judging whether the target micro-service is in an unhealthy state or not according to the interface state information and the resource state information;
the parameter adjustment module is used for adaptively adjusting the configuration parameters of the current thread pool according to the pre-established configuration rule to obtain the adjusted thread pool parameters if the target micro-service is in an unhealthy state;
and the parameter storage module is used for storing the adjusted thread pool parameters into a log.
In a third aspect, the application discloses an electronic device comprising a processor and a memory; the micro-service state adjustment method is realized when the processor executes the computer program stored in the memory.
In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program when executed by the processor implements the foregoing micro-service state adjustment method.
It can be seen that the present application firstly obtains interface state information of each service interface provided by the current target micro-service, collects resource state information of the target server deployed by the target micro-service, then judges whether the target micro-service is in an unhealthy state according to the interface state information and the resource state information, and if the target micro-service is in an unhealthy state, adaptively adjusts configuration parameters of a current thread pool according to a pre-established configuration rule to obtain adjusted thread pool parameters, and stores the adjusted thread pool parameters into a log. The application judges the health state of the micro-service through the interface state information and the resource state information, and carries out self-adaptive adjustment on the configuration parameters of the thread pool through the pre-established configuration rule when the micro-service is in an unhealthy state, thereby realizing automatic adjustment of the micro-service state, greatly reducing the waste of human resources and improving the response speed of the micro-service.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for adjusting micro service status according to the present application;
FIG. 2 is a flow chart of a method for adjusting micro service status according to the present application;
FIG. 3 is a flowchart of a method for adjusting a micro-service status according to the present application;
FIG. 4 is a schematic diagram of a micro-service status adjusting device according to the present application;
fig. 5 is a block diagram of an electronic device according to the present disclosure.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The embodiment of the application discloses a micro-service state adjusting method, which is shown in fig. 1 and comprises the following steps:
step S11: and acquiring interface state information of each service interface provided by the current target micro-service outside the target micro-service pair, and acquiring resource state information of a target server deployed by the target micro-service.
In this embodiment, firstly, interface state information of each service interface provided by a target micro-service pair to be subjected to state adjustment is acquired, and then resource state information of each target server deployed by the target micro-service is acquired; the interface state information includes, but is not limited to, interface RT (Response Time) information, interface QPS (Query Per Second) information, and the like; the resource status information includes, but is not limited to, usage or occupancy of the CPU, memory, disk, network, etc. It will be appreciated that the service interface may be selected according to the actual application scenario, including but not limited to a core service interface, etc.
In a specific embodiment, the obtaining interface state information of each service interface provided by the current target micro-service outside the service interface and collecting resource state information of the target server deployed by the target micro-service specifically may include: and acquiring the per-second access quantity and average response time of each service interface provided by the current target micro-service outside, and acquiring the CPU state information and the memory state information of the target server deployed by the target micro-service. That is, the access per second (QPS) and average Response Time (RT) of each service interface provided by the target micro-service to be subjected to state adjustment are acquired, and then the CPU state information and the memory state information of the target server deployed by the target micro-service are acquired.
Step S12: and judging whether the target micro-service is in an unhealthy state or not according to the interface state information and the resource state information.
In this embodiment, after the resource status information of the target server deployed by the target micro-service is collected, further, whether the target micro-service is in an unhealthy state is determined according to the obtained interface status information and the obtained resource status information. Wherein the health status of the target micro-service may be determined based on a pre-established health status determination rule.
In a specific embodiment, when the interface state information is an access amount per second and an average response time of each service interface, and the resource state information is CPU state information and memory state information of the target server, the determining, according to the interface state information and the resource state information, whether the target micro-service is in an unhealthy state may specifically include: and respectively judging whether the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach the corresponding trigger point or not. In this embodiment, a health state determination rule is formulated in advance, specifically: if the access amount per second of the interface and/or the average response time of the interface and/or the CPU state information of the server and/or the memory state information of the server reach the corresponding preset trigger points, the target micro-service is judged to be in an unhealthy state, and if the access amount per second of the interface and/or the average response time of the interface and/or the CPU state information of the server and/or the memory state information of the server do not reach the corresponding preset trigger points, the target micro-service is judged to be in a healthy state, so that the current health state of the target micro-service can be directly judged according to the health state judgment rule.
Step S13: if the target micro-service is in an unhealthy state, the configuration parameters of the current thread pool are adaptively adjusted according to a pre-established configuration rule, the adjusted thread pool parameters are obtained, and the adjusted thread pool parameters are saved in a log.
In this embodiment, when the target micro-service is in an unhealthy state, for example, when the QPS >1000 of the business-detailed active interface is monitored, that is, when the per-second access amount of a certain designated interface is greater than a preset trigger point 1000, it is determined that the current target micro-service is in an unhealthy state, at this time, in order to improve the response speed of the target micro-service, the configuration parameters of the current thread pool may be adaptively adjusted according to a pre-created configuration rule, so as to increase the resource occupancy rate of the current business-detailed active interface, improve the performance of the interface, and further obtain corresponding adjusted thread pool parameters, and then store the adjusted thread pool parameters in a log, that is, store corresponding configuration information after configuration is completed. The configuration parameters of the thread pool include, but are not limited to, corePoolSize (thread pool core thread size), maximumPoolSize (thread pool maximum thread count), keepalive time (idle thread survival time), unit (idle thread survival time unit), workQueue, thread factory, and handler, etc. It should be noted that the configuration rule may be set according to actual application requirements, for example, the corresponding thread pool parameter may be adjusted up or down, and the specific adjustment value may also determine the adjustment value according to the per-second access amount of the interface, the average response time of the interface, the CPU state information of the server, and different state information corresponding to the memory state information of the server.
It should be noted that before the adaptively adjusting the configuration parameters of the current thread pool according to the pre-created configuration rule, the method specifically further includes: current log printing is paused. In this embodiment, before adaptively adjusting the configuration parameters of the current thread pool according to the pre-created configuration rule, that is, when it is monitored that the target micro service is in an unhealthy state, in order to prevent unnecessary functions from occupying precious resources of the server, the current log printing operation may be paused.
It should be noted that, in this embodiment, the configuration rule needs to be added in advance in the configuration center Apollo (an open-source distributed configuration center) of the micro service. The micro-service state adjustment scheme provided by the application can be realized by writing codes, and an SDK (Software Development Kit ) can be obtained by packaging the written codes, and the SDK can add the required configuration rules into a configuration center Apollo of the micro-service after the micro-service starts the service. The configuration rule specifically comprises three parts, namely: service interfaces (interfaces of a certain scene provided by the service externally), trigger points (certain indexes of service states: CPU, memory, interfaces RT, interfaces QPS and the like), and corresponding processing operations (adjusting configuration parameters and/or log control of certain thread pools of the service and the like). For example, a trigger point 1000 is configured for a business detail active interface in a configuration center Apollo of the micro service, and when QPS >1000, the print log is suspended, and the configuration is saved after the completion of the above configuration rule, so that the rule falls onto each server and is stored. It should be noted that, the configuration rule takes effect in real time after configuration without restarting the micro service, and whether the interface state information of each service interface and the resource state information of the deployed target server reach the corresponding trigger point can be detected in real time or according to a preset time interval (once a second) through the configuration rule, if so, the corresponding processing action is executed. In addition, the configuration center Apollo is also convenient for technicians to correspondingly modify and adjust rules in the configuration rules in real time.
Further, a background thread may be started when the micro service is started, the thread obtains the configuration rule first, then analyzes the configuration rule to obtain all service interfaces configured with the rule, repeatedly detects QPS and RT of the service interfaces and state information of a CPU, a memory and the like of the server through the thread, and then judges whether the current state of the service interface or the server reaches a corresponding trigger point according to the trigger point configured for each interface, and if so, executes corresponding processing.
It can be seen that, in the embodiment of the present application, interface state information of each service interface provided by the current target micro-service outside is obtained first, resource state information of a target server deployed by the target micro-service is collected, then whether the target micro-service is in an unhealthy state is judged according to the interface state information and the resource state information, if the target micro-service is in an unhealthy state, configuration parameters of a current thread pool are adaptively adjusted according to a pre-created configuration rule, an adjusted thread pool parameter is obtained, and the adjusted thread pool parameter is saved in a log. The embodiment of the application judges the health state of the micro-service through the interface state information and the resource state information, and carries out self-adaptive adjustment on the configuration parameters of the thread pool through the pre-established configuration rule when the micro-service is in an unhealthy state, thereby realizing automatic adjustment of the micro-service state, greatly reducing the waste of human resources and improving the response speed of the micro-service.
The embodiment of the application discloses a specific micro-service state adjustment method, which is shown in fig. 2 and comprises the following steps:
step S21: and counting the per-second access quantity and average response time of each service interface provided by the current target micro-service outside through a micro-service flow control component Sentinel, and acquiring the CPU state information and the memory state information of the target server deployed by the target micro-service through oshi.
In this embodiment, firstly, the per second access amount and average response time of each service interface provided by the current target micro service to the outside are counted through a micro service flow control component Sentinel (an open source distributed current limiting component), and then, the CPU state information and the memory state information of the target server deployed by the target micro service are collected through oshi (a free JNA-based (native) operating system and hardware information base of Java).
Step S22: and respectively judging whether the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach the corresponding trigger point or not.
Step S23: if the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach the corresponding trigger points, judging that the target micro-service is in an unhealthy state, adaptively adjusting configuration parameters of a current thread pool according to a pre-established configuration rule to obtain adjusted thread pool parameters, and storing the adjusted thread pool parameters into a log.
In this embodiment, if the access amount per second and/or the average response time and/or any one of the CPU state information and/or the memory state information reach the corresponding trigger point, the target microservice is directly determined to be in an unhealthy state, the configuration parameters of the current thread pool are adaptively adjusted according to the pre-created configuration rule to obtain corresponding adjusted thread pool parameters, and then the adjusted thread pool parameters are saved in a log.
In a specific embodiment, referring to fig. 3, firstly, the micro service flow control component Sentinel counts the per second access amount (i.e. QPS) and average response time (i.e. RT) of each service interface provided by the micro service, and collects the CPU state information and Memory (Memory) state information of the server deployed by the micro service through oshi, then, the current state information including QPS, RT, CPU state information and Memory state information and the trigger point in the configuration rule configured through the configuration center Apollo are circularly detected, and whether the corresponding trigger point is reached is judged, if not, the shutdown processing is performed, otherwise, the operation of stopping the current log printing and modifying the configuration parameters of the thread pool is performed if the trigger point is not reached.
For more specific processing in step S22, reference may be made to the corresponding content disclosed in the foregoing embodiment, and no further description is given here.
It can be seen that, in the embodiment of the present application, whether the target micro-service is in an unhealthy state is determined by determining whether the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach the corresponding trigger points, and when the target micro-service is in the unhealthy state, the configuration parameters of the current thread pool are adaptively adjusted according to the pre-created configuration rules. Compared with the existing method of adjusting the configuration parameters of the thread pool through manual intervention, the method and the device can automatically adjust the micro-service state, greatly reduce the waste of human resources and improve the response speed of the micro-service.
Correspondingly, the embodiment of the application also discloses a micro-service state adjusting device, which is shown in fig. 4, and comprises the following steps:
the information acquisition module 11 is used for acquiring interface state information of each service interface provided by the current target micro-service outside, and acquiring resource state information of a target server deployed by the target micro-service;
a state judging module 12, configured to judge whether the target micro-service is in an unhealthy state according to the interface state information and the resource state information;
the parameter adjustment module 13 is configured to adaptively adjust a configuration parameter of a current thread pool according to a pre-created configuration rule if the target micro-service is in an unhealthy state, so as to obtain an adjusted thread pool parameter;
and the parameter saving module 14 is configured to save the adjusted thread pool parameter to a log.
The specific workflow of each module may refer to the corresponding content disclosed in the foregoing embodiment, and will not be described herein.
It can be seen that, in the embodiment of the present application, interface state information of each service interface provided by the current target micro-service outside is obtained first, resource state information of the target server deployed by the target micro-service is collected, then whether the target micro-service is in an unhealthy state is judged according to the interface state information and the resource state information, if the target micro-service is in an unhealthy state, configuration parameters of a current thread pool are adaptively adjusted according to a pre-created configuration rule, an adjusted thread pool parameter is obtained, and the adjusted thread pool parameter is saved in a log. The embodiment of the application judges the health state of the micro-service through the interface state information and the resource state information, and carries out self-adaptive adjustment on the configuration parameters of the thread pool through the pre-established configuration rule when the micro-service is in an unhealthy state, thereby realizing automatic adjustment of the micro-service state, greatly reducing the waste of human resources and improving the response speed of the micro-service.
In some specific embodiments, the information obtaining module 11 may specifically include:
the information acquisition unit is used for acquiring the per-second access quantity and average response time of each service interface provided by the current target micro-service outside;
the first information acquisition unit is used for acquiring CPU state information and memory state information of the target server deployed by the target micro-service.
In some specific embodiments, the information obtaining unit may specifically include:
and the information statistics unit is used for counting the per-second access quantity and average response time of each service interface provided by the current target micro-service to the outside through the micro-service flow control component Sentinel.
In some specific embodiments, the first information collecting unit may specifically include:
and the second information acquisition unit is used for acquiring the CPU state information and the memory state information of the target server deployed by the target micro-service through oshi.
In some specific embodiments, before the parameter adjustment module 13, the method may further include:
and the printing pause unit is used for pausing the current log printing.
In some specific embodiments, the state determining module 12 may specifically include:
the trigger point judging unit is used for judging whether the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach the corresponding trigger point or not respectively;
correspondingly, the state determining module 12 may specifically include:
and the unhealthy state judging unit is used for judging that the target micro-service is in an unhealthy state if the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach the corresponding trigger point.
In some specific embodiments, the micro service state adjustment device may further include:
and the configuration rule adding unit is used for adding the configuration rule in a configuration center Apollo of the micro service.
Further, the embodiment of the present application further discloses an electronic device, and fig. 5 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the figure is not to be considered as any limitation on the scope of use of the present application.
Fig. 5 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. Wherein the memory 22 is used for storing a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the micro service state adjustment method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and computer programs 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the micro-service state adjustment method performed by the electronic device 20 as disclosed in any of the previous embodiments.
Further, the application also discloses a computer readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the previously disclosed micro-service state adjustment method. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing has described in detail the method, apparatus, device and storage medium for micro-service state adjustment provided by the present application, and specific examples have been applied herein to illustrate the principles and embodiments of the present application, and the above examples are only used to help understand the method and core idea of the present application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.
Claims (10)
1. A method for micro-service state adjustment, comprising:
acquiring interface state information of each service interface provided by the current target micro-service outside, and acquiring resource state information of a target server deployed by the target micro-service;
judging whether the target micro-service is in an unhealthy state or not according to the interface state information and the resource state information;
if the target micro-service is in an unhealthy state, the configuration parameters of the current thread pool are adaptively adjusted according to a pre-established configuration rule, the adjusted thread pool parameters are obtained, and the adjusted thread pool parameters are saved in a log.
2. The method for adjusting the state of a micro service according to claim 1, wherein the obtaining interface state information of each service interface provided outside of a current target micro service pair and collecting resource state information of a target server deployed by the target micro service includes:
and acquiring the per-second access quantity and average response time of each service interface provided by the current target micro-service outside, and acquiring the CPU state information and the memory state information of the target server deployed by the target micro-service.
3. The method for adjusting the state of a micro service according to claim 2, wherein the obtaining the access per second and the average response time of each service interface provided outside the current target micro service comprises:
the micro-service flow control component Sentinel is used for counting the per-second access quantity and average response time of each service interface provided outside the current target micro-service.
4. The method for adjusting the state of a micro service according to claim 2, wherein the collecting the CPU state information and the memory state information of the target server of the target micro service deployment includes:
and acquiring CPU state information and memory state information of the target server deployed by the target micro-service through oshi.
5. The method for adjusting the state of a micro service according to claim 2, wherein before adaptively adjusting the configuration parameters of the current thread pool according to the pre-created configuration rule, the method further comprises:
current log printing is paused.
6. The method for adjusting the state of a micro-service according to claim 1, wherein the determining whether the target micro-service is in an unhealthy state according to the interface state information and the resource state information comprises:
judging whether the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach corresponding trigger points or not respectively;
correspondingly, judging whether the target micro-service is in an unhealthy state according to the interface state information and the resource state information, including:
and if the access amount per second and/or the average response time and/or the CPU state information and/or the memory state information reach the corresponding trigger point, judging that the target micro-service is in an unhealthy state.
7. The micro service state adjustment method according to any one of claims 1 to 6, further comprising:
and adding the configuration rule in a configuration center Apollo of the micro service.
8. A micro service state adjustment device, comprising:
the information acquisition module is used for acquiring interface state information of each service interface provided by the current target micro-service outside, and acquiring resource state information of a target server deployed by the target micro-service;
the state judging module is used for judging whether the target micro-service is in an unhealthy state or not according to the interface state information and the resource state information;
the parameter adjustment module is used for adaptively adjusting the configuration parameters of the current thread pool according to the pre-established configuration rule to obtain the adjusted thread pool parameters if the target micro-service is in an unhealthy state;
and the parameter storage module is used for storing the adjusted thread pool parameters into a log.
9. An electronic device comprising a processor and a memory; wherein the processor, when executing the computer program stored in the memory, implements the micro-service state adjustment method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program; wherein the computer program, when executed by a processor, implements the micro-service state adjustment method according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310558189.5A CN116578359A (en) | 2023-05-17 | 2023-05-17 | Micro-service state adjustment method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310558189.5A CN116578359A (en) | 2023-05-17 | 2023-05-17 | Micro-service state adjustment method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116578359A true CN116578359A (en) | 2023-08-11 |
Family
ID=87533634
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310558189.5A Pending CN116578359A (en) | 2023-05-17 | 2023-05-17 | Micro-service state adjustment method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116578359A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117251337A (en) * | 2023-09-07 | 2023-12-19 | 广州宇中网络科技有限公司 | Micro-service health dial testing method, device, equipment and storage medium |
-
2023
- 2023-05-17 CN CN202310558189.5A patent/CN116578359A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117251337A (en) * | 2023-09-07 | 2023-12-19 | 广州宇中网络科技有限公司 | Micro-service health dial testing method, device, equipment and storage medium |
CN117251337B (en) * | 2023-09-07 | 2024-05-28 | 广州宇中网络科技有限公司 | Micro-service health dial testing method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103209439B (en) | The method of a kind of data traffic monitoring, device and equipment | |
CN101510167B (en) | A kind of method of plug-in component operation, Apparatus and system | |
CN110474852B (en) | Bandwidth scheduling method and device | |
US20020174217A1 (en) | System and method for predicting network performance | |
JP2004005486A (en) | Method for optimizing memory use state of computer application | |
CN110933178B (en) | Method for adjusting node configuration in cluster system and server | |
CN108337127B (en) | Application performance monitoring method, system, terminal and computer readable storage medium | |
CN116578359A (en) | Micro-service state adjustment method, device, equipment and storage medium | |
CN114143265A (en) | Network flow current limiting method, device, equipment and storage medium | |
CN111277640B (en) | User request processing method, device, system, computer equipment and storage medium | |
CN108243222A (en) | Server network architecture method and device | |
US20100274621A1 (en) | Method and System for Integration of Systems Management with Project and Portfolio Management | |
CN109639490B (en) | Downtime notification method and device | |
CN109002381B (en) | Process communication monitoring method, electronic device and computer readable storage medium | |
JP2005018120A (en) | Method for collecting apparatus information in network management system | |
CN109144676A (en) | A kind of self-starting detection method, device and the server of application program | |
CN113553194B (en) | Hardware resource management method, device and storage medium | |
CN115454578A (en) | Virtual machine memory allocation method, device, equipment and storage medium | |
CN114817134A (en) | Snapshot task monitoring method, device, equipment and medium | |
CN104956328B (en) | One kind can reentry resource regulating method, equipment and system | |
CN114416326A (en) | Big data control method, device, control system and readable storage medium | |
CN110932987A (en) | Method and device for flow control of URL (Uniform resource locator) connection number | |
CN116483581A (en) | Resource scheduling method, device, equipment and medium | |
CN115600148B (en) | Power supply control method and related device based on Internet of things monitoring | |
CN115174289B (en) | Log data storage method and device, storage medium and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |