CN111581061A - Service offline method, device and equipment - Google Patents

Service offline method, device and equipment Download PDF

Info

Publication number
CN111581061A
CN111581061A CN202010413586.XA CN202010413586A CN111581061A CN 111581061 A CN111581061 A CN 111581061A CN 202010413586 A CN202010413586 A CN 202010413586A CN 111581061 A CN111581061 A CN 111581061A
Authority
CN
China
Prior art keywords
service
agent program
processing
determining
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010413586.XA
Other languages
Chinese (zh)
Inventor
李沈阳
张健
李高炜
单奇聪
许林林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Group Co Ltd
Hisense Co Ltd
Original Assignee
Hisense 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 Hisense Co Ltd filed Critical Hisense Co Ltd
Priority to CN202010413586.XA priority Critical patent/CN111581061A/en
Publication of CN111581061A publication Critical patent/CN111581061A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention provides a method, a device and equipment for offline service. When the server determines a first service to be offline, a new service request is stopped being allocated to the first service, and after the agent program of the first service determines that the processing of the allocated service request corresponding to the first service is completed, the first service is stopped. In the process, whether the processing of the distributed service request corresponding to the first service is finished or not is determined through the agent program, and the first service is stopped after the processing is determined to be finished, so that on one hand, the stopping time of the first service can be accurately grasped, and the first service is ensured to be smoothly off-line; on the other hand, the implementation logic of the first service does not need to be modified, and the service stability of the first service is ensured.

Description

Service offline method, device and equipment
Technical Field
The invention relates to the technical field of computers, in particular to a service offline method, device and equipment.
Background
In the field of Web applications, a server generally adopts a cluster service architecture, that is, a service cluster is set at the server, and the service cluster includes a plurality of services. When the service end receives the service request of the client end, the service request can be distributed to one of the services in the cluster to be processed according to the load balancing principle. Therefore, on one hand, the service response speed can be improved, on the other hand, a plurality of services can be mutually backed up, and the stability of a service system is ensured.
In some scenarios, one or more services in the cluster may need to be taken offline. Illustratively, when going offline for service a, the server first stops allocating new service requests to service a, and then stops service a.
However, when stopping service a, service a may still have unprocessed completed service requests, so that these service requests cannot be completed continuously, resulting in processing failure and affecting user services.
Disclosure of Invention
The invention provides a service offline method, a service offline device and a service offline equipment, which are used for enabling a service to be smoothly offline and avoiding influence on user services.
In a first aspect, an embodiment of the present invention provides a service offline method, including:
determining a first service to be offline, wherein the first service corresponds to an agent program used for monitoring the first service;
stopping assigning a new service request to the first service;
and stopping the first service after determining that the processing of the allocated service request corresponding to the first service is completed through the agent program.
In a possible implementation manner, determining, by the agent program, that processing of the allocated service request corresponding to the first service is completed includes:
counting the number of distributed service requests corresponding to the first service through the agent program, and counting the number of processed service requests corresponding to the first service;
and if the number of the distributed service requests is equal to the number of the processed service requests, determining that the processing of the distributed service requests corresponding to the first service is finished through the agent program.
In a possible implementation manner, the first service uses a preset protocol; the counting, by the agent program, the number of allocated service requests corresponding to the first service and the number of processed service requests corresponding to the first service includes:
monitoring the request interface of the preset protocol in the first service through the agent program to obtain the quantity of distributed service requests corresponding to the first service;
and monitoring the response interface of the preset protocol in the first service through the agent program to obtain the number of the processed service requests corresponding to the first service.
In a possible implementation manner, the preset protocol is an HTTP protocol.
In a possible implementation manner, the stopping the first service after determining, by the agent program, that processing of the allocated service request corresponding to the first service is completed includes:
sending a preparation stopping instruction to the agent program, wherein the preparation stopping instruction is used for enabling the agent program to return a processing completion instruction when determining that the processing of the distributed service request corresponding to the first service is completed;
and stopping the first service after receiving a processing completion instruction returned by the agent program.
In a possible implementation manner, the first service is a service implemented based on Java, and the agent program is a Java agent program.
In a second aspect, an embodiment of the present invention provides a service downloading apparatus, including:
the system comprises a determining module, a monitoring module and a judging module, wherein the determining module is used for determining a first service to be offline, the first service corresponds to an agent program, and the agent program is used for monitoring the first service;
a processing module for stopping the allocation of a new service request to the first service;
the processing module is further configured to stop the first service after determining, by the agent program, that processing of the allocated service request corresponding to the first service is completed.
In a possible implementation manner, the processing module is specifically configured to:
counting the number of distributed service requests corresponding to the first service through the agent program, and counting the number of processed service requests corresponding to the first service;
and if the number of the distributed service requests is equal to the number of the processed service requests, determining that the processing of the distributed service requests corresponding to the first service is finished through the agent program.
In a possible implementation manner, the first service uses a preset protocol; the processing module is specifically configured to:
monitoring the request interface of the preset protocol in the first service through the agent program to obtain the quantity of distributed service requests corresponding to the first service;
and monitoring the response interface of the preset protocol in the first service through the agent program to obtain the number of the processed service requests corresponding to the first service.
In a possible implementation manner, the preset protocol is an HTTP protocol.
In a possible implementation manner, the processing module is specifically configured to:
sending a preparation stopping instruction to the agent program, wherein the preparation stopping instruction is used for enabling the agent program to return a processing completion instruction when determining that the processing of the distributed service request corresponding to the first service is completed;
and stopping the first service after receiving a processing completion instruction returned by the agent program.
In a possible implementation manner, the first service is a service implemented based on Java, and the agent program is a Java agent program.
In a third aspect, an embodiment of the present invention provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores computer-executable instructions that, when executed by the at least one processor, implement the method of any of the first aspects.
In a fourth aspect, the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored, and when executed by a processor, the computer-executable instructions are used to implement the method according to any one of the first aspect.
According to the service offline method, the service offline device and the service offline equipment provided by the embodiment of the invention, the server adopts a service cluster architecture, and the service cluster comprises a plurality of services. Each service corresponds to an agent program, and the agent program is used for monitoring the service. When the server determines a first service to be offline, a new service request is stopped being allocated to the first service, and after the agent program of the first service determines that the processing of the allocated service request corresponding to the first service is completed, the first service is stopped. In the process, whether the processing of the distributed service request corresponding to the first service is finished or not is determined through the agent program, and the first service is stopped after the processing is determined to be finished, so that on one hand, the stopping time of the first service can be accurately grasped, and the first service is ensured to be smoothly off-line; on the other hand, the implementation logic of the first service does not need to be modified, and the service stability of the first service is ensured.
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, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a diagram illustrating a system architecture suitable for use with the present invention;
fig. 2 is a schematic flow chart of a service offline method according to an embodiment of the present invention;
fig. 3A is a schematic structural diagram of a possible server according to an embodiment of the present invention;
fig. 3B is a schematic structural diagram of another possible server according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a service logoff process provided by an embodiment of the present invention;
fig. 5 is a schematic flowchart illustrating monitoring of a first service by a proxy program according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a service logout device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
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.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a schematic diagram of a system architecture to which the present invention is applicable. As shown in fig. 1, the system architecture includes: a client and a server. The client can send a service request to the server, and the server returns a service response to the client after executing the service request. Referring to fig. 1, a server is provided with a service cluster including a plurality of services therein. The server is also provided with a load balancing unit which is used for keeping load balance among the plurality of services. Specifically, when the server receives a service request from the client, the load balancing unit may allocate the service request to one of the services in the cluster for processing according to the load conditions of the plurality of services. Therefore, on one hand, the service response speed can be improved, on the other hand, a plurality of services can be mutually backed up, and the stability of a service system is ensured.
In practical applications, the service cluster in fig. 1 may correspond to one or more computer devices. For example, each service may be integrated into a separate computer, i.e., one service is run in each computer. It is also possible to integrate multiple services in the same computer, i.e. to run multiple services per computer. Similarly, the load balancing unit may be integrated in the same computer as the plurality of services for which it is responsible, or may be integrated in a separate computer. That is, in practical applications, there may be a plurality of possible implementations of the system architecture shown in fig. 1, and the embodiment is not limited to this.
It should be understood that the present embodiment does not limit the number of services included in the service cluster.
In some application scenarios, one or more services in the cluster need to be offline. For example, when a service needs to be updated, upgraded, or expanded, the service needs to be offline first, and then updated, upgraded, or expanded.
Specifically, when a service is offline, the server first stops allocating a service request to the service, and then stops the service. For example, assume that a service cluster includes: service 1, service 2, service 3, and service 4. When receiving the service request from the client, the server may sequentially distribute the service request to the 4 services in a polling manner. For example, service 1 is assigned when a 1 st service request is received, service 2 is assigned when a 2 nd service request 2 is received, service 3 is assigned when a 3 rd service request is received, service 4 is assigned when a 4 th service request is received, service 1 is assigned when a 5 th service request is received, and so on. If it is determined that the service 1 needs to be offline, the server stops allocating a new service request to the service 1 (that is, when a new service request is received, the server allocates the new service request to the service 2, the service 3 and the service 4 in a polling manner, and does not allocate the new service request to the service 1), and then the server stops the service 1.
In the above process, the server stops service 1 immediately after stopping assigning a new service request to service 1. However, when stopping service 1, there may still be allocated service requests that have not been processed yet in service 1, so that these service requests cannot be completed continuously, which results in processing failure and affects user services.
In one possible embodiment, the server does not immediately stop the service 1 after stopping the allocation of a new service request to the service 1, but stops the service 1 after waiting a preset time period (for example, 30 seconds). In this way, the service 1 can continue to process the allocated service request within the preset waiting time, so as to reduce the influence on the allocated service request, and make the service 1 go down smoothly as much as possible. However, this embodiment relies on the knowledge of the preset duration, and if the preset duration is set to be short, there may still be a case that the allocated service request cannot be processed and completed, that is, the smooth offline of the service 1 cannot be guaranteed by 100%. If the preset duration is set to be longer, the waiting time is wasted.
In another possible implementation, statistics may be performed on the processing conditions of the allocated service requests in the service 1, and when the service 1 statistics determines that all processing of the allocated service requests is completed, the service 1 is stopped. However, the implementation logic of the service 1 needs to be modified, and the implementation logic of the service 1 is intrusive, thereby causing a hidden danger to the business stability of the service 1.
In order to solve at least one of the above problems, an embodiment of the present invention provides a service offline method. The method of the present embodiment may be performed by the server in fig. 1. The server adopts a service cluster architecture, and the service cluster comprises a plurality of services. Each service corresponds to an agent program, and the agent program is used for monitoring the service. When the server determines a first service to be offline, a new service request is stopped being allocated to the first service, and after the agent program of the first service determines that the processing of the allocated service request corresponding to the first service is completed, the first service is stopped. In the process, whether the processing of the distributed service request corresponding to the first service is finished or not is determined through the agent program, and the first service is stopped after the processing is determined to be finished, so that on one hand, the stopping time of the first service can be accurately grasped, and the first service is ensured to be smoothly off-line; on the other hand, the implementation logic of the first service does not need to be modified, and the service stability of the first service is ensured.
The technical solution of the present invention will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 2 is a flowchart illustrating a service offline method according to an embodiment of the present invention. The method of the present embodiment is performed by a server. As shown in fig. 2, the method of the present embodiment includes:
s201: determining a first service to be offline, wherein the first service corresponds to an agent program used for monitoring the first service.
S202: stopping assigning new service requests to the first service.
S203: and stopping the first service after determining that the processing of the allocated service request corresponding to the first service is completed through the agent program.
In this embodiment, the server adopts a service cluster architecture, and the service cluster includes a plurality of services. An agent is associated with each service. An agent for a service is used to monitor the service. Specifically, the agent program is configured to monitor a processing condition of the allocated service request corresponding to the service, so as to determine whether the processing of the allocated service request corresponding to the service is completed.
Optionally, the first service is a service implemented based on Java, and the agent program is a Java agent program. The Java agent is a Java byte code enhancement technology and has the characteristic of non-invasiveness. That is, the JavaAgent can perform some processing on the service code without modifying the service code, for example, the JavaAgent can realize data statistics and the like by monitoring the service code.
By adopting the agent program to monitor each service, whether the processing of the distributed business request corresponding to each service is finished can be determined by the agent program without modifying the implementation logic of each service, so that on one hand, the time for stopping the service can be accurately grasped, and the smooth offline of the service is ensured; on the other hand, the intrusion of service implementation logic is avoided, and the service stability of the service is ensured.
It should be understood that the first service is any one of a cluster of services of a server. The first service to be offline can be determined according to actual business requirements. And when the first service is determined, the server stops distributing a new service request to the first service, namely, the flow of the first service is cut out. That is, the server distributes new service requests, which are subsequently received, to other services.
In a possible implementation manner, fig. 3A is a schematic structural diagram of a possible server according to an embodiment of the present invention. As shown in fig. 3A, the server includes a load balancing unit and a plurality of services. An agent is associated with each service.
The load balancing unit is used for distributing the service request to a plurality of services. Specifically, after the server receives the service request from the client, the load balancing unit allocates the service request to one of the services according to the load conditions of the plurality of services.
Further, the load balancing unit is also used for realizing offline control of the service. Specifically, the load balancing unit determines a first service to be offline, stops allocating a new service request to the first service, and switches out traffic of the first service.
With reference to fig. 3A, since the agent program of the first service may monitor the processing condition of the allocated service request corresponding to the first service, the load balancing unit may further determine whether the processing of the allocated service request corresponding to the first service is completed through the agent program of the first service. And after determining that the processing of the allocated service request corresponding to the first service is completed through the agent program of the first service, the load balancing unit stops the first service.
In another possible implementation manner, fig. 3B is a schematic structural diagram of another possible server provided in an embodiment of the present invention. As shown in fig. 3B, the server includes: the system comprises a service offline control unit, a load balancing unit and a plurality of services. An agent is associated with each service.
The load balancing unit is used for distributing service requests to a plurality of services. Specifically, after the server receives the service request from the client, the load balancing unit allocates the service request to one of the services according to the load conditions of the plurality of services.
The service offline control unit is used for realizing the service offline control. Specifically, the service offline control unit determines a first service to be offline, notifies the load balancing unit to stop allocating a new service request to the first service, and switches out traffic of the first service.
With reference to fig. 3B, since the agent program of the first service may monitor the processing condition of the allocated service request corresponding to the first service, the service offline control unit may further determine whether the processing of the allocated service request corresponding to the first service is completed through the agent program of the first service. And after determining that the processing of the allocated service request corresponding to the first service is completed through the agent program of the first service, the service offline control unit stops the first service.
Through the two possible implementation manners, the control process of the server for the service offline can be realized through the load balancing unit, and can also be realized through the service offline control unit.
The process of taking a service out of line is described below with reference to a specific example. In this example, the server structure shown in fig. 3B is taken as an example for description, and it should be understood that when the server structure shown in fig. 3A is applied, the corresponding service offline process is similar, and details are not described again in this embodiment.
Fig. 4 is a schematic diagram of a service offline process according to an embodiment of the present invention. As shown in fig. 4, it is assumed that the service cluster includes 4 services, which are: service 1, service 2, service 3, and service 4. In a certain application scenario, the service offline control unit determines that offline processing needs to be performed on the service 1, and the service offline control unit notifies the load balancing unit to stop allocating a new service request to the service 1.
Further, the service offline control unit sends a preparation stop instruction to the agent program corresponding to the service 1. The preparation stop instruction is used for enabling the agent program to return a processing completion instruction to the service offline control unit when determining that the processing of the allocated service request corresponding to the service 1 is completed. And after receiving the preparation stop instruction, the agent program of the service 1 judges whether the processing of the distributed service request corresponding to the service 1 is finished according to the monitoring result of the service 1. And when the agent program determines that the processing of the allocated service request corresponding to the service 1 is completed, returning a processing completion instruction to the service offline control unit. The service logout control unit stops the service 1 after receiving the processing completion instruction.
It should be noted that, in the specific implementation process, the interaction process between the service offline control unit and the agent program may be implemented in various ways, for example, by a synchronous function call, a callback function, or a message interaction. This embodiment is not particularly limited thereto.
In the service offline method provided in this embodiment, the server employs a service cluster architecture, and the service cluster includes a plurality of services. Each service corresponds to an agent program, and the agent program is used for monitoring the service. When the server determines a first service to be offline, a new service request is stopped being allocated to the first service, and after the agent program of the first service determines that the processing of the allocated service request corresponding to the first service is completed, the first service is stopped. In the process, whether the processing of the distributed service request corresponding to the first service is finished or not is determined through the agent program, and the first service is stopped after the processing is determined to be finished, so that on one hand, the stopping time of the first service can be accurately grasped, and the first service is ensured to be smoothly off-line; on the other hand, the implementation logic of the first service does not need to be modified, and the service stability of the first service is ensured.
In the following, how the monitoring of the service by the agent is implemented is described in connection with a specific embodiment. Taking the first service as an example, fig. 5 is a schematic flowchart of monitoring the first service through the agent according to an embodiment of the present invention. As shown in fig. 5, the method of the present embodiment includes:
s501: and counting the number of the distributed service requests corresponding to the first service through an agent program, and counting the number of the processed service requests corresponding to the first service.
S502: and if the number of the distributed service requests is equal to the number of the processed service requests, determining that the processing of the distributed service requests corresponding to the first service is finished through the agent program.
Specifically, the agent may count the number of allocated service requests and the number of processed service requests by monitoring a request interface and a response interface of the first service.
Assuming that the first service is a service based on a preset protocol, the agent program may monitor a request interface of the preset protocol in the first service to obtain the number of allocated service requests corresponding to the first service; the agent program can also monitor the response interface of the preset protocol in the first service to obtain the number of the processed service requests corresponding to the first service.
Taking the first service as a Web service as an example, the agent program of the first service may be a java agent program. The Web service is a request response protocol based on the HTTP protocol, and therefore, for each HTTP request, the first service performs a corresponding HTTP response, which indicates that one service request is processed. Therefore, the java agent corresponding to the first service can count the number of HTTP requests and the number of HTTP responses by monitoring the HTTP request interface and the HTTP response interface. When the JavaAgent determines that the number of the HTTP requests is equal to the number of the HTTP responses according to the statistical result, the JavaAgent can determine that the processing of the distributed service requests corresponding to the first service is completed.
For example, in one possible implementation, the agent may maintain a queue of HTTP requests. When the agent monitors the HTTP request, the HTTP request is added to the HTTP request queue. When the proxy program monitors the HTTP response, the HTTP request corresponding to the HTTP response is removed from the queue. Thus, when the agent detects that the HTTP request queue is empty, it can be determined that the processing of the allocated service request is completed.
In this embodiment, the agent program counts the number of allocated service requests and the number of processed service requests by monitoring the first service, the request interface and the response interface, and determines that processing of the allocated service requests corresponding to the first service is completed when the number of allocated service requests is equal to the number of processed service requests, thereby ensuring accuracy of a determination result, and further enabling the server to accurately grasp time for stopping the service and ensure smooth offline of the service.
The following describes the comparison between the service offline method according to the embodiment of the present invention and the existing service offline method, taking a logistics business system as an example.
In practical application, a logistics system often has a service request for exporting a report, and the processing time corresponding to the service request is about 2 minutes to 5 minutes according to the difference of the size of the data volume to be exported. Suppose that the server determines that service 1 needs to be offline, service 1 has exactly one business request to export a report to be processed.
If the prior art processing method is adopted, the server will stop the service 1 immediately, or stop the service 1 after waiting for a preset time (for example, 30s), both of which will cause the current service request processing failure. Of course, by setting the preset time length long enough (for example, longer than 5 minutes), it can be ensured that the current service request processing is completed. However, in different application scenarios, the number of allocated service requests that have not been processed yet and the required processing time are different, and no matter how long the preset time is set, it cannot be guaranteed that all allocated service requests can be processed and completed within the preset time. In addition, if the preset time length is set to be too long, the waiting time is wasted.
By adopting the method of the embodiment of the invention, when the server determines that the offline service 1 is needed, the server does not immediately stop the service 1, but waits for the monitoring result of the agent program corresponding to the service 1. Meanwhile, the agent program of the service 1 monitors the processing condition of the allocated service request in the service 1, and when the agent program determines that the processing of the allocated service request corresponding to the service 1 is completed according to the monitoring result, the server stops the service 1. That is, if the allocated service request corresponding to the service 1 is processed and completed within 1 second, the server only needs to wait for 1 second to stop the service 1, and if the allocated service request corresponding to the service 1 is processed and completed within 1 minute, the server waits for 1 minute to stop the service 1.
Therefore, compared with the prior art, the method of the embodiment can more accurately control the service stopping time and avoid the failure of service request processing. In addition, the embodiment of the invention monitors the service 1 through the agent program without modifying the service logic of the service 1, thereby avoiding the invasion of the service logic of the service 1 and ensuring the service stability.
Fig. 6 is a schematic structural diagram of a service downline device provided in an embodiment of the present invention, where the device may be in the form of software and/or hardware, and the device may be a server, or may be integrated in a server. As shown in fig. 6, the service downloading device 10 provided in this embodiment includes: a determination module 11 and a processing module 12.
The determining module 11 is configured to determine a first service to be offline, where the first service corresponds to an agent, and the agent is used to monitor the first service;
a processing module 12, configured to stop allocating a new service request to the first service;
the processing module 12 is further configured to stop the first service after determining that the processing of the allocated service request corresponding to the first service is completed through the agent program.
In a possible implementation manner, the processing module 12 is specifically configured to:
counting the number of distributed service requests corresponding to the first service through the agent program, and counting the number of processed service requests corresponding to the first service;
and if the number of the distributed service requests is equal to the number of the processed service requests, determining that the processing of the distributed service requests corresponding to the first service is finished through the agent program.
In a possible implementation manner, the first service uses a preset protocol; the processing module 12 is specifically configured to:
monitoring the request interface of the preset protocol in the first service through the agent program to obtain the quantity of distributed service requests corresponding to the first service;
and monitoring the response interface of the preset protocol in the first service through the agent program to obtain the number of the processed service requests corresponding to the first service.
In a possible implementation manner, the preset protocol is an HTTP protocol.
In a possible implementation manner, the processing module 12 is specifically configured to:
sending a preparation stopping instruction to the agent program, wherein the preparation stopping instruction is used for enabling the agent program to return a processing completion instruction when determining that the processing of the distributed service request corresponding to the first service is completed;
and stopping the first service after receiving a processing completion instruction returned by the agent program.
In a possible implementation manner, the first service is a service implemented based on Java, and the agent program is a Java agent program.
The service offline device provided in this embodiment may be used to implement the technical solution in any of the above method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. The electronic device of the present embodiment may function as a server. As shown in fig. 7, the electronic device 20 of the present embodiment includes: at least one processor 21 and memory 22; a memory 22 for storing computer execution instructions; the processor 21 is configured to execute computer-executable instructions stored in the memory to implement the service logoff method in the above embodiments. Reference may be made in particular to the description relating to the method embodiments described above.
Alternatively, the memory 22 may be separate or integrated with the processor 21.
When the memory 22 is a device independent from the processor 21, the electronic device 20 may further include: a bus 23 for connecting the memory 22 and the processor 21.
Optionally, the electronic device 20 may further comprise a communication component 24 for communicating with other devices (e.g. clients).
The electronic device provided in this embodiment may be configured to execute the technical solution in any of the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
An embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes computer-executable instructions, and the computer-executable instructions are used to implement the technical solutions in any one of the above method embodiments.
An embodiment of the present invention further provides a chip, including: the system comprises a memory, a processor and a computer execution instruction, wherein the computer execution instruction is stored in the memory, and the processor runs the computer execution instruction to execute the technical scheme of any one of the method embodiments.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules is only one logical division, and other divisions may be realized in practice, for example, a plurality of modules may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one unit. The unit formed by the modules can be realized in a hardware form, and can also be realized in a form of hardware and a software functional unit.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention.
It should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in the incorporated application may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile storage NVM, such as at least one disk memory, and may also be a usb disk, a removable hard disk, a read-only memory, a magnetic or optical disk, etc.
The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present invention are not limited to only one bus or one type of bus.
The storage medium may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the storage medium may reside as discrete components in an electronic device or host device.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for service logoff, comprising:
determining a first service to be offline, wherein the first service corresponds to an agent program used for monitoring the first service;
stopping assigning a new service request to the first service;
and stopping the first service after determining that the processing of the allocated service request corresponding to the first service is completed through the agent program.
2. The method of claim 1, wherein determining, by the agent, that processing of the allocated service request corresponding to the first service is complete comprises:
counting the number of distributed service requests corresponding to the first service through the agent program, and counting the number of processed service requests corresponding to the first service;
and if the number of the distributed service requests is equal to the number of the processed service requests, determining that the processing of the distributed service requests corresponding to the first service is finished through the agent program.
3. The method of claim 2, wherein the first service employs a predetermined protocol; the counting, by the agent program, the number of allocated service requests corresponding to the first service and the number of processed service requests corresponding to the first service includes:
monitoring the request interface of the preset protocol in the first service through the agent program to obtain the quantity of distributed service requests corresponding to the first service;
and monitoring the response interface of the preset protocol in the first service through the agent program to obtain the number of the processed service requests corresponding to the first service.
4. The method according to claim 3, wherein the predetermined protocol is the HTTP protocol.
5. The method according to any of claims 1 to 4, wherein stopping the first service after determining, by the agent program, that processing of the allocated service request corresponding to the first service is completed comprises:
sending a preparation stopping instruction to the agent program, wherein the preparation stopping instruction is used for enabling the agent program to return a processing completion instruction when determining that the processing of the distributed service request corresponding to the first service is completed;
and stopping the first service after receiving a processing completion instruction returned by the agent program.
6. The method according to any one of claims 1 to 5, wherein the first service is a Java-implementation-based service, and the agent program is a Java agent program.
7. A service downline apparatus, comprising:
the system comprises a determining module, a monitoring module and a judging module, wherein the determining module is used for determining a first service to be offline, the first service corresponds to an agent program, and the agent program is used for monitoring the first service;
a processing module for stopping the allocation of a new service request to the first service;
the processing module is further configured to stop the first service after determining, by the agent program, that processing of the allocated service request corresponding to the first service is completed.
8. The apparatus of claim 7, wherein the processing module is specifically configured to:
counting the number of distributed service requests corresponding to the first service through the agent program, and counting the number of processed service requests corresponding to the first service;
and if the number of the distributed service requests is equal to the number of the processed service requests, determining that the processing of the distributed service requests corresponding to the first service is finished through the agent program.
9. An electronic device, comprising: at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores computer-executable instructions that, when executed by the at least one processor, implement the method of any one of claims 1-6.
10. A computer-readable storage medium having computer-executable instructions stored thereon, which when executed by a processor, are configured to implement the method of any one of claims 1 to 6.
CN202010413586.XA 2020-05-15 2020-05-15 Service offline method, device and equipment Pending CN111581061A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010413586.XA CN111581061A (en) 2020-05-15 2020-05-15 Service offline method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010413586.XA CN111581061A (en) 2020-05-15 2020-05-15 Service offline method, device and equipment

Publications (1)

Publication Number Publication Date
CN111581061A true CN111581061A (en) 2020-08-25

Family

ID=72123081

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010413586.XA Pending CN111581061A (en) 2020-05-15 2020-05-15 Service offline method, device and equipment

Country Status (1)

Country Link
CN (1) CN111581061A (en)

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
CN106850746A (en) * 2016-12-23 2017-06-13 微梦创科网络科技(中国)有限公司 The method and device of smooth service upgrading
WO2018014789A1 (en) * 2016-07-22 2018-01-25 阿里巴巴集团控股有限公司 Method and device for controlling service operation risk
CN107948284A (en) * 2017-11-24 2018-04-20 泰康保险集团股份有限公司 A kind of service inserting method, equipment and system based on micro services framework
CN109062660A (en) * 2018-07-06 2018-12-21 杭州涂鸦信息技术有限公司 A kind of method of the offline application service of Docker Environmental security

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
WO2018014789A1 (en) * 2016-07-22 2018-01-25 阿里巴巴集团控股有限公司 Method and device for controlling service operation risk
CN106850746A (en) * 2016-12-23 2017-06-13 微梦创科网络科技(中国)有限公司 The method and device of smooth service upgrading
CN107948284A (en) * 2017-11-24 2018-04-20 泰康保险集团股份有限公司 A kind of service inserting method, equipment and system based on micro services framework
CN109062660A (en) * 2018-07-06 2018-12-21 杭州涂鸦信息技术有限公司 A kind of method of the offline application service of Docker Environmental security

Similar Documents

Publication Publication Date Title
US10152347B2 (en) Automatic virtual machine termination in a cloud
WO2019205371A1 (en) Server, message allocation method, and storage medium
CN109936511B (en) Token obtaining method, device, server, terminal equipment and medium
CN111447577B (en) Quota management method and device
CN107819797B (en) Access request processing method and device
CN109766172B (en) Asynchronous task scheduling method and device
CN110661824B (en) Flow control method of server in distributed cluster and storage medium
CN110784530A (en) Gray scale publishing method and server
CN113067875A (en) Access method, device and equipment based on dynamic flow control of micro-service gateway
CN110515728B (en) Server scheduling method and device, electronic equipment and machine-readable storage medium
CN107426012B (en) Fault recovery method and device based on super-fusion architecture
CN111491015B (en) Preheating task processing method and system, proxy server and service center
CN111581061A (en) Service offline method, device and equipment
KR20060004920A (en) System for determining unreturned standby resource usage
CN114995982A (en) Task processing method and device and storage medium
CN114374657A (en) Data processing method and device
CN113918282A (en) Database access method and device, electronic equipment and computer readable medium
CN109460291B (en) Electronic device, method for elastically controlling server cluster and storage medium
CN112764992A (en) Thread pool monitoring method, device and equipment
CN110971697A (en) Redis single instance protection processing method and device, computer equipment and storage medium
CN108900604A (en) Information dispensing method, device, branch office service end and storage medium
CN117472516B (en) Virtual resource scheduling method, device, cluster system, electronic equipment and medium
EP4404539A1 (en) Resource scheduling method, apparatus and system, device, medium, and program product
CN114238277A (en) Request processing method, system and processor in data migration
JP2017174106A (en) Management device, server, thin client system, management method, and program

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200825