CN112596761B - Service update release method and device and related equipment - Google Patents

Service update release method and device and related equipment Download PDF

Info

Publication number
CN112596761B
CN112596761B CN202011478979.5A CN202011478979A CN112596761B CN 112596761 B CN112596761 B CN 112596761B CN 202011478979 A CN202011478979 A CN 202011478979A CN 112596761 B CN112596761 B CN 112596761B
Authority
CN
China
Prior art keywords
target
instance
counter
thread number
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.)
Active
Application number
CN202011478979.5A
Other languages
Chinese (zh)
Other versions
CN112596761A (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.)
Taikang Life Insurance Co ltd
Taikang Insurance Group Co Ltd
Original Assignee
Taikang Life Insurance Co ltd
Taikang Insurance Group 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 Taikang Life Insurance Co ltd, Taikang Insurance Group Co Ltd filed Critical Taikang Life Insurance Co ltd
Priority to CN202011478979.5A priority Critical patent/CN112596761B/en
Publication of CN112596761A publication Critical patent/CN112596761A/en
Application granted granted Critical
Publication of CN112596761B publication Critical patent/CN112596761B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • 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)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to a service update release method, a service update release device, an electronic device and a computer readable medium. The method comprises the following steps: acquiring a target instance in a service list and a target counter of the target instance; when a call request for the target instance is received, executing numerical addition operation on the thread number of the target counter according to the call request; when feedback information of the call request is intercepted, performing numerical subtraction operation on the thread number of the target counter according to the feedback information; removing the target instance from the service list when receiving an update online request for the target instance; and when the thread number of the target counter is zero, executing an update online operation on the target instance according to an update online request for the target instance. The method, the device, the electronic equipment and the computer readable medium for issuing the update of the service can reduce the online issuing risk and improve the usability of the system.

Description

Service update release method and device and related equipment
Technical Field
The disclosure relates to the field of computer technology, and in particular, to a service update release method, a service update release device, an electronic device and a computer readable medium.
Background
In the service release process, the service instance needs to process the sent request, otherwise, the request is missed. At present, the common practice is to wait a certain time according to experience, then stop the application and start the updated application, but the practice cannot ensure that all received requests are processed, and the online release risk is high.
Accordingly, there is a need for a new service update distribution method, apparatus, electronic device, and computer-readable medium.
The above information disclosed in the background section is only for enhancement of understanding of the background of the disclosure and thus it may include information that does not form a related art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
In view of this, embodiments of the present disclosure provide a method, an apparatus, an electronic device, and a computer readable medium for publishing an update of a service, which can reduce the risk of online publishing and improve the availability of the system.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to an aspect of the present disclosure, a method for publishing an update of a service is provided, the method including: acquiring a target instance in a service list and a target counter of the target instance; when a call request for the target instance is received, executing numerical addition operation on the thread number of the target counter according to the call request; when feedback information of the call request is intercepted, performing numerical subtraction operation on the thread number of the target counter according to the feedback information; removing the target instance from the service list when receiving an update online request for the target instance; and when the thread number of the target counter is zero, executing an update online operation on the target instance according to an update online request for the target instance.
In one exemplary embodiment of the present disclosure, performing a numerical addition operation on the thread count of the target counter according to the call request includes: when the execution of the numerical addition operation on the thread number of the target counter fails according to the call request, creating a standby counter according to the call request and initializing the numerical value of the thread number of the standby counter; and executing numerical addition operation on the thread number of the standby counter according to the call request.
In an exemplary embodiment of the present disclosure, the method further comprises: when the called times of the standby counter in the preset time is smaller than a calling times threshold value, updating the thread number of the target counter according to the sum value of the thread number of the standby counter and the thread number of the target counter; and deleting the standby counter.
In an exemplary embodiment of the present disclosure, the method further comprises: when the thread number of the target counter is larger than zero, reading the thread number of the target counter again after the preset waiting time; and when the thread number of the target counter read again after the preset waiting time is zero, executing the updating online operation on the target instance according to the updating online request.
In an exemplary embodiment of the present disclosure, the method further comprises: if abnormal information of the target instance is received after the update online operation is executed, rollback is carried out on the target instance; and generating and sending the alarm information of the target instance.
In an exemplary embodiment of the present disclosure, the method further comprises: acquiring a second instance in the service list and a second counter of the second instance, wherein the second instance provides the same service as the target instance; and after receiving the update online request aiming at the target instance, receiving and processing a call request by utilizing the second instance, and counting the thread number of the second instance according to the second counter.
In an exemplary embodiment of the present disclosure, the method further comprises: adding the target instance after the update online operation is executed to the service list; removing the second instance from the service list upon receiving an update online request for the second instance; and performing an update online operation on the second instance according to an update online request for the second instance.
According to an aspect of the present disclosure, there is provided an update issue apparatus of a service, the apparatus including: a counter acquisition module configured to acquire a target instance in a service list and a target counter of the target instance; the first operation module is configured to execute a numerical addition operation on the thread number of the target counter according to the call request when the call request of the target instance is received; the second operation module is configured to execute numerical subtraction operation on the thread number of the target counter according to the feedback information when the feedback information of the call request is intercepted; a request receiving module configured to remove the target instance from the service list when receiving an update online request for the target instance; and the request response module is configured to execute an update online operation on the target instance according to the update online request aiming at the target instance when the thread number of the target counter is zero.
According to an aspect of the present disclosure, there is provided an electronic device including: one or more processors; a storage means for storing one or more programs; the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods as described above.
According to an aspect of the disclosure, a computer-readable medium is presented, on which a computer program is stored, which program, when being executed by a processor, implements a method as described above.
According to the update release method, the device, the electronic equipment and the computer readable medium of the service, which are provided by some embodiments of the present disclosure, when service release is realized, the number of threads of the target instance in the service list is counted by the target counter, so that the number of called requests of the target instance can be mastered in real time, and further the called condition of the target instance can be mastered in real time. Meanwhile, when an update online request of the target instance is received, the target instance is removed from the service list, so that the call request to the target instance can be interrupted, the problem that the target instance still has an unprocessed call request when the update is released is avoided, the online release risk is reduced, and the availability of the system is improved. Before the update online operation of the target instance is executed, the number of threads in the target counter of the target instance is judged, and when the number of threads in the target counter is zero, that is, when the target instance has no unprocessed request, the update online operation of the target instance is executed again. The method and the system can ensure that the service release is performed after the target instance has processed all the requests, thereby reducing the online release risk and improving the availability of the system.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings. The drawings described below are merely examples of the present disclosure and other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
Fig. 1 is a flowchart of a service processing method shown in the root related art.
Fig. 2 is a flowchart illustrating a method of update distribution for a service according to an exemplary embodiment.
Fig. 3 is a flowchart illustrating a method of update distribution for a service according to an exemplary embodiment.
Fig. 4 is a flowchart illustrating a method of update distribution for a service according to an exemplary embodiment.
Fig. 5 is a flowchart illustrating a method of update distribution for a service according to an exemplary embodiment.
Fig. 6 is a flowchart illustrating a method of update distribution for a service according to an exemplary embodiment.
Fig. 7 is a flowchart illustrating a method of update distribution for a service according to an exemplary embodiment.
Fig. 8 is a block diagram illustrating an update issue apparatus of a service according to an exemplary embodiment.
Fig. 9 schematically illustrates a block diagram of an electronic device in an exemplary embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the disclosed aspects may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one element from another element. Accordingly, a first component discussed below could be termed a second component without departing from the teachings of the concepts of the present disclosure. As used herein, the term "and/or" includes any one of the associated listed items and all combinations of one or more.
Those skilled in the art will appreciate that the drawings are schematic representations of example embodiments and that the modules or flows in the drawings are not necessarily required to practice the present disclosure, and therefore, should not be taken to limit the scope of the present disclosure.
In the related art, as shown in fig. 1, communication between micro services is performed through a Message middleware, that is, a client application places a Message on a Message Queue of the Message Middleware (MQ), and a server obtains the Message by monitoring the Message Queue to perform service processing.
Currently, there is no technical solution that can cope with the above drawbacks.
In view of the defects in the related art, the application provides a service update release method and device, which can reduce the online release risk and improve the usability of a system.
Fig. 3 is a flowchart illustrating a method of update distribution for a service according to an exemplary embodiment. The method for distributing the update of the service provided in the embodiments of the present disclosure may be performed by any electronic device having computing processing capability, such as a user terminal and/or a server, and in the following embodiments, the method performed by the server is exemplified, but the present disclosure is not limited thereto. The update distribution method 10 of the service provided by the embodiment of the present disclosure may include steps S302 to S310.
As shown in fig. 3, in step S302, a target instance in the service list and a target counter of the target instance are acquired.
In the embodiment of the disclosure, the service list may include a target instance and other service instances besides the target instance. The instance recorded in the service list is the currently callable instance. For example, in a micro-service architecture, when a target instance is online, a service identifier (service id) of the target instance after being started may be registered to a registration and discovery center through a service name through interaction with the registration and discovery center, and the registration and discovery center may be as shown in fig. 2, for example. That is, the service list under the same service name will increase the service id of the target instance that has just been registered; when the client side application calls the service side interface, a service list is acquired from the registration and discovery center through a service name, and then the service id is selected for calling through the existing load balancing strategy.
The target counter has a number counting function, and can be used for counting the number of threads. I.e., the number of threads of the target counter is the number of threads that the target instance has not currently processed. For example, when the number of threads of the target instance unprocessed completed is 2, the number of threads of the target counter is 2.
In the embodiment of the present disclosure, the number of the target counters may be one or more, which is not particularly limited in the present disclosure. When there are a plurality of target counters, the number of threads of the target counter is the sum of the number of threads of each target counter.
In step S304, upon receiving a call request to a target instance, a numerical addition operation is performed on the thread count of the target counter according to the call request.
In the embodiment of the disclosure, the target counter may be a counter initialized when the target instance is started. An AOP facet for facet programming (Aspect Oriented Programming, AOP) may be defined to intercept the call request. In software development, functions that are spread throughout an application are referred to as cross-cut points of interest (cross-cut points), which are typically conceptually separate from the business logic of the application. For example, declarative transactions, logs, security, cache and the like are irrelevant to business logic, the things can be abstracted into modules, a tangent plane programming-oriented mode is adopted, the functions are defined for places, and the modularized transverse focus program functions are uniformly maintained through a precompiled mode and a running period dynamic agent, so that transverse focuses and objects affected by the transverse focuses are separated, namely decoupling is realized.
The specific numerical increment of the data addition operation can be determined according to the number of the call requests, and the sum of the numerical increment and the thread number of the target counter is determined as the updated thread number of the target counter. For example, when the call request is one, the target counter may be acquired before processing the call request, and the number of threads of the target counter may be increased by 1.
In step S306, when the feedback information of the call request is intercepted, a numerical subtraction operation is performed on the thread number of the target counter according to the feedback information.
In the embodiment of the disclosure, the AOP section can be defined to intercept the feedback information of the call request. And obtain the target counter of the target instance before sending the feedback information.
Wherein, the numerical decrement of the numerical subtraction operation can be determined according to the quantity of the feedback information, and the difference value between the thread number of the target counter and the numerical decrement is determined as the updated thread number of the target counter. For example, when the feedback information is one, the target counter may be acquired before the feedback information is transmitted, and the number of threads of the target counter may be reduced by 1. The target counter may, for example, provide a method of increasing the value by 1 (e.g., addOne method) and a method of decreasing the value by 1 (e.g., subtractOne method), and may continue to decrease to a negative value after decreasing to 0. The operation of the target counter is shown in fig. 7. As shown in FIG. 7, operations on the thread count of the target counter may also be performed based on the request information in the MQ message queue.
For example, in the context of a micro-service architecture, it is assumed that one of the clients of a micro-service application is C, the server is S, the registration service name of the service S in the registration and discovery center is S, and the corresponding service lists are S1 and S2, i.e. the service S has two target instances S1 and S2; the client C also has two instances C1 and C2, when the client C1 requests S1 or S2, S1 and S2 are obtained according to the service name S first, then the request is sent to S1 or S2 according to the load balancing policy, it is assumed that S1 receives the request, at this time, the request received by S1 is intercepted by the section, then a basic counter (i.e. a target counter) is obtained before the service starts, and the target counter is incremented by 1, and after the request ends, the target counter is obtained again and decremented by 1.
In step S308, upon receiving an update online request for the target instance, the target instance is removed from the service list.
In the disclosed embodiments, an update online request for a target instance refers to an update operation for the target instance currently running or deployed online, which may include a data packet for updating the target instance. Such as version updates, functional updates, etc. of the application service. As shown in fig. 2, in the micro-service architecture, when a service instance (i.e., a target instance) is deployed on-line (e.g., in a service list as shown in fig. 2), an on-line call request may be received, and a specific service may be provided according to the call request. When an update online request is received, the service instance to be online is taken out of the service list of the registration and discovery center, and other micro service clients cannot call the micro service instance (namely the target instance) when calling services, so that when the target instance is updated and released, the call request to the target instance can be cut off, the unprocessed call request of the target instance still exists when the target instance is updated and released, the online release risk is reduced, and the usability of the system is improved.
In step S310, when the thread number of the target counter is zero, an update-up operation is performed on the target instance according to the update-up request for the target instance.
In the embodiment of the disclosure, when the thread number of the target counter is zero, the current target instance is indicated that no thread which is running or remains to be run exists. And further, the conclusion that the unprocessed request does not exist in the target instance can be accurately judged.
According to the update release method of the service, when service release is achieved, the number of threads of the target instance in the service list is counted through the target counter, the number of called requests of the target instance can be mastered in real time, and further the called condition of the target instance can be mastered in real time. Meanwhile, when an update online request of the target instance is received, the target instance is removed from the service list, so that the call request to the target instance can be interrupted, the problem that the target instance still has an unprocessed call request when the update is released is avoided, the online release risk is reduced, and the availability of the system is improved. Before the update online operation of the target instance is executed, the number of threads in the target counter of the target instance is judged, and when the number of threads in the target counter is zero, that is, when the target instance has no unprocessed request, the update online operation of the target instance is executed again. The method and the system can ensure that the service release is performed after the target instance has processed all the requests, thereby reducing the online release risk and improving the availability of the system.
In an exemplary embodiment, the thread count of the target counter may be read again after the preset waiting time when the thread count of the target counter is greater than zero; when the thread number of the target counter read again after the preset waiting time is zero, the updating online operation is executed on the target instance according to the updating online request.
In an exemplary embodiment, if exception information of the target instance is received after the update online operation is performed, the target instance may be rolled back; and generating and sending the alarm information of the target instance. Wherein, whether the function is normal or not can be confirmed by staff, and the release of the next batch is started to be executed when the function is normal; transmitting abnormal information of the target instance and rolling back the application when abnormal; after confirming and solving the problem of the abnormal information, the online release is re-executed.
In an exemplary embodiment, in a case where the target counter is one, for example, the target counter is hbase counter, it should be noted that the technical solution of the present disclosure is not particularly limited to a specific form of the target counter. The operation of the hbase counter is atomic due to its synchronous lock mechanism. Atomic operations refer to operations that are not interrupted by thread scheduling mechanisms. So that only one thread can operate the counter at a time (the thread value of the query counter is not lock limited). In the case where the target counter is one, there will be a case of failure. To solve the problem of resource consumption caused by multiple threads competing for the same target counter at high concurrency, a set of counters may be customized, which may include at least one standby counter. I.e. when the hbase counter is locked, the thread fails to acquire the hbase counter, and then acquires a spare counter in the counter set. For example, a custom counter set may be initialized, which may include, for example, 8 default initialized standby counters. In the event that there is a failure to acquire the standby counter, the standby counter may also be extended by a multiple of 2.
It should be clearly understood that this disclosure describes how to make and use particular examples, but the principles of this disclosure are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
Fig. 4 is a flowchart illustrating a method of update distribution for a service according to an exemplary embodiment.
As shown in fig. 4, the update distribution method of the service provided by the embodiment of the present disclosure may further include steps S402 to S404 when an update online request for a target instance is received.
In step S402, a second instance in the service list, which provides the same service as the target instance, and a second counter of the second instance are acquired.
In the embodiment of the disclosure, taking micro service application as an example, a registration service name of a service end S in a registration and discovery center is S, and a corresponding service list includes an instance S1 and an instance S2, where the two instances provide the same service. Let S1 be the target instance and S2 be the second instance. The number of threads of the target instance S1 is counted by the target counter, and the number of threads of the second instance S2 is counted by the second counter.
In step S404, the call request is received and processed by the second instance, and the thread count of the second instance is counted according to the second counter.
In the disclosed embodiments, since the target instance has been removed from the service list as an update online request is received for the target instance, the target instance will not process subsequent call requests. At this time, the second instance continues to process the subsequent call request, so that normal operation of the service can be ensured, and no breakpoint occurs.
In an exemplary embodiment, the target instance after performing an update online operation may also be added to the service list; removing the second instance from the service list upon receiving an update online request for the second instance; and performing an update online operation on the second instance according to an update online request for the second instance.
By the method, on the basis that each instance can update the online operation after processing the call request of the instance, the online operation of updating the target instance and the second instance can be realized, normal operation of the service is not affected, and gray level release is further realized.
Fig. 5 is a flowchart illustrating a method of update distribution for a service according to an exemplary embodiment.
In fig. 5, when the performing of the numerical addition operation on the thread number of the target counter according to the call request fails, a standby counter may be created according to the call request and the numerical value of the thread number of the standby counter may be initialized, and the numerical addition operation may be performed on the thread number of the standby counter according to the call request. The number of the spare counter may be one or more, and the technical solution of the embodiment of the disclosure is not limited in particular.
For another example, when a numerical subtraction operation is performed on the thread number of the target counter according to the feedback information; and when the thread number of the standby counter fails, acquiring the standby counter according to the feedback information of the calling request, and executing numerical subtraction operation on the thread number of the standby counter according to the feedback information. In the micro-service architecture scenario, it is assumed that S1 receives 8 call requests concurrently, in order to ensure atomicity of the hbase counter, only one call request may acquire the hbase counter, and the other 7 call requests fail to acquire, at this time, a custom counter set may be created, and simultaneously 8 standby counters are created, the other 7 request may respectively acquire the corresponding standby counter, perform an add 1 operation, and after the 8 request execution is completed, acquire the target counter or the standby counter again before returning, at this time, may preferentially acquire the hbase counter, and if the hbase counter is locked, acquire the standby counter that is not locked in the custom counter set and perform a subtract 1 operation.
In an exemplary embodiment, when the number of times the standby counter is called is less than the threshold number of times of calling in a predetermined time, updating the number of threads of the target counter according to the sum of the number of threads of the standby counter and the number of threads of the target counter; the standby counter is deleted. If the concurrency amount decreases and the service is not busy, the standby counter may be incorporated into the target counter, assuming that the usage frequency of the standby counter within 1 minute is less than the threshold number of calls (10 times). For example, if the thread count of the target counter is 10 and the thread count of the standby counter to be merged is 2, the thread count of the merged target counter is 12, and the standby counter to be merged is reset to 0 and is directly deleted or destroyed, i.e. removed from the custom counter set, thereby achieving the purpose of saving the resource overhead.
In the embodiment of the disclosure, the atomicity of the target counter is ensured by utilizing the synchronous lock mechanism of the target counter, and the efficiency of acquiring and operating the target counter or the standby counter is ensured by creating the standby counter and preventing the lock from waiting based on the self-defined counter set.
As shown in fig. 6, the implementation of the target instance may employ a down interface, where the instance identifier of the target instance (i.e., the application) may be removed from the service list corresponding to the service name (serviceName) of the discovery center, and the application identifier (application id) list of the client may be deleted, so that the target instance may not receive the request. The drop line interface may also implement another function: listening to the MQ queue is stopped so that messages from the message middleware cannot be received.
The interface for returning the current thread number can be realized, namely the total number of the current threads maintained by the target counter and the standby counter in the custom counting set is returned in the interface, and the interface can be used for thread monitoring of the target instance.
In an exemplary embodiment, in a micro-service architecture scenario, when an update online request depends on a continuous integration tool (e.g., jenkins) online release pipeline, the online release pipeline is triggered when an application is online, and the release pipeline releases a group of application instances of the same micro-service in batches, i.e., only releases one batch at a time, and after release is completed, a confirmation function normally releases the next batch; when each batch of application examples are released, firstly calling a service offline interface, after the interface is successfully called, the application examples are not created by new threads, and releasing operation can be performed only by waiting for the end of the existing threads, at the moment, the current thread number of the application is obtained, and if the current thread number=0, it is judged that all in-transit requests are processed, and updating releasing can be performed; if the current thread number >0, wait 5 seconds and acquire again. If the waiting time obtained by circulation exceeds the preset waiting threshold, the operation and maintenance personnel can intervene whether to wait continuously or not.
According to the technical scheme, the target counter and the custom counter set are adopted to count and count the received requests and the created threads, the atomicity of each counter is guaranteed through the synchronous lock, the lock is prevented from waiting through the custom counter set, and the efficiency of acquiring and operating the counters is guaranteed. And executing online release in a pipeline mode, stopping application to receive new requests in a service offline mode, confirming that no unprocessed requests are available in a mode of judging the current thread number, reducing online release risk and improving system availability.
Those skilled in the art will appreciate that all or part of the steps implementing the above described embodiments are implemented as a computer program executed by a CPU. The above-described functions defined by the above-described methods provided by the present disclosure are performed when the computer program is executed by a CPU. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic disk or an optical disk, etc.
Furthermore, it should be noted that the above-described figures are merely illustrative of the processes involved in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
The following are device embodiments of the present disclosure that may be used to perform method embodiments of the present disclosure. For details not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the method of the present disclosure.
Fig. 8 is a block diagram illustrating an update issue apparatus of a service according to an exemplary embodiment. The update issue device 80 of the service provided by the embodiment of the present disclosure may include: a counter acquisition module 802, a first operation module 804, a second operation module 806, a request receiving module 808, and a request response module 810.
The counter acquisition module 802 may be configured to acquire a target instance in a service list and a target counter for the target instance.
The first operation module 804 may be configured to perform a numerical addition operation on the thread count of the target counter according to a call request when the call request to the target instance is received.
The second operation module 806 may be configured to perform a numerical subtraction operation on the thread number of the target counter according to the feedback information when the feedback information of the call request is intercepted.
The request receiving module 808 may be configured to remove the target instance from the service list upon receiving an update online request for the target instance.
Request response module 810 may be configured to perform an update online operation on the target instance according to an update online request for the target instance when the number of threads of the target counter is zero.
According to the update release device of the service, when service release is achieved, the number of threads of the target instance in the service list is counted through the target counter, the number of called requests of the target instance can be mastered in real time, and further the called condition of the target instance can be mastered in real time. Meanwhile, when an update online request of the target instance is received, the target instance is removed from the service list, so that the call request to the target instance can be interrupted, the problem that the target instance still has an unprocessed call request when the update is released is avoided, the online release risk is reduced, and the availability of the system is improved. Before the update online operation of the target instance is executed, the number of threads in the target counter of the target instance is judged, and when the number of threads in the target counter is zero, that is, when the target instance has no unprocessed request, the update online operation of the target instance is executed again. The method and the system can ensure that the service release is performed after the target instance has processed all the requests, thereby reducing the online release risk and improving the availability of the system.
An electronic device 900 according to such an embodiment of the invention is described below with reference to fig. 9. The electronic device 900 shown in fig. 9 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 9, the electronic device 900 is embodied in the form of a general purpose computing device. Components of electronic device 900 may include, but are not limited to: the at least one processing unit 910, the at least one storage unit 920, and a bus 930 connecting the different system components (including the storage unit 920 and the processing unit 910).
Wherein the storage unit stores program code that is executable by the processing unit 910 such that the processing unit 910 performs steps according to various exemplary embodiments of the present invention described in the above-described "exemplary methods" section of the present specification. For example, the processing unit 910 may perform step S302 as shown in fig. 3: acquiring a target instance in a service list and a target counter of the target instance; step S304: when a call request for the target instance is received, executing numerical addition operation on the thread number of the target counter according to the call request; step S306: when feedback information of the call request is intercepted, performing numerical subtraction operation on the thread number of the target counter according to the feedback information; step S308: removing the target instance from the service list when receiving an update online request for the target instance; step S310: and when the thread number of the target counter is zero, executing an update online operation on the target instance according to an update online request for the target instance.
The storage unit 920 may include readable media in the form of volatile storage units, such as Random Access Memory (RAM) 9201 and/or cache memory 9202, and may further include Read Only Memory (ROM) 9203.
The storage unit 920 may also include a program/utility 9204 having a set (at least one) of program modules 9205, such program modules 9205 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
The bus 930 may be one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 900 may also communicate with one or more external devices 1000 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 900, and/or with any device (e.g., router, modem, etc.) that enables the electronic device 900 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 950. Also, electronic device 900 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 960. As shown, the network adapter 960 communicates with other modules of the electronic device 900 over the bus 930. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 900, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, a computer-readable storage medium having stored thereon a program product capable of implementing the method described above in the present specification is also provided. In some possible embodiments, the various aspects of the invention may also be implemented in the form of a program product comprising program code for causing a terminal device to carry out the steps according to the various exemplary embodiments of the invention as described in the "exemplary methods" section of this specification, when said program product is run on the terminal device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
Furthermore, the above-described drawings are only schematic illustrations of processes included in the method according to the exemplary embodiment of the present invention, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (9)

1. A method for distributing updates to a service, comprising:
acquiring a target instance in a service list and a target counter of the target instance;
when a call request for the target instance is received, executing numerical addition operation on the thread number of the target counter according to the call request;
when feedback information of the call request is intercepted, performing numerical subtraction operation on the thread number of the target counter according to the feedback information;
removing the target instance from the service list when receiving an update online request for the target instance;
when the thread number of the target counter is zero, performing an update online operation on the target instance according to an update online request for the target instance;
Wherein performing a numerical addition operation on the thread number of the target counter according to the call request includes:
when the execution of the numerical addition operation on the thread number of the target counter fails according to the call request, creating a standby counter according to the call request and initializing the numerical value of the thread number of the standby counter;
and executing numerical addition operation on the thread number of the standby counter according to the call request.
2. The method as recited in claim 1, further comprising:
when the called times of the standby counter in the preset time is smaller than a calling times threshold value, updating the thread number of the target counter according to the sum value of the thread number of the standby counter and the thread number of the target counter;
and deleting the standby counter.
3. The method as recited in claim 1, further comprising:
when the thread number of the target counter is larger than zero, reading the thread number of the target counter again after the preset waiting time;
and when the thread number of the target counter read again after the preset waiting time is zero, executing the updating online operation on the target instance according to the updating online request.
4. The method as recited in claim 1, further comprising:
if abnormal information of the target instance is received after the update online operation is executed, rollback is carried out on the target instance;
and generating and sending the alarm information of the target instance.
5. The method as recited in claim 1, further comprising:
acquiring a second instance in the service list and a second counter of the second instance, wherein the second instance provides the same service as the target instance;
and after receiving the update online request aiming at the target instance, receiving and processing a call request by utilizing the second instance, and counting the thread number of the second instance according to the second counter.
6. The method as recited in claim 5, further comprising:
adding the target instance after the update online operation is executed to the service list;
removing the second instance from the service list upon receiving an update online request for the second instance;
and performing an update online operation on the second instance according to an update online request for the second instance.
7. An update distribution device for a service, comprising:
A counter acquisition module configured to acquire a target instance in a service list and a target counter of the target instance;
the first operation module is configured to execute a numerical addition operation on the thread number of the target counter according to the call request when the call request of the target instance is received;
the second operation module is configured to execute numerical subtraction operation on the thread number of the target counter according to the feedback information when the feedback information of the call request is intercepted;
a request receiving module configured to remove the target instance from the service list when receiving an update online request for the target instance;
a request response module configured to execute an update online operation on the target instance according to an update online request for the target instance when the thread number of the target counter is zero;
the first operation module is further configured to, when performing a numerical addition operation on the thread number of the target counter according to the call request fails, create a standby counter according to the call request and initialize the numerical value of the thread number of the standby counter; and executing numerical addition operation on the thread number of the standby counter according to the call request.
8. An electronic device, comprising:
one or more processors;
a storage means for storing one or more programs;
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-6.
9. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-6.
CN202011478979.5A 2020-12-15 2020-12-15 Service update release method and device and related equipment Active CN112596761B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011478979.5A CN112596761B (en) 2020-12-15 2020-12-15 Service update release method and device and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011478979.5A CN112596761B (en) 2020-12-15 2020-12-15 Service update release method and device and related equipment

Publications (2)

Publication Number Publication Date
CN112596761A CN112596761A (en) 2021-04-02
CN112596761B true CN112596761B (en) 2023-09-22

Family

ID=75195851

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011478979.5A Active CN112596761B (en) 2020-12-15 2020-12-15 Service update release method and device and related equipment

Country Status (1)

Country Link
CN (1) CN112596761B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115016824B (en) * 2022-08-09 2022-12-13 飞狐信息技术(天津)有限公司 Service security updating method and related equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107357647A (en) * 2017-05-24 2017-11-17 华为技术有限公司 A kind of method and relevant apparatus of component renewal
CN109542645A (en) * 2018-11-20 2019-03-29 北京锐安科技有限公司 A kind of method, apparatus, electronic equipment and storage medium calling service
WO2019071740A1 (en) * 2017-10-13 2019-04-18 平安科技(深圳)有限公司 Service processing method and apparatus, readable storage medium and terminal device
CN111078441A (en) * 2018-10-19 2020-04-28 迈普通信技术股份有限公司 System running state monitoring method and device and electronic equipment
CN111597041A (en) * 2020-04-27 2020-08-28 深圳市金证科技股份有限公司 Calling method and device of distributed system, terminal equipment and server
CN111611050A (en) * 2020-04-27 2020-09-01 腾讯科技(深圳)有限公司 Information processing method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107357647A (en) * 2017-05-24 2017-11-17 华为技术有限公司 A kind of method and relevant apparatus of component renewal
WO2019071740A1 (en) * 2017-10-13 2019-04-18 平安科技(深圳)有限公司 Service processing method and apparatus, readable storage medium and terminal device
CN111078441A (en) * 2018-10-19 2020-04-28 迈普通信技术股份有限公司 System running state monitoring method and device and electronic equipment
CN109542645A (en) * 2018-11-20 2019-03-29 北京锐安科技有限公司 A kind of method, apparatus, electronic equipment and storage medium calling service
CN111597041A (en) * 2020-04-27 2020-08-28 深圳市金证科技股份有限公司 Calling method and device of distributed system, terminal equipment and server
CN111611050A (en) * 2020-04-27 2020-09-01 腾讯科技(深圳)有限公司 Information processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN112596761A (en) 2021-04-02

Similar Documents

Publication Publication Date Title
CN107729139B (en) Method and device for concurrently acquiring resources
US8166480B2 (en) Reducing lock contention by adding a time slice to an active thread holding a lock
US8756613B2 (en) Scalable, parallel processing of messages while enforcing custom sequencing criteria
CN112099935B (en) Task processing method and device
CN110888893A (en) Order processing method based on micro-service e-commerce system
EP3635547B1 (en) Systems and methods for preventing service disruption during software updates
CN109766172B (en) Asynchronous task scheduling method and device
US20120215840A1 (en) System and method for providing user context support in a native transaction platform
CN112346834A (en) Database request processing method and device, electronic equipment and medium
CN112596761B (en) Service update release method and device and related equipment
CN115964153A (en) Asynchronous task processing method, device, equipment and storage medium
WO2020258653A1 (en) Cross-node data processing method and apparatus
EP1008056B1 (en) Certified message delivery and queuing in multipoint publish/subscribe communications
CN114815714A (en) Remote vehicle control method and device and electronic equipment
CN113971098A (en) RabbitMQ consumption management method and system
CN113656239A (en) Monitoring method and device for middleware and computer program product
CN113835854A (en) Task processing method and device
US20040177111A1 (en) Non-persistent service support in transactional application support environments
CN111274047A (en) Information processing method, terminal, system, computer device and storage medium
CN114968636A (en) Fault processing method and device
US20220276901A1 (en) Batch processing management
CN114710454A (en) Message processing method, vehicle-mounted communication device, electronic equipment and storage medium
CN106484536B (en) IO scheduling method, device and equipment
CN113269605B (en) Order processing method, apparatus, device and computer readable medium
CN117149464A (en) Message synchronization method, device, system and medium under distributed architecture

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