Method for solving smooth release of multiple instances with local cache service

By using standby servers and service traffic gateways during multi-instance release, smooth release and data real-time performance are achieved, and data errors and high maintenance costs caused by multi-instance polling release in the prior art are solved.

CN119415132APending Publication Date: 2025-02-11AIYUNBAO (SHANGHAI) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411554752.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

In the prior art, multi-instance polling release cannot be smoothly released, resulting in data not being obtained or old data being obtained, which increases the subsequent processing requirements and maintenance costs of development.

Method used

By applying in advance and initializing the backup server, using the publishing system and the service traffic gateway to interact, switching service instance traffic, ensuring real-time data and preventing old data from overwriting new data.

Benefits of technology

The smooth release process of multiple instances is realized, which reduces the proportion of data operation errors, improves release efficiency and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415132A_ABST
    Figure CN119415132A_ABST
Patent Text Reader

Abstract

The invention is applied to the technical field of networks, and particularly discloses a method for smoothly publishing multiple instances with local cache services, and the publishing method comprises the following steps: S1, subscribing a standby server in advance, and initializing an environment required by development for specially publishing standby service instances; and S2, the publishing system interacts with the standby service instance. According to the method for smoothly releasing the multiple instances with the local cache service, task data in an asynchronous thread is forbidden to fall into a database, so that the real-time performance of the data is ensured, when the task of the asynchronous thread falls into the database, if the same data which has directly fallen into the database exists, the processing of the fallen database is neglected, and the old data is prevented from covering new data; if not, the service instance flow is switched to a temporary standby machine, so that the situation that the newest order data cannot be queried by other service instances of the order service or new data is covered by old data when the data is updated due to the fact that the order data is not stored and updated in an asynchronous thread in time is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of network technology, and in particular to a method for solving the problem of smooth publishing of multiple instances of a local cache service. Background Art

[0002] A service instance is a type of cloud server (CVM). It provides secure and reliable elastic computing services and can expand or reduce computing resources in real time according to business needs. It can be understood as the implementation of services in software, that is, the instantiation of services. Currently, there are services such as order services, which have a lot of order data and contain a large number of json fields. In order to improve efficiency, querying orders will directly obtain data from the local cache of the service and return it directly. Saving and updating orders will first save the order data to the local cache, and then add tasks to the asynchronous thread to store the order data in the database, resulting in untimely saving and updating of order data in the asynchronous thread, resulting in other service instances of the order service failing to query the latest order data or updating data with old data overwriting new data.

[0003] The existing technical solution is to convert the local cache into a distributed cache storage, which can improve performance and high availability, and can also solve the inconsistency problem of local caches of multiple service instances. However, this is suitable for storing some data that occupies little memory. For data that occupies a large amount of memory, the required distributed cache memory is high and expensive. In addition, the existing multi-instance polling release cannot be released smoothly, which will result in the failure to obtain data or the acquisition of old data, resulting in the need for subsequent manual data processing for development, and high maintenance costs. Summary of the invention

[0004] The purpose of the present invention is to provide a method for solving the smooth release of multiple instances with local cache services, so as to solve the problem proposed in the above background technology that multi-instance polling release cannot be released smoothly, resulting in the failure to obtain data or obtaining old data, resulting in the need for subsequent manual data processing in development and high maintenance costs.

[0005] To achieve the above object, the present invention provides the following technical solution: a method for smoothly publishing multiple instances of a local cache service, the publishing method comprising the following steps: S1. Purchase a backup server in advance and initialize the environment required for development, which is used to publish a backup service instance; S2. Interaction between the publishing system and the standby service instance: The publishing system starts the standby service instance of the service instance to be published, and actively monitors the health check interface of the standby service instance until the call is successful, then the startup is considered successful; S3. Interaction between the publishing system and the original service instance: Before publishing a service, the publishing system first notifies the service instance to be published to prepare for publishing. After receiving the request, the service instance to be published no longer adds tasks to the asynchronous thread to save data. The publishing system actively polls and interacts with the service instance to obtain whether there are any tasks in the asynchronous thread. If not, proceed to the next step. S4. Interaction between the publishing system and the service traffic gateway: The publishing system calls the service traffic gateway, cuts off the traffic of the service instance, and then switches the traffic to the backup service instance; S5. Interaction between the publishing system and the original service instance: The publishing system stops the original service instance, redeploys and restarts it, and actively monitors the health check interface of the original service instance until the call is successful, then the startup is considered successful; S6. Interaction between the publishing system and the standby service instance: Before publishing the service, the publishing system notifies the standby service instance to prepare for publishing. After receiving the request, the standby service instance no longer adds tasks to the asynchronous thread to save data. The publishing system actively polls and interacts with the standby service instance to obtain whether there are any tasks in the asynchronous thread. S7. Interaction between the publishing system and the service traffic gateway: The publishing system calls the service traffic gateway, cuts off the traffic of the backup service instance, and then switches the traffic to the deployed original service instance; S8. Interaction between the publishing system and the standby service instance: the publishing system stops the standby service instance and restarts the standby service instance as the next service instance to be published; S9. According to the above steps S2-S8, polling starts subsequent service instances; S10. After all service instances are published, check whether all published service instances can provide services normally; Preferably, the publishing method is implemented using the following modules, including a publishing system module, a service instance module to be published, a backup service instance module to be published, and a service traffic gateway module. The publishing system module is connected to the service instance module to be published, the backup service instance module to be published, and the service traffic gateway module, respectively.

[0006] By adopting the above technical solution and utilizing the cooperation between various modules, a smooth publishing process for multiple instances can be achieved.

[0007] Preferably, the publishing system module includes the following components: stopping service instances, deploying service instances, health checks, cutting off service instance traffic, switching back service instance traffic, and notifying prohibition of asynchronous storage. The stopping of service instances is used to stop the original service and the backup service. The deploying of service instances is used to publish the original service and the backup service. The health check is used to detect whether the original service and the backup service are started successfully. The cutting off of service instance traffic is used to cut off the traffic of the original service and the backup service to avoid errors caused by traffic requests coming in after the service is stopped. The switching back of service instance traffic is used to switch back to the original service and the backup service traffic after the service is successfully deployed to restore the service function. The notification prohibits asynchronous storage. When the service is published, the original service and the backup service are notified to prohibit asynchronously saving data to the database; the module for the service instance to be published includes the following components: query, add, update and prohibit asynchronous storage. The query is used to query data from the local cache first, and the local cache does not read data from the database. The add is used to save the new data to the cache first, and then save it to the database asynchronously. The update is used to update the data by first updating the local cache data, and then saving it to the database asynchronously. The prohibition of asynchronous storage is used to provide the publishing system with a call when publishing services. The specific function is to prohibit the use of threads to asynchronously add and update data to the database, and to add and update data to the database in real time. This function is not enabled by default and is only enabled when the service is published; the backup service module is completely consistent with the function of the service instance module to be published. The backup service module maintains the service publishing process, ensuring that the total number of service instances remains unchanged. The same data request is still forwarded to the corresponding serial number service instance for processing, reducing the error ratio of data operations.

[0008] By adopting the above technical solution, the error rate of data operation in the process of instance publishing can be reduced.

[0009] Preferably, the publishing system module stops, deploys and performs health checks on the publishing service instance, the publishing service instance module provides publishing services and controls not to add tasks in asynchronous threads to save data during publishing, the publishing service backup service instance module provides a backup service instance as a temporary backup service instance for the publishing service instance, and the service traffic gateway module registers all service instances for unified management to achieve load balancing, access control, traffic monitoring, and traffic fuse degradation.

[0010] By adopting the above technical solution, the publishing system module is used to operate the publishing service instance, the backup service instance and the service traffic gateway process, thereby realizing the smooth publishing process of multiple instances.

[0011] Preferably, step S1 is a preparation step, and step S1 is a single operation. Step S1 provides a separate server to deploy a backup service instance to ensure the stability of the backup service instance. During the polling and publishing process of steps S2-S8, if an original service instance or a backup instance publishes an error, the publishing system detects that the service publishing has failed and will not continue to publish other service instances; and an error message will be published to the service publisher in the form of WeChat or email, so as to intervene and deal with the problem as soon as possible.

[0012] By adopting the above technical solution, a separate server is used to deploy the backup service instance, thereby ensuring the stability of the backup service instance.

[0013] Compared with the prior art, the beneficial effects of the present invention are as follows: the method for solving the problem of smooth release of multiple instances of local cache service: 1. The present invention prohibits the task data in the asynchronous thread from being stored in the database by actively notifying the update operation instance when the service is to be released, thereby ensuring the real-time nature of the data. When the asynchronous thread task is stored in the database, if there is the same data that has been directly stored in the database, the storage process is ignored to prevent the old data from overwriting the new data. When there is no task to be stored in the asynchronous thread, the service instance traffic is cut to a temporary standby machine to avoid untimely saving and updating of order data in the asynchronous thread, resulting in other service instances of the order service failing to query the latest order data or the old data overwriting the new data when updating the data; 2. In the present invention, when publishing services, the service instance to be published is first notified that new data and modified data do not need to be added to the asynchronous thread and stored in the database, but are directly stored in the database. The cached data is queried through the service instance to be published. This method makes the response speed faster, and the cache is read when querying the service, which improves the query efficiency. At the same time, a backup service instance is added in the present invention as a temporary backup service instance for the publishing service instance, which ensures that the total number of service instances remains unchanged, and the same data request is still forwarded to the corresponding serial number service instance for processing, thereby reducing the error ratio of data operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a schematic diagram of the process structure of the present invention; DETAILED DESCRIPTION

[0015] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0016] See also Figure 1The present invention provides a technical solution: a method for solving the smooth release of multiple instances of local cache services.

[0017] The publishing method is implemented by using the following modules, including a publishing system module, a service instance module to be published, a standby service instance module to be published, and a service traffic gateway module. The publishing system module is connected to the service instance module to be published, the standby service instance module to be published, and the service traffic gateway module respectively. The publishing system module stops, deploys, and performs health checks on the publishing service instance. The service instance module to be published provides publishing services, and does not add tasks to save data in asynchronous threads during publishing. The standby service instance module to be published provides a standby service instance as a temporary standby service instance for the publishing service instance. The service traffic gateway module registers all service instances for unified management to achieve load balancing, access control, traffic monitoring, and traffic fusing and degradation. Step S1 is a preparation step, and step S1 is a single operation. Step S1 provides a separate server to deploy a standby service instance to ensure the stability of the standby service instance. During the polling and publishing process of steps S2-S8, if an original service instance or a standby instance reports an error, the publishing system detects that the service publishing has failed and will not continue to publish other service instances; and an alarm notification will be sent to the service publisher in the form of WeChat or email to publish error information and intervene to handle the problem as soon as possible. In the early development process of the present invention, a server is purchased in advance, and the environment is initialized for deploying a standby service instance, thereby avoiding sharing server resources with other services, improving the performance and stability of the standby service instance, and stopping, deploying, and health checking the publishing service instance for the publishing system module, notifying the service traffic network to stop and switch back the service instance traffic, wherein the service instance refers to the instantiation of the service according to business needs, and the publishing service instance module provides publishing services, and controls the publishing without adding tasks to the asynchronous thread to save data. The asynchronous thread means that in programming, other operations can be continued without waiting for a process to be completed, and tasks are not added to the asynchronous thread to be dropped into the library, so that the query data is still queried through the publishing service instance to query the cache data, so that the query data speed response is faster, and the publishing service standby service instance module provides a standby service instance as a temporary standby service instance for the publishing service instance, which ensures that the total number of service instances remains unchanged, and the same data request is still forwarded to the corresponding serial number service instance for processing, reducing the error ratio of data operations, and the service traffic gateway module uniformly manages all service instance registrations, realizes load balancing, access control, traffic monitoring, and traffic fuse degradation, and supports distribution strategies according to custom rules.

[0018] The publishing method includes the following steps: S1. Purchase a backup server in advance and initialize the environment required for development, which is used to specifically publish a backup service instance; S2. The publishing system interacts with the backup service instance: the publishing system starts the backup service instance of the service instance to be published, and actively monitors the health check interface of the backup service instance until the call is successful, then the startup is considered successful; S3. The publishing system interacts with the original service instance: before publishing the service, the publishing system notifies the service instance to be published of the pre-publishing preparation. After receiving the request, the service instance to be published will no longer add tasks to the asynchronous thread to save data. The publishing system actively polls and interacts with the service instance to obtain whether there are any tasks in the asynchronous thread. If not, proceed to the next step; S4. The publishing system interacts with the service traffic gateway: the publishing system calls the service traffic gateway, cuts off the service instance traffic, and then switches the traffic to the backup service instance; S5. The publishing system interacts with the original service instance: the publishing system stops the original service instance, And redeploy and restart, actively monitor the health check interface of the original service instance until the call is successful, then the startup is considered successful; S6. Interaction between the publishing system and the standby service instance: Before the publishing system publishes the service, it notifies the standby service instance to prepare before publishing. After receiving the request, the standby service instance no longer adds tasks to the asynchronous thread to save data. The publishing system actively polls and interacts with the standby service instance to obtain whether there are any tasks in the asynchronous thread; S7. Interaction between the publishing system and the service traffic gateway: The publishing system calls the service traffic gateway, cuts off the standby service instance traffic, and then switches the traffic to the deployed original service instance; S8. Interaction between the publishing system and the standby service instance: The publishing system stops the standby service instance and restarts the standby service instance as the next service instance to be published; S9. According to the above steps S2-S8, poll and start subsequent service instances; S10. After all service instances are published, check whether the publishing service instances can provide services normally; like Figure 1As shown, in the present invention, for the smooth publishing method of multiple instances of a service with a local cache, the publishing step is started, a backup server is purchased in advance and the environment required for development is initialized, which is used to specifically publish the backup service instance. This step is a preparation step and only needs to be operated once. A separately set server is used to deploy the backup service instance, which can ensure the stability of the backup service instance. The backup service instance is started, and the publishing system is used to start the backup service instance of the service instance to be published, and the health check interface of the backup service instance is actively monitored until the call is successful. It is considered that the startup is successful, and the publishing service instance is notified to stop the asynchronous data saving step. Before publishing the service using the publishing system, the service instance to be published is notified before publishing preparation. After receiving the request, the service instance to be published will no longer add tasks to the asynchronous thread to save data. The publishing system actively polls and interacts with the service instance to obtain whether there are any tasks in the asynchronous thread. If not, the next step is performed, and the publishing service instance traffic step is cut off. The service traffic gateway is called by the publishing system to cut off the service instance traffic, and the traffic is switched to the backup service instance step. Switch to the backup service instance, stop publishing the service instance, redeploy the restart step, the publishing system stops the original service instance and redeploys the restart, actively monitors the health check interface of the original service instance until the call is successful, then it is considered that the startup is successful, the backup service instance stops the asynchronous data saving step, the publishing system notifies the backup service instance of the pre-publishing preparation before publishing the service, after receiving the request, the backup service instance no longer adds tasks to the asynchronous thread to save data, the publishing system actively polls and interacts with the backup service instance to obtain whether there are any tasks in the asynchronous thread, cuts off the backup service instance traffic step, uses the publishing system to call the service traffic network to cut off the backup service instance traffic, switches the traffic to the original service instance step, switches the traffic to the deployed original service instance, stops the backup service instance, redeploys the restart step, the publishing system stops the backup service instance, and restarts the backup service instance as the next service instance to be published, determines whether there are any unpublished service instances, otherwise ends the process, the publishing is completed, if so, returns to notify the publishing service instance to stop the asynchronous data saving step to start polling.

[0019] Working principle: In the present invention, when publishing services, the publishing system module is used to first notify the service instance to be published that new and modified data do not need to be added to the asynchronous thread and the data is directly stored in the database; when querying data, the cached data is queried by the service instance to be published to increase the response speed. When the asynchronous thread task is stored in the database, if the same data has been directly stored in the database, the storage process is ignored to prevent the old data from overwriting the new data. When there is no task to be stored in the asynchronous thread, the service instance traffic is cut to a temporary backup machine, thereby avoiding the problem of data errors caused by inconsistent local cache data of the service due to polling and cutting traffic when multiple instances of the service with local cache data are polled and published.

[0020] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for smoothly publishing multiple instances of a local cache service, characterized by: The publishing method comprises the following steps: S1. Purchase a backup server in advance and initialize the environment required for development, which is used to publish a backup service instance; S2. Interaction between the publishing system and the standby service instance: The publishing system starts the standby service instance of the service instance to be published, and actively monitors the health check interface of the standby service instance until the call is successful, then the startup is considered successful; S3. Interaction between the publishing system and the original service instance: Before publishing a service, the publishing system first notifies the service instance to be published to prepare for publishing. After receiving the request, the service instance to be published no longer adds tasks to the asynchronous thread to save data. The publishing system actively polls and interacts with the service instance to obtain whether there are any tasks in the asynchronous thread. If not, proceed to the next step. S4. Interaction between the publishing system and the service traffic gateway: The publishing system calls the service traffic gateway, cuts off the traffic of the service instance, and then switches the traffic to the backup service instance; S5. Interaction between the publishing system and the original service instance: The publishing system stops the original service instance, redeploys and restarts it, and actively monitors the health check interface of the original service instance until the call is successful, then the startup is considered successful; S6. Interaction between the publishing system and the standby service instance: Before publishing the service, the publishing system notifies the standby service instance to prepare for publishing. After receiving the request, the standby service instance no longer adds tasks to the asynchronous thread to save data. The publishing system actively polls and interacts with the standby service instance to obtain whether there are any tasks in the asynchronous thread. S7. Interaction between the publishing system and the service traffic gateway: The publishing system calls the service traffic gateway, cuts off the traffic of the backup service instance, and then switches the traffic to the deployed original service instance; S8. Interaction between the publishing system and the standby service instance: the publishing system stops the standby service instance and restarts the standby service instance as the next service instance to be published; S9. According to the above steps S2-S8, polling starts subsequent service instances; S10. After all service instances are published, check whether all published service instances can provide services normally.

2. A method for solving the problem of smooth publishing of multiple instances of a local cache service according to claim 1, characterized in that: The publishing method is implemented using the following modules, including a publishing system module, a service instance module to be published, a backup service instance module to be published, and a service traffic gateway module. The publishing system module is connected to the service instance module to be published, the backup service instance module to be published, and the service traffic gateway module respectively.

3. A method for solving the problem of smooth publishing of multiple instances of a local cache service according to claim 2, characterized in that: The publishing system module includes the following components: stopping service instances, deploying service instances, health checks, cutting off service instance traffic, switching back service instance traffic, and notifying prohibition of asynchronous storage. The stopping of service instances is used to stop the original service and the backup service. The deploying of service instances is used to publish the original service and the backup service. The health check is used to detect whether the original service and the backup service are successfully started. The cutting off of service instance traffic is used to cut off the traffic of the original service and the backup service to avoid errors caused by traffic requests coming in after the service is stopped. The switching back of service instance traffic is used to switch back to the original service and the backup service traffic after the service is successfully deployed to restore the service function. The notified prohibition of asynchronous storage is used for service publishing to notify the original service and the backup service to prohibit asynchronously saving data to the database. The module for publishing service instances includes the following components: query, add, update, and prohibit asynchronous storage. The query is used to query data from the local cache first, and the local cache does not read data from the database. The add is used to save the newly added data to the cache first, and then save it to the database asynchronously. The update is used to update the data by first updating the local cache data, and then saving it to the database asynchronously. The prohibit asynchronous storage is used to provide the publishing system with a call when publishing services. The specific function is to prohibit the use of threads to asynchronously add and update data to the database, and to add and update data to the database in real time. This function is not enabled by default and is only enabled when the service is published; The backup service module has the same functions as the service instance module to be published. The backup service module maintains the service publishing process, ensuring that the total number of service instances remains unchanged. The same data request is still forwarded to the corresponding serial number service instance for processing, reducing the error rate of data operations.

4. A method for solving the problem of smooth publishing of multiple instances of a local cache service according to claim 2, characterized in that: The publishing system module stops, deploys and performs health checks on publishing service instances. The publishing service instance module provides publishing services and controls not to add tasks in asynchronous threads to save data during publishing. The publishing service backup service instance module provides a backup service instance as a temporary backup service instance for the publishing service instance. The service traffic gateway module registers all service instances for unified management to achieve load balancing, access control, traffic monitoring, and traffic fuse degradation.

5. A method for solving the problem of smooth publishing of multiple instances of a local cache service according to claim 1, characterized in that: The step S1 is a preparation step, and the step S1 is a single operation. The step S1 provides a separate server to deploy a backup service instance to ensure the stability of the backup service instance. During the polling and publishing process of the steps S2-S8, if an original service instance or a backup instance reports an error, the publishing system detects that the service publishing has failed and will not continue to publish other service instances. In addition, the service publisher will be notified of the error information in the form of WeChat or email, and the problem will be resolved as soon as possible.