CN112596761A - Service update release method, device and related equipment - Google Patents

Service update release method, device and related equipment Download PDF

Info

Publication number
CN112596761A
CN112596761A CN202011478979.5A CN202011478979A CN112596761A CN 112596761 A CN112596761 A CN 112596761A CN 202011478979 A CN202011478979 A CN 202011478979A CN 112596761 A CN112596761 A CN 112596761A
Authority
CN
China
Prior art keywords
target
instance
counter
request
update
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011478979.5A
Other languages
Chinese (zh)
Other versions
CN112596761B (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

Images

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

Abstract

The disclosure relates to a method and a device for updating and releasing service, electronic equipment 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 calling request for the target instance is received, performing numerical value addition operation on the thread number of the target counter according to the calling request; when the feedback information of the calling request is intercepted, performing numerical subtraction on the thread number of the target counter according to the feedback information; removing the target instance from the service list upon receiving an update-on-line 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 the update online request aiming at the target instance. The service updating and publishing method, the service updating and publishing device, the electronic equipment and the computer readable medium can reduce the online publishing risk and improve the system availability.

Description

Service update release method, device and related equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for updating and publishing a service, an electronic device, and a computer-readable medium.
Background
In the service issuing process, the service instance needs to complete the processing of the sent request, otherwise the request is missed. At present, the common method is to wait for a certain time according to experience, then stop application, and start updated application, but this method cannot ensure that all received requests are processed, and has a higher risk of online release.
Therefore, a new service update distribution method, apparatus, electronic device, and computer readable medium are needed.
The above information disclosed in the background section is only for enhancement of understanding of the background of the present disclosure, and thus it may include information that does not constitute related art known to those of ordinary skill in the art.
Disclosure of Invention
In view of this, the embodiments of the present disclosure provide an update distribution method and apparatus for a service, an electronic device, and a computer-readable medium, which can reduce the risk of online distribution and improve the system availability.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, an update distribution method for a service is provided, where the method includes: acquiring a target instance in a service list and a target counter of the target instance; when a calling request for the target instance is received, performing numerical value addition operation on the thread number of the target counter according to the calling request; when the feedback information of the calling request is intercepted, performing numerical subtraction on the thread number of the target counter according to the feedback information; removing the target instance from the service list upon receiving an update-on-line 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 the update online request aiming at the target instance.
In an exemplary embodiment of the present disclosure, performing a numerical addition operation on the thread number of the target counter according to the call request includes: when the numerical addition operation on the thread number of the target counter according to the calling request fails, establishing a standby counter according to the calling request and initializing the numerical value of the thread number of the standby counter; and executing numerical value addition operation on the thread number of the standby counter according to the calling request.
In an exemplary embodiment of the present disclosure, the method further comprises: when the called times of the standby counter are smaller than a calling time threshold value within preset time, updating the thread number of the target counter according to the sum of the thread number of the standby counter and the thread number of the target counter; 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 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 the abnormal information of the target instance is received after the updating online operation is executed, rolling back 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; after receiving an update on-line request aiming at the target instance, receiving and processing a call request by using 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 updating online operation to the service list; removing the second instance from the service list upon receiving an update-on-line request for the second instance; and executing the update on-line operation on the second instance according to the update on-line request aiming at the second instance.
According to an aspect of the present disclosure, an update distribution apparatus for a service is provided, the apparatus including: the counter acquisition module is 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 numerical addition operation on the thread number of the target counter according to a call request when the call request to the target instance is received; the second operation module is configured to perform numerical subtraction on the thread number of the target counter according to the feedback information when the feedback information of the calling request is intercepted; a request receiving module configured to remove the target instance from the service list when receiving an update on-line request for the target instance; and the request response module is configured to execute an update on-line operation on the target instance according to the update on-line request aiming at the target instance when the thread number of the target counter is zero.
According to an aspect of the present disclosure, an electronic device is provided, the electronic device including: one or more processors; storage means for storing one or more programs; when executed by one or more processors, cause the one or more processors to implement a method as described above.
According to an aspect of the disclosure, a computer-readable medium is proposed, on which a computer program is stored, which program, when being executed by a processor, carries out the method as set forth above.
According to the update distribution method, the update distribution device, the electronic device and the computer readable medium for the service, when the service is distributed, the thread number of the target instance in the service list is counted through the target counter, the number of requests for calling the target instance can be mastered in real time, and the calling condition of the target instance can be mastered in real time. Meanwhile, when an update on-line request of the target instance is received, the target instance is removed from the service list, the call request of the target instance can be interrupted, the unprocessed call request of the target instance is avoided when the update is issued, the risk of on-line issuing is reduced, and the system availability is improved. Before executing the updating online operation of the target instance, judging by judging the thread number in the target counter of the target instance, and executing the updating online operation of the target instance when the thread number of the target counter is zero, namely when the target instance has no unprocessed request. The service publishing can be carried out after the target instance has processed all the requests, so that the online publishing risk is reduced, and the system availability is improved.
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 some embodiments of the present disclosure, and other drawings may be derived from those drawings by those of ordinary skill in the art without inventive effort.
Fig. 1 is a flowchart of a business processing method shown in the root related art.
FIG. 2 is a flow diagram illustrating a method for update publication for a service in accordance with an exemplary embodiment.
FIG. 3 is a flow diagram illustrating a method for update publication for a service in accordance with an exemplary embodiment.
FIG. 4 is a flow diagram illustrating a method for update publication for a service in accordance with an exemplary embodiment.
FIG. 5 is a flow diagram illustrating a method for update publication for a service in accordance with an exemplary embodiment.
FIG. 6 is a flow diagram illustrating a method for update publication for a service in accordance with an exemplary embodiment.
FIG. 7 is a flow diagram illustrating a method for update publication for a service in accordance with an exemplary embodiment.
FIG. 8 is a block diagram illustrating an update distribution mechanism for a service in accordance with an exemplary embodiment.
Fig. 9 schematically illustrates a block diagram of an electronic device in an exemplary embodiment of the disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different 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 example embodiments to those skilled in the art. The same reference numerals denote the same or similar parts in the drawings, 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 subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to 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 actual execution sequence may be changed according to the actual situation.
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. Thus, a first component discussed below may be termed a second component without departing from the teachings of the disclosed concept. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
It is to be understood by those skilled in the art that the drawings are merely schematic representations of exemplary embodiments, and that the blocks or processes shown in the drawings are not necessarily required to practice the present disclosure and are, therefore, not intended to limit the scope of the present disclosure.
In the related art, as shown in fig. 1, communication between micro services is performed through Message middleware, that is, a client application places a Message on a Message Queue (MQ) of the Message middleware, and a server acquires the Message by monitoring the Message Queue to perform service processing, which may reduce coupling between the micro services, but also bring a certain trouble to online publishing of the server because it is not known whether there is a Message being processed when the service is stopped, and data loss may be caused if the Message is directly stopped.
At present, no technical solution capable of coping with the above drawbacks exists.
In view of the defects in the related art, the application provides a method and a device for updating and publishing a service, which can reduce the risk of online publishing and improve the availability of a system.
FIG. 3 is a flow diagram illustrating a method for update publication for a service in accordance with an exemplary embodiment. The update distribution method of the service provided by the embodiment of the present disclosure may be executed by any electronic device with computing processing capability, such as a user terminal and/or a server, in the following embodiments, the method executed by the server is taken as an example for illustration, but the present disclosure is not limited thereto. The update distribution method 10 for 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 target instance and other service instances besides the target instance may be included in the service list. The instance recorded in the service list is the instance that is currently invokable. For example, in the micro service architecture, when the target instance is online, the service identifier (service id) of the target instance to be started is registered to the registration and discovery center through the service name through interaction with the registration and discovery center, which may be, for example, as shown in fig. 2. That is, the service list under the same service name will increase the service id of the target instance that has just registered; when the client side application transfers the server side interface, a service list is obtained from the registration and discovery center through the service name, and then the service id is selected to be transferred through the existing load balancing strategy.
The target counter has a number counting function, and the number of the threads can be counted by using the number counting function. I.e., the number of threads of the target counter is the number of threads that the target instance has not currently completed processing. For example, when the number of threads whose processing by the target instance is not completed is 2, the number of threads of the target counter is 2.
In the embodiments of the present disclosure, there may be one or more target counters, and the present disclosure does not particularly limit this. When the target counter is a plurality of 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 the target instance, a numerical addition operation is performed on the thread number of the target counter according to the call request.
In the embodiment of the present disclosure, the target counter may be a counter initialized when the target instance starts. An AOP facet may be defined that intercepts call requests for facet-Oriented Programming (AOP). In software development, functions scattered throughout an application are referred to as cross-cutting centers (CROSS-CUTTING CONCERNS), and in general, these CROSS-CUTTING CONCERNS are conceptually separated from the business logic of the application. For example, declarative transactions, logs, security, caches and the like are all irrelevant to business logic, the things can be abstracted into modules, a section-oriented programming mode is adopted, the functions are defined where to use in the declarative mode, the functions of the modularized crosscut point-of-interest programs are realized through a precompilation mode and a running-time dynamic proxy to carry out unified maintenance, so that crosscut points of interest are separated from objects influenced by the crosscut points of interest, and 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 there is one call request, the target counter may be obtained before the call request is processed, and the thread number 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 present disclosure, it may be defined that the AOP slice intercepts the feedback information of the call request. And obtains the target counter for the target instance before sending the feedback information.
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 thread number of the updated target counter. For example, when there is one feedback message, the target counter may be obtained before sending the feedback message, and the number of threads of the target counter is decreased 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, the operation on the thread number of the target counter may also be performed based on the request information in the MQ message queue.
For example, in the micro service architecture scenario, it is assumed that one of the clients of one micro service application is C, the server is S, the name of the registered service of the service S in the registration and discovery center is S, and the corresponding service lists are S1 and S2, that is, the service S has two target instances S1 and S2; when the client C1 requests S1 or S2, the client C also has two instances C1 and C2, first acquires S1 and S2 according to the service name S, and then sends the request to S1 or S2 according to the load balancing policy, assuming that S1 receives the request, at this time, the request received by S1 is intercepted by the tangent plane, then acquires a base counter (i.e., a target counter) before the service starts, and adds 1 to the target counter, and after the request ends, acquires the target counter again and subtracts 1.
In step S308, upon receiving an update bring-on request for the target instance, the target instance is removed from the service list.
In the embodiment of the present disclosure, the update on-line request for the target instance refers to an update operation on the target instance currently running or deployed on line, which may include a data packet for updating the target instance. Such as version updates, functionality updates, etc. for application services. As shown in fig. 2, in the micro-service architecture, when a service instance (i.e., a target instance) is deployed online (e.g., located in a service list as shown in fig. 2), a call request on the online can be received, and a specific service can be provided according to the call request. When an update on-line request is received, the service instance to be on-line is taken out of the service list of the registration and discovery center, other micro-service clients cannot call the micro-service instance (namely the target instance) when calling the service, the call request to the target instance can be cut off when the target instance is updated and published, the problem that the unprocessed call request still exists in the target instance when the target instance is updated and published is avoided, the risk of on-line publishing is reduced, and the system availability is improved.
In step S310, when the thread number of the target counter is zero, an update thread-up operation is performed on the target instance according to the update thread-up request for the target instance.
In the embodiment of the present disclosure, when the thread number of the target counter is zero, it indicates that there is no running or remaining thread in the current target instance. And then the conclusion that the target instance has no unprocessed request can be accurately judged.
According to the update release method of the service provided by the embodiment of the disclosure, when the service release is realized, the thread number of the target instance in the service list is counted through the target counter, the number of the called requests of the target instance can be mastered in real time, and the called condition of the target instance can be mastered in real time. Meanwhile, when an update on-line request of the target instance is received, the target instance is removed from the service list, the call request of the target instance can be interrupted, the unprocessed call request of the target instance is avoided when the update is issued, the risk of on-line issuing is reduced, and the system availability is improved. Before executing the updating online operation of the target instance, judging by judging the thread number in the target counter of the target instance, and executing the updating online operation of the target instance when the thread number of the target counter is zero, namely when the target instance has no unprocessed request. The service publishing can be carried out after the target instance has processed all the requests, so that the online publishing risk is reduced, and the system availability is improved.
In an exemplary embodiment, the thread number of the target counter may be read again after a preset waiting time when the thread number of the target counter is greater than zero; and when the thread number of the target counter read again after the preset waiting time is zero, executing the update online operation on the target instance according to the update online request.
In an exemplary embodiment, if exception information for a target instance is received after an update online operation is performed, the target instance may be rolled back; and generating and sending alarm information of the target instance. Wherein, whether the function is normal can be confirmed by the staff, and the next batch of release is started when the function is normal; sending the abnormal information of the target instance and rolling back the application when the target instance is abnormal; and after the problem of the abnormal information is confirmed and solved, the online publishing is executed again.
In an exemplary embodiment, in a case where the target counter is one, for example, the target counter is an hbase counter, it should be noted that the specific form of the target counter is not particularly limited in the technical solution of the present disclosure. The hbase counter is atomicity in its operation due to its synchronous locking mechanism. Atomic operations refer to operations that are not interrupted by a thread scheduling mechanism. So that only one thread can operate the counter at a time (the thread value of the query counter is not limited by the lock). In the case where the target counter is one, there will be a case of failure. In order to solve the problem of resource consumption caused by the fact that multiple threads compete for the same target counter when the concurrency is high, a counter set can be defined in a user-defined mode, and the counter set can comprise at least one standby counter. That is, when the hbase counter is locked, the thread fails to acquire the hbase counter, and then the standby counter in the counter set is acquired. For example, a custom set of counters may be initialized, which may include, for example, 8 default initialized spare counters. The back-up counter may also be extended by a multiple of 2 in the presence of a failure to acquire the back-up counter.
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 flow diagram illustrating a method for update publication for a service in accordance with an exemplary embodiment.
As shown in fig. 4, when receiving an update on-line request for a target instance, the update publishing method for a service provided by the embodiment of the present disclosure may further include steps S402 to S404.
In step S402, a second instance in the service list and a second counter of the second instance are obtained, and the second instance provides the same service as the target instance.
In the embodiment of the present disclosure, taking micro service application as an example, the service end S includes the registration service name S in the registration and discovery center, and the corresponding service list includes instances S1 and S2, where the two instances provide the same service. Assume that S1 is the target instance and S2 is the second instance. The thread number of the target instance S1 is counted by the target counter, and the thread number of the second instance S2 is counted by the second counter.
In step S404, the second instance is used to receive and process the call request, and the thread count of the second instance is counted according to the second counter.
In the embodiment of the present disclosure, since the update on-line request for the target instance is received and the target instance is removed from the service list, the target instance will not process the subsequent call request. At this time, the second instance continues to process subsequent call requests, so that normal operation of the service can be ensured, and breakpoints can not occur.
In an exemplary embodiment, the target instance after performing the update online operation may be further added to the service list; removing the second instance from the service list upon receiving an update-on-line request for the second instance; and executing the update on-line operation on the second instance according to the update on-line request aiming at the second instance.
By the mode, on the basis that each instance can perform online updating operation after processing the calling request of the instance, the online updating operation of the target instance and the second instance can be realized, normal operation of service is not influenced, and gray scale release is further realized.
FIG. 5 is a flow diagram illustrating a method for update publication for a service in accordance with an exemplary embodiment.
As shown in fig. 5, when the execution 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, 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 standby counters may be one or more, and the technical solution of the embodiment of the present disclosure is not particularly limited in this respect.
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 call fails, the standby counter can be obtained according to the feedback information of the call request, and the numerical subtraction operation is executed on the thread number of the standby counter according to the feedback information. In a micro-service architecture scenario, assuming that S1 concurrently receives 8 call requests, in order to ensure atomicity of the hbase counter, only one call request may obtain the hbase counter, and the other 7 call requests fail to obtain the hbase counter, at this time, a custom counter set may be created, and 8 backup counters may be created at the same time, the other 7 call requests may be respectively taken to the corresponding backup counters, and an operation of adding 1 is performed, after the 8 requests are completed, the target counter or the backup counter is obtained again before returning, at this time, the hbase counter may be preferentially obtained, and if the hbase counter is already locked, the unlocked backup counter in the custom counter set is obtained, and an operation of subtracting 1 is performed.
In an exemplary embodiment, when the called number of times of the standby counter is less than the calling number threshold within a predetermined time, updating the thread number of the target counter according to a sum value of the thread number of the standby counter and the thread number of the target counter; the standby counter is deleted. If the concurrency quantity is reduced and the service is not busy, the standby counter can be merged into the target counter if the use frequency of the device counter in 1 minute is less than the called frequency threshold (10 times). For example, if the thread number of the target counter is 10, and the thread number of the standby counter to be merged is 2, then the thread number of the merged target counter is 12, and the standby counter to be merged is set to 0 and is directly deleted or destroyed, that is, removed from the custom counter set, thereby achieving the purpose of saving resource overhead.
In the embodiment of the present disclosure, the atomicity of the target counter is ensured by using a 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 lock waiting based on the custom counter set.
As shown in fig. 6, the target instance may be implemented by using a offline interface, and the offline interface may remove the instance identifier of the target instance (i.e., the application) from the service list corresponding to the service name (serviceName) registered and found in the discovery center, and delete the application identifier (application id) list of the client, so that the target instance cannot receive the request. The offline interface may also implement another function: snooping of 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, that is, the total number of the current threads maintained by the target counter and the standby counter in the custom count set is returned in the interface, and the interface can also be used for monitoring the threads of the target instance.
In an exemplary embodiment, in a micro-service architecture scenario, when an update on-line request depends on an on-line issuing pipeline of a persistent integration tool (e.g., Jenkins), the on-line issuing pipeline is triggered when an application is on line, the issuing pipeline issues a group of application instances of the same micro-service in batches, that is, only one batch is issued at a time, and after the issuance is completed, a confirmation function normally issues the next batch; when the application instances of each batch are issued, the offline interface of the service is called first, after the interface is successfully called, no new thread is created in the application instances, the issuing operation can be performed only after the existing thread is finished, the current thread number of the application is obtained at the moment, and if the current thread number is judged to be 0, all in-transit requests are processed, and updating and issuing can be performed; if the current thread number is greater than 0, the process waits for 5 seconds and is acquired again. If the waiting time obtained by circulation exceeds the preset waiting threshold, the operation and maintenance personnel can intervene to determine whether to continue waiting.
The technical scheme of the embodiment of the disclosure adopts a mode of collecting the target counter and the custom counter to count and count the received requests and the created threads, guarantees atomicity of each counter through the synchronous lock, prevents lock waiting through the collection of the custom counter, and guarantees efficiency of obtaining and operating the counters. And executing online publication in a pipeline mode, stopping the application from receiving a new request in a service offline mode, and determining that no unprocessed request is finished in a mode of judging the current thread number, so that online publication risks are reduced, and the system availability is improved.
Those skilled in the art will appreciate that all or part of the steps implementing the above embodiments are implemented as computer programs executed by a CPU. When executed by the CPU, performs the functions defined by the above-described methods provided by the present disclosure. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic or optical disk, or the like.
Furthermore, it should be noted that the above-mentioned figures are only schematic illustrations of the processes involved in the methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods. For details not disclosed in the embodiments of the apparatus of the present disclosure, refer to the embodiments of the method of the present disclosure.
FIG. 8 is a block diagram illustrating an update distribution mechanism for a service in accordance with an exemplary embodiment. The update distribution apparatus 80 for services 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.
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, upon receiving a call request for the target instance, perform a numerical addition operation on the number of threads of the target counter according to the call request.
The second operation module 806 may be configured to, when the feedback information of the call request is intercepted, perform a numerical subtraction operation on the thread number of the target counter according to the feedback information.
The request receiving module 808 may be configured to remove the target instance from the service list upon receiving an update-on-line request for the target instance.
The request response module 810 may be configured to perform an update on-line operation on the target instance according to an update on-line request for the target instance when the number of threads of the target counter is zero.
According to the update distribution device for the service provided by the embodiment of the disclosure, when the service distribution is realized, the thread number of the target instance in the service list is counted through the target counter, so that the number of called requests of the target instance can be mastered in real time, and the calling condition of the target instance can be mastered in real time. Meanwhile, when an update on-line request of the target instance is received, the target instance is removed from the service list, the call request of the target instance can be interrupted, the unprocessed call request of the target instance is avoided when the update is issued, the risk of on-line issuing is reduced, and the system availability is improved. Before executing the updating online operation of the target instance, judging by judging the thread number in the target counter of the target instance, and executing the updating online operation of the target instance when the thread number of the target counter is zero, namely when the target instance has no unprocessed request. The service publishing can be carried out after the target instance has processed all the requests, so that the online publishing risk is reduced, and the system availability is improved.
An electronic device 900 according to this embodiment of the invention is described below with reference to fig. 9. The electronic device 900 shown in fig. 9 is only an example and should not bring any limitations to the function and scope of use of the 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 memory unit 920, and a bus 930 that couples various system components including the memory unit 920 and the processing unit 910.
Wherein the storage unit stores program code that is executable by the processing unit 910 to cause the processing unit 910 to perform steps according to various exemplary embodiments of the present invention described in the above section "exemplary methods" of the present specification. For example, the processing unit 910 may execute 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 calling request for the target instance is received, performing numerical value addition operation on the thread number of the target counter according to the calling request; step S306: when the feedback information of the calling request is intercepted, performing numerical subtraction on the thread number of the target counter according to the feedback information; step S308: removing the target instance from the service list upon receiving an update-on-line 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 the update online request aiming at the target instance.
The storage unit 920 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM)9201 and/or a cache memory unit 9202, and may further include a read only memory unit (ROM) 9203.
Storage unit 920 may also include a program/utility 9204 having a set (at least one) of program modules 9205, such program modules 9205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 930 can be any 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 devices (e.g., router, modem, etc.) that enable the electronic device 900 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interface 950. Also, the electronic device 900 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet) via the network adapter 960. As shown, the network adapter 960 communicates with the other modules of the electronic device 900 via the bus 930. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, 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 (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, aspects of the invention may also be implemented in the form of a program product comprising program code means for causing a terminal device to carry out the steps according to various exemplary embodiments of the invention described in the above section "exemplary methods" of the present description, 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. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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 for aspects 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 and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, 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., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple 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 variations, 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 (10)

1. An update distribution method for a service, comprising:
acquiring a target instance in a service list and a target counter of the target instance;
when a calling request for the target instance is received, performing numerical value addition operation on the thread number of the target counter according to the calling request;
when the feedback information of the calling request is intercepted, performing numerical subtraction on the thread number of the target counter according to the feedback information;
removing the target instance from the service list upon receiving an update-on-line 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 the update online request aiming at the target instance.
2. The method of claim 1, wherein performing a numerical addition operation on the number of threads of the target counter in accordance with the call request comprises:
when the numerical addition operation on the thread number of the target counter according to the calling request fails, establishing a standby counter according to the calling request and initializing the numerical value of the thread number of the standby counter;
and executing numerical value addition operation on the thread number of the standby counter according to the calling request.
3. The method of claim 2, further comprising:
when the called times of the standby counter are smaller than a calling time threshold value within preset time, updating the thread number of the target counter according to the sum of the thread number of the standby counter and the thread number of the target counter;
deleting the standby counter.
4. The method of 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 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.
5. The method of claim 1, further comprising:
if the abnormal information of the target instance is received after the updating online operation is executed, rolling back the target instance;
and generating and sending the alarm information of the target instance.
6. The method of 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;
after receiving an update on-line request aiming at the target instance, receiving and processing a call request by using the second instance, and counting the thread number of the second instance according to the second counter.
7. The method of claim 6, further comprising:
adding the target instance after the updating online operation to the service list;
removing the second instance from the service list upon receiving an update-on-line request for the second instance;
and executing the update on-line operation on the second instance according to the update on-line request aiming at the second instance.
8. An update distribution apparatus for a service, comprising:
the counter acquisition module is 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 numerical addition operation on the thread number of the target counter according to a call request when the call request to the target instance is received;
the second operation module is configured to perform numerical subtraction on the thread number of the target counter according to the feedback information when the feedback information of the calling request is intercepted;
a request receiving module configured to remove the target instance from the service list when receiving an update on-line request for the target instance;
and the request response module is configured to execute an update on-line operation on the target instance according to the update on-line request aiming at the target instance when the thread number of the target counter is zero.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
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 true CN112596761A (en) 2021-04-02
CN112596761B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115016824A (en) * 2022-08-09 2022-09-06 飞狐信息技术(天津)有限公司 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

Cited By (2)

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

Also Published As

Publication number Publication date
CN112596761B (en) 2023-09-22

Similar Documents

Publication Publication Date Title
CN105357038B (en) Monitor the method and system of cluster virtual machine
US8769536B2 (en) Processing a batched unit of work
US8166480B2 (en) Reducing lock contention by adding a time slice to an active thread holding a lock
US7900210B2 (en) Application connector parallelism in enterprise application integration systems
US7792916B2 (en) Management of cluster-wide resources with shared variables
CN108595282A (en) A kind of implementation method of high concurrent message queue
US8489729B2 (en) System and method for social service event processing and management
US20220171652A1 (en) Distributed container image construction scheduling system and method
CN109783151B (en) Method and device for rule change
CN114138434B (en) Big data task scheduling system
CN111414241A (en) Batch data processing method, device and system, computer equipment and computer readable storage medium
CN112346834A (en) Database request processing method and device, electronic equipment and medium
EP4361808A1 (en) Resource scheduling method and device and computing node
CN112100034A (en) Service monitoring method and device
CN113703997A (en) Bidirectional asynchronous communication middleware system integrating multiple message agents and implementation method
CN115964153A (en) Asynchronous task processing method, device, equipment and storage medium
CN112596761A (en) Service update release method, device and related equipment
CN113971098A (en) RabbitMQ consumption management method and system
US8788601B2 (en) Rapid notification system
CN110928746A (en) Configurable service processing system, method, device and storage medium
CN115658745A (en) Data processing method, data processing device, computer equipment and computer readable storage medium
CN114968636A (en) Fault processing method and device
CN113656239A (en) Monitoring method and device for middleware and computer program product
CN111694645B (en) Task processing method and related device in distributed task scheduling system
CN113419921A (en) Task monitoring method, device, equipment and storage medium

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