CN112948098B - Service unit offline method based on micro-service unit architecture and related device - Google Patents

Service unit offline method based on micro-service unit architecture and related device Download PDF

Info

Publication number
CN112948098B
CN112948098B CN202110515634.0A CN202110515634A CN112948098B CN 112948098 B CN112948098 B CN 112948098B CN 202110515634 A CN202110515634 A CN 202110515634A CN 112948098 B CN112948098 B CN 112948098B
Authority
CN
China
Prior art keywords
service unit
offline
unit
service
registration
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.)
Active
Application number
CN202110515634.0A
Other languages
Chinese (zh)
Other versions
CN112948098A (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.)
Beijing Century TAL Education Technology Co Ltd
Original Assignee
Beijing Century TAL Education Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Century TAL Education Technology Co Ltd filed Critical Beijing Century TAL Education Technology Co Ltd
Priority to CN202110515634.0A priority Critical patent/CN112948098B/en
Publication of CN112948098A publication Critical patent/CN112948098A/en
Application granted granted Critical
Publication of CN112948098B publication Critical patent/CN112948098B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution

Abstract

The embodiment of the invention provides a service unit offline method and a related device based on a micro service unit architecture, wherein the method comprises the following steps: firstly, acquiring a service unit offline instruction comprising the name of a service unit to be offline; then, determining whether the service unit to be offline is in a running state or not according to the name of the service unit to be offline, and when determining that the service unit to be offline is in the running state according to the name of the service unit to be offline, logging off the name of the service unit to be offline in a registration service unit list of the micro service unit architecture, and simultaneously starting timing to acquire offline waiting time; and when the offline waiting time length of the service unit to be offline meets the waiting time length threshold of the service unit to be offline, the service unit to be offline is offline. The service unit offline method and the related device based on the micro-service unit architecture provided by the embodiment of the invention can ensure that the service unit realizes elegant offline and avoid the problem of requesting cutoff.

Description

Service unit offline method based on micro-service unit architecture and related device
Technical Field
The embodiment of the invention relates to the field of computers, in particular to a service unit offline method and a related device based on a micro service unit architecture.
Background
In the distributed architecture of the micro service unit, it is very important to manage the online and offline of the micro service unit.
In the native scenario of Kubernetes, although the smallest object of the system is Pod (micro service unit group), the creation and destruction of Pod (or online and offline) are determined by the Kubernetes system, and the operator cannot directly perform online and offline operations on each Pod, but indirectly manages the Pod by using registration centers such as Eureka and the like.
In the prior art, when a Pod is indirectly managed by a registry such as Eureka, the Pod in a to-be-terminated (Terminating) state is directly removed from a registration list (EndPoint, etc.) of the registry, so that a request cannot access a specific Pod, and request disconnection is finally caused.
Therefore, how to prevent the interruption of the access request to the service unit when the service unit is offline is an urgent technical problem to be solved by those skilled in the art.
Disclosure of Invention
The technical problem solved by the embodiment of the invention is how to prevent the interruption of the request for accessing the service unit when the service unit is off-line.
In order to solve the above problem, an embodiment of the present invention provides a service unit offline method based on a micro service unit architecture, including:
acquiring a service unit offline instruction, wherein the service unit offline instruction comprises the name of a service unit to be offline;
when the service unit to be offline is determined to be in the running state according to the name of the service unit to be offline, the name of the service unit to be offline in a registration service unit list of the micro service unit framework is cancelled, wherein the registration service unit list comprises the names of all service units which can run normally;
and when the offline waiting time length of the service unit to be offline meets the waiting time length threshold of the service unit to be offline, the service unit to be offline is offline, wherein the offline waiting time length is the time length before the step of the service unit to be offline is performed after the step of logging off the name of the service unit to be offline in the registration service unit list of the micro service unit framework is completed, and the waiting time length threshold is greater than or equal to the acquisition interval time length of the registration service unit list.
The embodiment of the invention also provides a service unit offline device based on the micro service unit architecture, which comprises:
the service unit offline instruction acquisition unit is suitable for acquiring the service unit offline instruction, and the service unit offline instruction comprises the name of the service unit to be offline;
the service unit logout unit is suitable for logging out the service unit to be offline in a registration service unit list of the micro service unit framework when the service unit to be offline is determined to be in the running state, wherein the registration service unit list comprises names of service units which can be online currently;
and the service unit offline unit is suitable for offline the service unit to be offline when the offline waiting time length of the service unit to be offline meets the waiting time length threshold of the service unit to be offline, wherein the waiting time length threshold is greater than or equal to the acquisition interval time length of the registered service unit list.
The embodiment of the invention also provides a storage medium, wherein the storage medium stores a program suitable for the offline service unit so as to realize the offline method of the service unit based on the micro service unit architecture.
The embodiment of the invention also provides electronic equipment, which comprises at least one memory and at least one processor; the memory stores a program that the processor calls to execute the micro service unit architecture based service unit offline method.
Compared with the prior art, the technical scheme of the embodiment of the invention has the following advantages:
the service unit offline method based on the micro service unit architecture provided by the embodiment of the invention comprises the steps of firstly obtaining a service unit offline instruction comprising the name of a service unit to be offline; then, determining whether the service unit to be offline is in a running state or not according to the name of the service unit to be offline, and when determining that the service unit to be offline is in the running state according to the name of the service unit to be offline, logging off the name of the service unit to be offline in a registration service unit list of the micro service unit architecture, and simultaneously starting timing to acquire offline waiting time; and when the offline waiting time length of the service unit to be offline meets the waiting time length threshold of the service unit to be offline, the service unit to be offline is offline.
In the service unit offline method based on the micro service unit architecture provided by the embodiment of the invention, when the service unit to be offline is offline, the name of the service unit to be offline is firstly logged out from the registration service unit list, at this time, the registration service unit list at the registration center does not have the name of the service unit to be offline, but at this time, the service unit list can still process and complete the currently accepted request; because the registration gateway acquires the registration service unit list at intervals, after waiting for a period of time, when the registration gateway acquires a new registration service unit list, the registration service unit list at the registration service unit gateway no longer has the name of the service unit to be offline, and a subsequent service unit request cannot access the service unit to be offline but can access other available service units; the registration gateway is guaranteed to obtain a new registration service unit list again, then the offline service unit is offline, so that the offline service unit can be guaranteed to realize elegant offline, the problem of request cutoff is avoided, namely, the problem that the name of the offline service unit still exists in the registration service unit list, but the request cannot request the corresponding service unit is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flowchart of a service unit offline method based on a micro service unit architecture according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a service unit offline method based on micro service unit architecture according to another embodiment of the present invention;
fig. 3 is a schematic diagram of a service unit offline device based on micro service unit architecture according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
It is known from the background art that the service unit drop-off method in the prior art easily leads to a request interruption of access to the service unit when the service unit is dropped off-line.
In order to solve the above problem, in the service unit offline method based on the micro service unit architecture provided in the embodiment of the present invention, first, a service unit offline instruction including a name of a service unit to be offline is obtained; then, determining whether the service unit to be offline is in a running state or not according to the name of the service unit to be offline, and when determining that the service unit to be offline is in the running state according to the name of the service unit to be offline, logging off the name of the service unit to be offline in a registration service unit list of the micro service unit architecture, and simultaneously starting timing to acquire offline waiting time; and when the offline waiting time length of the service unit to be offline meets the waiting time length threshold of the service unit to be offline, the service unit to be offline is offline. In the service unit offline method based on the micro service unit architecture provided by the embodiment of the invention, when the service unit to be offline is offline, the name of the service unit to be offline is firstly logged out from the registration service unit list, at this time, the registration service unit list at the registration center does not have the name of the service unit to be offline, but at this time, the service unit list can still process and complete the currently accepted request; because the registration gateway acquires the registration service unit list at intervals, after waiting for a period of time, when the registration gateway acquires a new registration service unit list, the registration service unit list at the registration service unit gateway no longer has the name of the service unit to be offline, and a subsequent service unit request cannot access the service unit to be offline but can access other available service units; the registration gateway is guaranteed to obtain a new registration service unit list again, then the offline service unit is offline, so that the offline service unit can be guaranteed to realize elegant offline, the problem of request cutoff is avoided, namely, the problem that the name of the offline service unit still exists in the registration service unit list, but the request cannot request the corresponding service unit is avoided.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a service unit offline method based on a micro service unit architecture according to an embodiment of the present invention.
The service unit offline method based on the micro service unit architecture provided by the embodiment of the invention comprises the following steps:
and step S11, acquiring a service unit offline instruction.
The service unit offline command can include the name of the service unit to be offline, so that the service unit to be offline can be searched for and then offline according to the name of the service unit to be offline.
A service unit (Pod) may contain one service or may contain a plurality of services.
In one embodiment, the service unit offline command may be obtained according to a predetermined time interval, such as: and when the preset offline time is reached, acquiring the offline command of the service unit. Of course, the service unit offline command may be obtained in other manners, such as being triggered by a command.
Specifically, the service unit offline instruction may be obtained through a reduced capacity control unit (CronhpaControl, which belongs to one type of service unit) in the micro service unit architecture.
For example, when the capacity reduction time is reached, the capacity reduction control unit obtains the name of the service unit to be offline stored in the capacity reduction control unit, so as to obtain the offline command of the service unit.
The name of the service unit to be offline may be set as required, and in a specific embodiment, the name of the service unit to be offline may be represented by an identifier consisting of a command name (hostname) and a registration identifier (instanceName).
Step S12, determining whether the service unit waiting for being offline is in the running state, if so, executing step S13; if not, go to step S14.
After obtaining the service unit to be offline, further determining whether the service unit to be offline is in a running state or not to determine whether subsequent offline processing needs to be performed or not, when the service unit to be offline is in the running state, performing subsequent offline operation, and when the service unit corresponding to the name of the service unit to be offline is already in the offline process or is offline, proving that the name of the service unit to be offline in the offline instruction is possibly wrong, and the offline instruction needs to be corrected or cancelled.
Specifically, through a capacity reduction Control unit, a service Control unit (Control, which belongs to one type of service unit) is accessed according to the name of the service unit to be offline, and the service Control unit determines whether the service unit to be offline is in a running state or not according to the name of the service unit to be offline.
Step S13: and logging out the service unit to be offline in a registration service unit list of the micro service unit architecture.
Wherein the list of registered service units exists in a registry (Eureka) and includes names of service units that can normally operate.
Before the service unit to be offline logs off, the service unit to be offline exists in the registration service unit list; after the service unit to be offline logs off, the service unit to be offline is removed from the registered service unit list, but after logging off, the service unit to be offline can still be kept online for a period of time, so that all requests can be processed and completed, and the current executed request can be prevented from being cut off.
For example, the capacity shrinkage control unit may notify the registry to log out the name of the service unit to be offline in the registered service unit list of the micro service unit architecture.
In order to improve the simplicity of the service unit offline method, the service unit offline method may be implemented by using a script, and in one embodiment, the step S13: logging off the service unit to be offline in the registration service unit list of the micro service unit architecture may include:
firstly: and generating a service unit offline script of the service unit to be offline.
The service unit offline script comprises the waiting time length threshold value of the service unit to be offline and a logout instruction of the service unit to be offline.
For example, after the service control unit determines that the service unit to be offline is in the running state, the service control unit may generate a service unit offline script of the service unit to be offline, and send the service unit offline script back to the capacity reduction control unit.
Then: and executing the service unit offline script so as to log out the service unit to be offline in a registration service unit list of the micro service unit architecture.
By using the service unit offline script, offline operation can be unified, and execution of the service unit offline method is facilitated.
For example, the capacity reduction control unit may execute the service unit offline script, and notify the registry to log out the name of the service unit to be offline in the registered service unit list of the micro service unit architecture, thereby completing the offline of the service to be offline.
Step S14: and returning the information that the service unit to be offline is not in the running state.
When the service unit to be offline is not in the running state, the information that the service unit to be offline is not in the running state can be returned, so that the subsequent processing such as checking or error correction of the name of the service unit to be offline can be performed.
For example, the service control unit may determine whether the service unit to be offline is in a running state according to the name of the service unit to be offline.
Step S15: judging whether the waiting time length meets the waiting time length threshold of the service unit to be offline, if so, performing step S17; if not, go to step S16.
The waiting time length threshold is greater than or equal to the obtaining interval time length of the registered service unit list, the obtaining interval time length of the registered service unit list is the maximum time length of the time interval that the registered gateway obtains the registered service unit list from the registration center twice, namely, within the obtaining interval time length, the registered gateway obtains the current registered service unit list from the registration center at least once, because the current service unit to be offline in the registered service unit list is logged out, after the registered gateway obtains the current registered service unit list from the registration at least once, subsequent requests cannot be transmitted to the service unit to be offline again, and the service unit to be offline can also process and complete the current request, and then is subsequently prepared to be offline.
Specifically, whether the waiting time length meets the waiting time length threshold of the service unit to be offline for one time may be determined according to a fixed time interval, and the waiting time may be selected according to needs, for example, 1ms, 0.1ms, and the like; or, the timer may be used for timing, and when the time is counted from the name of the service unit to be offline in the registered service unit list of the micro service unit architecture logout and reaches the waiting duration threshold, the step S17 is triggered to be executed.
This embodiment will be described with a fixed time interval.
Step S16, wait, then re-execute the step S15.
Wherein the waiting time can be selected according to the requirement, such as 1ms, 0.1ms, and so on. Step S17: and the service unit to be offline is offline.
When the waiting time length meets the waiting time length threshold of the service unit to be offline, the service unit to be offline can be offline, and specifically, the offline of the service unit to be offline can be completed by modifying the number of the service unit copies corresponding to the service unit Deployment unit (Deployment unit).
It can be seen that, in the method for downloading the service unit based on the micro service unit architecture provided in the embodiment of the present invention, after the registration gateway is ensured to obtain the new registration service unit list again, the service unit to be downloaded is downloaded, so that it can be ensured that the service unit to be downloaded realizes the elegant downloading, and the problem of requesting the disconnection is avoided, that is, the problem that the name of the service unit that has been downloaded exists in the registration service unit list, but the request cannot request the corresponding service unit is avoided.
Of course, after the service unit to be offline is offline, the service unit to be offline can be deleted from the service unit online list.
Therefore, with continuing reference to fig. 1, in an embodiment, the service unit offline method may further include:
step S18, determining whether the service unit to be offline is in offline state, if yes, executing step S110; if not, go to step S19.
Step S19, wait, then execute the step S18.
Wherein the waiting time can be selected according to the requirement, such as 1ms, 0.1ms, and so on.
And step S110, logging off the service unit to be offline in the service unit online list of the micro service unit architecture.
Wherein the service unit online list includes names of currently online service units. After the service unit to be offline logs off, the service unit to be offline can still be kept online for a period of time, so that the service unit to be offline is kept in the list to be offline, and the service unit to be offline is not offline until all requests are processed, so that the request can be prevented from being disconnected, and when the service unit to be offline is offline, the service unit to be offline can be removed from the list to be online.
In the service unit offline method based on the micro service unit architecture provided by the embodiment of the invention, when the service unit to be offline is offline, the name of the service unit to be offline is firstly logged out from the registration service unit list, at this time, the registration service unit list at the registration center does not have the name of the service unit to be offline, but at this time, the service unit list can still process and complete the currently accepted request; because the registration gateway acquires the registration service unit list at intervals, after waiting for a period of time, when the registration gateway acquires a new registration service unit list, the registration service unit list at the registration service unit gateway no longer has the name of the service unit to be offline, and a subsequent service unit request cannot access the service unit to be offline but can access other available service units; the registration gateway is guaranteed to obtain a new registration service unit list again, then the offline service unit is offline, so that the offline service unit can be guaranteed to realize elegant offline, the problem of request cutoff is avoided, namely, the problem that the name of the offline service unit still exists in the registration service unit list, but the request cannot request the corresponding service unit is avoided.
Of course, since each service to be offline requires different offline processing, in order to perform offline processing corresponding to each service to be offline, please refer to fig. 2, where fig. 2 is another schematic flow diagram of a service unit offline method based on a micro service unit architecture according to an embodiment of the present invention, in a specific embodiment, the service unit offline method includes:
step S21: and acquiring a service unit offline instruction, wherein the service unit offline instruction comprises an instruction name of the service unit to be offline.
As shown above, the name of the service unit to be offline may be represented by an identifier composed of a command name (hostname) and a registration identifier (instanceName), where the command name of the service unit to be offline is the name of the service unit to be offline, and is different from the registration identifier in the registration service unit list of the registry.
And step S22, acquiring the registration identification of the service unit to be offline from the registration service unit list according to the instruction name.
To facilitate the management of the various service units, the registry usually marks a registration identifier in the registry for all service units, and the registration identifier is generally named uniformly and is different from the instruction name.
Step S23, determining whether the service unit waiting for being offline is in the running state, if so, executing step S24; if not, go to step S26.
The step S23 is the same as the step S12, and is not repeated here.
Step S24: and generating a service unit offline script of the service unit to be offline according to the registration identifier.
The service unit offline script comprises registration marks of the service units to be offline, information such as offline instructions and offline waiting time length.
Because the service unit offline script comprises the registration identifier, the service unit to be offline can be subsequently logged out from the registration service unit list of the micro service unit architecture according to the registration identifier.
Step S25: and executing the service unit offline script so as to log out the service unit to be offline in a registration service unit list of the micro service unit architecture.
And executing the service unit offline script, wherein the service unit offline script contains the registration identifier, and the service unit to be offline is more convenient and faster according to the registration identifier.
For example, the capacity shrinkage control unit may notify the registry to log out the name of the service unit to be offline in the registered service unit list of the micro service unit architecture.
Step S26: and returning the information that the service unit to be offline is not in the running state.
If it is determined that the service unit to be offline is not in the running state, step S26 is executed, where step S26 is the same as step S14, and is not described herein again.
Step S27: and judging whether the waiting time length meets the waiting time length threshold of the service unit to be offline. If so, go to step S29, and if not, go to step S28.
The step S27 is the same as the step S15, and is not repeated here.
Step S28, wait, then re-execute the step S27.
Wherein the waiting time can be selected according to the requirement, such as 1ms, 0.1ms, and so on.
The step S28 is the same as the step S16, and is not repeated here.
Step S29: and the service unit to be offline is offline.
And when the waiting time length meets the waiting time length threshold of the service unit to be offline, the service unit to be offline can be offline.
Because each service unit to be offline needs different offline processing, the offline processing is more convenient and faster according to the registration identification of the service unit to be offline corresponding to each service to be offline.
In the following, the service unit offline device based on the micro service unit architecture provided by the embodiment of the present invention is introduced, and the service unit offline device based on the micro service unit architecture described below may be regarded as a functional module architecture that is required to be configured by an electronic device (e.g., a PC) to respectively implement the service unit offline method based on the micro service unit architecture provided by the embodiment of the present invention. The contents of the service unit offline device based on the micro service unit architecture described below may be respectively referred to in correspondence with the contents of the service unit offline method based on the micro service unit architecture described above.
Referring to fig. 3, fig. 3 is a schematic diagram of a service unit offline device based on a micro service unit architecture according to an embodiment of the present invention.
The embodiment of the invention provides a service unit offline device based on a micro-service unit architecture, which comprises:
the service unit offline instruction acquiring unit 11 is suitable for acquiring a service unit offline instruction, and the service unit offline instruction comprises the name of a service unit to be offline;
the specific instruction of the service unit offline instruction obtaining unit 11 may be implemented by the capacity reduction control unit.
The service unit logout unit 13 is adapted to logout the service unit to be offline in a registration service unit list of the micro service unit architecture when the service unit to be offline is determined to be in the running state, wherein the registration service unit list comprises names of service units which can be online currently;
the specific instruction of the service unit logout unit 13 may be implemented by the capacity reduction control unit, the service control unit, and the registration center.
The service unit offline unit 14 is adapted to offline the service unit to be offline when the offline waiting time duration of the service unit to be offline meets the waiting time duration threshold of the service unit to be offline, wherein the waiting time duration threshold is greater than or equal to the acquisition interval time duration of the registered service unit list.
The specific instruction of the service unit offline unit 14 may be implemented by the capacity reduction control unit and the service unit deployment unit.
In the service unit offline device based on the micro service unit architecture provided by the embodiment of the invention, when the service unit to be offline is offline, the name of the service unit to be offline is firstly logged out from the registration service unit list, at this time, the name of the service unit to be offline does not exist in the registration service unit list at the registration center, but at this time, the service unit list can still process and complete the currently accepted request; because the registration gateway acquires the registration service unit list at intervals, after waiting for a period of time, when the registration gateway acquires a new registration service unit list, the registration service unit list at the registration service unit gateway no longer has the name of the service unit to be offline, and a subsequent service unit request cannot access the service unit to be offline but can access other available service units; the registration gateway is guaranteed to obtain a new registration service unit list again, then the offline service unit is offline, so that the offline service unit can be guaranteed to realize elegant offline, the problem of request cutoff is avoided, namely, the problem that the name of the offline service unit still exists in the registration service unit list, but the request cannot request the corresponding service unit is avoided.
Optionally, the service unit logout unit 13 includes:
the service unit offline script generating unit 131 is adapted to generate a service unit offline script of the service unit to be offline when it is determined that the service unit to be offline is in a running state, where the service unit offline script includes the waiting duration threshold of the service unit to be offline and a logout instruction of the service unit to be offline;
the specific instruction of the service unit offline script generating unit 131 may be implemented by the service control unit.
The service unit logout executing unit 132 is adapted to execute the service unit logout script, so as to logout the service unit to be logout in the registered service unit list of the micro service unit architecture.
The specific instruction of the service unit logout execution unit 132 may be implemented by the abbreviated control unit.
By using the service unit offline script, offline operation can be unified, and execution of the service unit offline method is facilitated.
Optionally, the method further includes:
a registration identifier obtaining unit 12, adapted to obtain the registration identifier of the service unit to be offline from the registration service unit list according to the instruction name;
the specific instruction of the registration identifier obtaining unit 12 may be implemented by the abbreviated control unit.
The service unit offline script generating unit 131 is further adapted to generate a service unit offline script of the service unit to be offline according to the registration identifier when the service unit to be offline is determined to be in the running state according to the registration identifier;
the service unit logout executing unit 132 further deletes the registration identifier of the service unit to be offline in the registration service unit list of the micro service unit architecture according to the logout instruction.
Optionally, the method further includes:
and the service unit online list logout unit 15 is suitable for logging out the service units to be offline in the service unit online list of the micro service unit framework when determining that the service units to be offline are in an offline state, wherein the service unit online list comprises names of the service units which are online at present.
Because each service unit to be offline needs different offline processing, the offline processing is more convenient and faster according to the registration identification of the service unit to be offline corresponding to each service to be offline.
Certainly, an embodiment of the present invention further provides an electronic device, where the electronic device provided in the embodiment of the present invention may load a program module architecture in a program form to implement the service unit offline method based on the micro service unit architecture provided in the embodiment of the present invention; the hardware device can be applied to an electronic device with specific data processing capacity, and the electronic device can be: such as a terminal device or a service unit device.
Therefore, referring to fig. 4, fig. 4 is a schematic view of an electronic device according to an embodiment of the present invention.
The device provided by the embodiment of the invention comprises: at least one memory 21 and at least one processor 22, the memory 21 storing one or more computer-executable instructions, the processor 22 invoking the one or more computer-executable instructions to perform the micro service unit architecture based service unit offline method.
It will be appreciated that the device may also comprise at least one communication interface 23 and at least one communication bus 24; the processor 22 and the memory 21 may be located in the same electronic device, for example, the processor 22 and the memory 21 may be located in a service unit device or a terminal device; the processor 22 and the memory 21 may also be located on different electronic devices.
In the embodiment of the present invention, the number of the processor 22, the communication interface 23, the memory 21 and the communication bus 24 is at least one, and the processor 22, the communication interface 23 and the memory 21 complete the communication with each other through the communication bus 24; it is clear that the communication connection of the processor 22, the communication interface 23, the memory 21 and the communication bus 24 shown in fig. 4 is only an alternative.
Alternatively, the communication interface 23 may be an interface of a communication module, such as an interface of a GSM module; the processor 22 may be a central processing unit CPU, or a specific integrated circuit ASIC, or one or more integrated circuits configured to implement an embodiment of the present invention; the memory 21 may comprise high speed RAM memory, and may also include non-volatile memory, such as at least one disk memory.
It should be noted that the above-mentioned apparatus may also include other devices (not shown) that may not be necessary to the disclosure of the embodiments of the present invention; these other components may not be necessary to understand the disclosure of embodiments of the present invention, which are not individually described herein.
The embodiment of the invention also provides a storage medium, wherein the storage medium stores one or more computer-executable instructions, and the one or more computer-executable instructions are used for executing the service unit offline method based on the micro service unit architecture.
The embodiments of the present invention described above are combinations of elements and features of the present invention. Unless otherwise mentioned, the elements or features may be considered optional. Each element or feature may be practiced without being combined with other elements or features. In addition, the embodiments of the present invention may be configured by combining some elements and/or features. The order of operations described in the embodiments of the present invention may be rearranged. Some configurations of any embodiment may be included in another embodiment, and may be replaced with corresponding configurations of the other embodiment. It is obvious to those skilled in the art that claims that are not explicitly cited in each other in the appended claims may be combined into an embodiment of the present invention or may be included as new claims in a modification after the filing of the present application.
Embodiments of the invention may be implemented by various means, such as hardware, firmware, software, or a combination thereof. In a hardware configuration, the method according to an exemplary embodiment of the present invention may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), processors, controllers, micro-controllers, microprocessors, and the like.
In a firmware or software configuration, embodiments of the present invention may be implemented in the form of modules, procedures, functions, and the like. The software codes may be stored in memory units and executed by processors. The memory unit is located inside or outside the processor, and may transmit and receive data to and from the processor via various known means.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Although the embodiments of the present invention are disclosed above, the embodiments of the present invention are not limited thereto. Various changes and modifications may be effected therein by one of ordinary skill in the pertinent art without departing from the scope or spirit of the present embodiments, and it is intended that the scope of the present embodiments be defined by the appended claims.

Claims (12)

1. A service unit offline method based on micro service unit architecture is characterized by comprising the following steps:
acquiring a service unit offline instruction, wherein the service unit offline instruction comprises the name of a service unit to be offline;
the step of obtaining the offline command of the service unit comprises the following steps:
the capacity reduction control unit acquires a service unit offline instruction;
when the service unit to be offline is determined to be in the running state according to the name of the service unit to be offline, the name of the service unit to be offline in a registration service unit list of the micro service unit framework is cancelled, wherein the registration service unit list comprises the names of all service units which can run normally;
and when the offline waiting time length of the service unit to be offline meets the waiting time length threshold of the service unit to be offline, the service unit to be offline is offline, wherein the offline waiting time length starts timing from the name of the service unit to be offline in a registration service unit list for logging out the micro service unit framework, the waiting time length threshold is greater than or equal to the acquisition interval time length of the registration service unit list, and the acquisition interval time length of the registration service unit list is the maximum time length of the time interval between two adjacent registration gateways acquiring the registration service unit list from the registration center.
2. The micro-service unit architecture-based service unit offline method according to claim 1, wherein the step of logging off the name of the service unit to be offline in the registered service unit list of the micro-service unit architecture when the service unit to be offline is determined to be in a running state according to the name of the service unit to be offline comprises:
when the service unit to be offline is determined to be in the running state, generating a service unit offline script of the service unit to be offline, wherein the service unit offline script comprises the waiting time length threshold value of the service unit to be offline and a logout instruction of the service unit to be offline;
and executing the service unit offline script so as to log out the name of the service unit to be offline in a registration service unit list of the micro service unit architecture.
3. The micro-SCU architecture based service unit offline method according to claim 2, wherein the service unit offline command comprises a command name of the service unit to be offline;
when the service unit to be offline is determined to be in the running state, before the step of generating the service unit offline script of the service unit to be offline, the method further includes:
acquiring a registration identifier of the service unit to be offline from the registration service unit list according to the instruction name;
when the service unit to be offline is determined to be in the running state, the step of generating the service unit offline script of the service unit to be offline further comprises the following steps:
and when the service unit to be offline is determined to be in the running state according to the registration identifier, generating a service unit offline script of the service unit to be offline according to the registration identifier.
4. The micro-service unit architecture based service unit offline method according to claim 1, wherein after the step of offline the service unit to be offline, the method further comprises:
and when the service unit to be offline is determined to be in an offline state, logging off the service unit to be offline in a service unit online list of the micro service unit architecture, wherein the service unit online list comprises names of the service units online at present.
5. The micro-service unit architecture based service unit offline method of claim 1,
when the service unit to be offline is determined to be in the running state according to the name of the service unit to be offline, the step of logging off the name of the service unit to be offline in the registration service unit list of the micro service unit architecture comprises the following steps:
the method comprises the steps that a service control unit is accessed by a capacity reduction control unit according to the name of a service unit to be offline, when the service control unit determines that the service unit to be offline is in an operating state according to the name of the service unit to be offline, the capacity reduction control unit informs a registration center to log out the name of the service unit to be offline in a registration service unit list of a micro service unit framework.
6. The method as claimed in claim 5, wherein the step of the abbreviated control unit notifying a registry to log out the name of the service unit to be offline in the registered service unit list of the micro service unit architecture comprises:
the service control unit generates a service unit offline script of the service unit to be offline and sends the service unit offline script back to the capacity reduction control unit;
and the capacity reduction control unit executes the service unit offline script and informs the registration center to log out the name of the service unit to be offline in a registration service unit list of the micro service unit architecture.
7. A service unit offline device based on micro-service unit architecture is characterized by comprising:
the service unit offline instruction acquisition unit is suitable for acquiring the service unit offline instruction, and the service unit offline instruction comprises the name of the service unit to be offline;
the step of obtaining the offline command of the service unit comprises the following steps:
the capacity reduction control unit acquires a service unit offline instruction;
the service unit logout unit is suitable for logging out the service unit to be offline in a registration service unit list of the micro service unit framework when the service unit to be offline is determined to be in the running state, wherein the registration service unit list comprises names of service units which can be online currently;
and the service unit offline unit is suitable for offline the service unit to be offline when the offline waiting time length of the service unit to be offline meets the waiting time length threshold of the service unit to be offline, wherein the waiting time length threshold is greater than or equal to the acquisition interval time length of the registered service unit list, and the acquisition interval time length of the registered service unit list is the maximum time length of the time interval between two adjacent registered gateways acquiring the registered service unit list from the registration center.
8. The micro-service unit architecture based service unit downline apparatus of claim 7, wherein the service unit deregistration unit comprises:
the service unit offline script generating unit is suitable for generating a service unit offline script of the service unit to be offline when the service unit to be offline is determined to be in the running state, wherein the service unit offline script comprises the waiting time length threshold value of the service unit to be offline and a logout instruction of the service unit to be offline;
and the service unit logout executing unit is suitable for executing the service unit offline script so as to logout the service unit to be offline in the registration service unit list of the micro service unit architecture.
9. The microservice architecture-based service unit downline apparatus of claim 8, wherein the service unit downline instruction comprises an instruction name of the service unit to be downlined, the apparatus further comprising:
the registration identifier obtaining unit is suitable for obtaining the registration identifier of the service unit to be offline from the registration service unit list according to the instruction name;
the service unit offline script generating unit is further adapted to generate a service unit offline script of the service unit to be offline according to the registration identifier when the service unit to be offline is determined to be in the running state according to the registration identifier;
and the service unit logout execution unit also deletes the registration identification of the service unit to be offline in a registration service unit list of the micro service unit architecture according to the logout instruction.
10. The micro-services unit architecture based service unit downline apparatus of claim 7, further comprising:
and the service unit online list logout unit is suitable for logging out the service units to be offline in the service unit online list of the micro service unit framework when determining that the service units to be offline are in an offline state, wherein the service unit online list comprises names of the service units which are online at present.
11. A storage medium storing a program adapted to a service unit to be taken offline for implementing the micro service unit architecture-based service unit offline method according to any one of claims 1 to 6.
12. An electronic device comprising at least one memory and at least one processor; the memory stores a program that the processor invokes to perform the micro service unit architecture based service unit bring down method according to any one of claims 1-6.
CN202110515634.0A 2021-05-12 2021-05-12 Service unit offline method based on micro-service unit architecture and related device Active CN112948098B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110515634.0A CN112948098B (en) 2021-05-12 2021-05-12 Service unit offline method based on micro-service unit architecture and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110515634.0A CN112948098B (en) 2021-05-12 2021-05-12 Service unit offline method based on micro-service unit architecture and related device

Publications (2)

Publication Number Publication Date
CN112948098A CN112948098A (en) 2021-06-11
CN112948098B true CN112948098B (en) 2021-07-23

Family

ID=76233768

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110515634.0A Active CN112948098B (en) 2021-05-12 2021-05-12 Service unit offline method based on micro-service unit architecture and related device

Country Status (1)

Country Link
CN (1) CN112948098B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114595069B (en) * 2022-04-29 2022-08-05 北京世纪好未来教育科技有限公司 Service offline method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105208047A (en) * 2014-05-29 2015-12-30 阿里巴巴集团控股有限公司 Online and off line methods of distributed system server, and server
CN107623581A (en) * 2016-07-15 2018-01-23 阿里巴巴集团控股有限公司 Service list generation method, apparatus and system, acquisition, report method and device
CN108259557A (en) * 2017-12-05 2018-07-06 南京大学 A kind of implementation of the sensor data acquisition system based on C/S frameworks
CN112000448A (en) * 2020-07-17 2020-11-27 北京计算机技术及应用研究所 Micro-service architecture-based application management method
CN112351077A (en) * 2020-10-21 2021-02-09 中国建设银行股份有限公司 Application service operation method, system, device and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106034138B (en) * 2015-03-09 2019-08-09 阿里巴巴集团控股有限公司 A kind of remote service calling method and device
JP2016220174A (en) * 2015-05-26 2016-12-22 株式会社東芝 Home appliance control method and home appliance controller
US10360268B2 (en) * 2016-08-17 2019-07-23 International Business Machines Corporation Result set optimization for a search query
CN111626604A (en) * 2020-05-26 2020-09-04 中南大学 Intelligent building platform system based on micro-service architecture
CN111752695A (en) * 2020-06-28 2020-10-09 北京百度网讯科技有限公司 Offline method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105208047A (en) * 2014-05-29 2015-12-30 阿里巴巴集团控股有限公司 Online and off line methods of distributed system server, and server
CN107623581A (en) * 2016-07-15 2018-01-23 阿里巴巴集团控股有限公司 Service list generation method, apparatus and system, acquisition, report method and device
CN108259557A (en) * 2017-12-05 2018-07-06 南京大学 A kind of implementation of the sensor data acquisition system based on C/S frameworks
CN112000448A (en) * 2020-07-17 2020-11-27 北京计算机技术及应用研究所 Micro-service architecture-based application management method
CN112351077A (en) * 2020-10-21 2021-02-09 中国建设银行股份有限公司 Application service operation method, system, device and storage medium

Also Published As

Publication number Publication date
CN112948098A (en) 2021-06-11

Similar Documents

Publication Publication Date Title
US20230209330A1 (en) Service Registration in a Communications Network
US20230105343A1 (en) NF SERVICE CONSUMER RESTART DETECTION USING DIRECT SIGNALING BETWEEN NFs
EP2608585B1 (en) Method, device and system for triggering terminal operation
CN109788068B (en) Heartbeat state information reporting method, device and equipment and computer storage medium
CN106537957B (en) Method and server for managing configuration files
EP2429225A1 (en) Method for provisioning parameters of terminal, system thereof, and terminal management device
CN111273924B (en) Software updating method and device
CN107844306B (en) Application program repairing method and device, storage medium and terminal
CN108664521B (en) Method and device for providing serial number, electronic equipment and readable storage medium
CN110650164B (en) File uploading method and device, terminal and computer storage medium
CN112948098B (en) Service unit offline method based on micro-service unit architecture and related device
WO2021057605A1 (en) Device management method, device, system and device, and storage medium
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN104104701A (en) Online service configuration updating method and system
EP3174322A1 (en) Method for deleting notification resource, and common service entity
CN109800567B (en) Method and device for monitoring foreground application starting and terminal equipment
CN112055849B (en) Exclusive control system and exclusive control method
CN104348646A (en) Configuration data processing method, device and system
CN109101253B (en) Management method and device for host in cloud computing system
CN108616461B (en) Policy switching method and device
CN112769889B (en) Service data pushing method and device, storage medium and electronic device
CN112134951A (en) Data transmission method and device, electronic equipment and storage medium
CN112748937A (en) Method and device for updating eUICC operating system
CN112532699B (en) Data port updating method and device, electronic equipment and readable storage medium
CN110519149B (en) Message pushing method and application system 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