Long connection-based quantity amplification back-switching method
Through the long connection-based increase-volume cutback method, the stability and recognition problems when new functions are released in traditional function iterations are solved, and the gradual promotion of functions and fault cutbacks are achieved, which improves product stability and user experience.
Patent Information
- Application Number
- CN202411251408.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-07
- Publication Date
- 2024-12-13
AI Technical Summary
Traditional function iterations can easily lead to functional stability and user recognition problems when new functions are released, and full release at one time leads to a large range of faults and high cost of repair and fallback.
Adopt the increase-volume cutback method based on long connections, by defining the GrayReleaseService class, designing a singleton mode, packaging it into an npm package, introducing SDK, registering long-volume message monitoring, realizing the gradual promotion and failure cutback of the increase-volume function, and supporting dynamic adjustment of the increase-volume and Cut back proportion.
It realizes the incremental volume increase and rapid cutback of functions, improves product stability and user experience, supports flexible control from large to small details, and reduces the problems of user refresh and logic ineffectiveness.
Smart Images

Figure CN119127292A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method for switching back based on a long connection. Background Art
[0002] When releasing new functions, we often face problems such as function stability, compatibility, and user acceptance of new functions. Traditional function iteration usually adopts a one-time full release. Once a production failure occurs, it will cause a wide range of impacts and high repair and rollback costs. Therefore, a large-scale cutback method based on long connections is proposed. Summary of the invention
[0003] In view of this, an embodiment of the present invention hopes to provide a method for switching back based on a large volume of long connections to solve or alleviate the technical problems existing in the prior art and at least provide a beneficial option.
[0004] The technical solution of the embodiment of the present invention is implemented as follows: a method for switching back based on a large volume of long connections, comprising the following steps:
[0005] S1. Define GrayReleaseService class, and set the design mode to singleton mode;
[0006] S2. Package the entire GrayReleaseService into an npm package and store it on the White Dragon Horse private server;
[0007] S3. Introduce GrayReleaseService SDK in the project entry file, and use GrayReleaseService.getInstance() to get the instance, initialize it once, call it multiple times, and the input parameter is the callback of the long connection message monitoring;
[0008] S4. Call the init method to register a long connection message listener to receive reminders of volume change messages.
[0009] In some embodiments, the specific steps in S1 are as follows:
[0010] S11, input parameters are used for volume data callback;
[0011] S12, static method getInstance is used to obtain a singleton instance;
[0012] S13, initialize init, getConfig to obtain the cloud control volume configuration, and updateConfig to update the cloud control volume configuration.
[0013] In some embodiments, in the S4, on the function A page that needs to be released, the release status is obtained by passing the release identifier through the GrayReleaseService instance. When multiple release identifiers exist at the same time, the same release identifier is cached to reduce the number of release interface requests.
[0014] In some embodiments, in S4, the message change is a product notification that the function A of the tenant CP1 needs to be scaled up, and the R&D updates the scale-up identifier cloud control configuration corresponding to the function A through the interface to trigger the message change.
[0015] In some embodiments, in S4, the front end receives a message change, hits tenant CP1, determines whether the release flag corresponding to function A is turned on, decides whether to display function A, completes real-time release, and supports full and single tenant release.
[0016] In some embodiments, in the S1, for the implementation of the GrayReleaseService class, it includes the basic functions of gray release (Gray Release), and its main responsibility is to manage the gray release process, including setting candidate versions, setting the user ratio of gray release, actually executing gray release, monitoring, and rolling back when necessary.
[0017] The embodiment of the present invention has the following advantages due to the adoption of the above technical solution:
[0018] 1. The present invention, through the method of the present application, adds progressive volume expansion and quick switching back compared to the traditional new function launch. Accessing a long connection solves the pain point of the traditional volume expansion function that users do not refresh and the volume expansion logic does not take effect. The volume expansion function takes effect in near real time, and the volume expansion dimension can be customized at will. It supports control as large as a functional module or as small as a button level, with flexible control and support for dynamic adjustment of the volume expansion and switching back ratio.
[0019] 2. The present invention realizes the gradual promotion of functions and fault switching back through the method of the present application, and smoothly transitions from a small amount to a full amount, thereby improving product stability and user experience.
[0020] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present invention will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0022] Figure 1 It is a schematic diagram of the volume expansion process of the present invention;
[0023] Figure 2 The figure is a schematic diagram of the switching back process of the present invention. DETAILED DESCRIPTION
[0024] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present invention. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.
[0025] It should be noted that the terms "first", "second", "symmetrical", "array", etc. are only used to distinguish between description and position description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the definition of "first", "symmetrical", etc. can explicitly or implicitly include one or more of these features; similarly, when the quantity of certain features is not limited in the form of words such as "two" or "three", it should be noted that this feature also explicitly or implicitly includes one or more feature quantities;
[0026] In the present invention, unless otherwise clearly specified and limited, the terms such as "installation", "connection", "fixation" and the like should be understood in a broad sense; for example, it can be a fixed connection, a detachable connection, or an integral molding; it can be a mechanical connection, a direct connection, welding, or an indirect connection through an intermediate medium, or it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood based on the description and drawings combined with specific circumstances.
[0027] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0028] like Figure 1-Figure 2 As shown, an embodiment of the present invention provides a method for switching back based on a long connection, comprising the following steps:
[0029] S1. Define GrayReleaseService class, and set the design mode to singleton mode;
[0030] S2. Package the entire GrayReleaseService into an npm package and store it on the White Dragon Horse private server;
[0031] S3. Introduce GrayReleaseService SDK in the project entry file, and use GrayReleaseService.getInstance() to get the instance, initialize it once, call it multiple times, and the input parameter is the callback of the long connection message monitoring;
[0032] S4. Call the init method to register a long connection message listener to receive reminders of volume change messages.
[0033] In this embodiment, specifically, the specific steps in S1 are as follows:
[0034] S11, input parameters are used for volume data callback;
[0035] S12, static method getInstance is used to obtain a singleton instance;
[0036] S13, initialize init, getConfig to obtain the cloud control volume configuration, and updateConfig to update the cloud control volume configuration.
[0037] In this embodiment, specifically, in S4, on the function A page that needs to be released, the GrayReleaseService instance is used to pass the release identifier to obtain the release status. When multiple release identifiers exist at the same time, the same release identifier is cached to reduce the number of release interface requests.
[0038] In this embodiment, specifically, in S4, the message change is a product notification that the function A of the tenant CP1 needs to be scaled up, and the R&D updates the scale-up identifier cloud control configuration corresponding to the function A through the interface to trigger the message change.
[0039] In this embodiment, specifically, in S4, the front end receives a message change, hits tenant CP1, determines whether the release flag corresponding to function A is turned on, and decides whether to display function A, completes real-time release, and supports full and single tenant release.
[0040] In this embodiment, specifically, the scale-out means selecting some users to provide a trial of new functions. For some functions whose user needs and feedback are not well understood, when the new version may cause uncertain feedback effects, the scale-out can be used to allow some users to use the new version functions to test user acceptance, new function stability, and usage data changes. Feedback can be obtained through research methods such as tracking data comparison or user interviews to evaluate whether a comprehensive upgrade has been made.
[0041] In this embodiment, specifically, the literal meaning of "returning" is to switch back. It is the opposite of "re-release". When the user feedback of the new function trial does not meet the obvious expectations or the poor stability of the new function leads to production failure, the process of switching back from the new function to the original function is
[0042] In this embodiment, specifically, the cloud control is a database for storing large-scale configuration data.
[0043] In this embodiment, specifically, in S1, for the implementation of the GrayReleaseService class, it includes the basic functions of gray release (Gray Release), and its main responsibility is to manage the gray release process, including setting candidate versions, setting the user ratio of gray release, actually executing gray release, monitoring, and rolling back when necessary.
[0044] In this embodiment, specifically, in programming, especially when dealing with network communication and messaging, registering a long connection message listener usually means that you will set a callback function or listener so that when the server sends messages, your application can receive and process these messages. In Python, this may involve using asynchronous programming or specific network libraries such as socket, asyncio, websockets, etc.
[0045] The following is a simplified example showing how to create a persistent connection using the websockets library in Python and register a message listener to receive messages. Please note that this is just an example and the actual implementation will depend on the specific library and framework you are using.
[0046] First, you need to install the websockets library, but as per your requirement, I will not show the installation process here.
[0047] Here is the code example:
[0048]
[0049]
[0050] In this example, the MessageListener class is responsible for establishing a connection with the WebSocket server and registering a message listener. When a message is received from the server, the on_message method will be called, and you can add the logic to process the message in this method.
[0051] The main function initializes the MessageListener object, connects to the server, and keeps the program running until you interrupt it manually (for example, by pressing Ctrl+C).
[0052] Note that you need to replace 'ws: / / example.com / websocket' with the URI of your actual WebSocket server. Also, this example assumes that the server is using the WebSocket protocol.
[0053] In this embodiment, specifically, GrayReleaseService generally refers to a service that is responsible for managing and executing the gray release (Gray Release or Gradual Rollout) strategy. Gray release is a software release strategy that allows you to gradually push a new version of an application to users instead of pushing it to all users at once. This approach can reduce risk because it allows you to test and verify a new version before fully rolling it out.
[0054] The following is the basic structure of a simplified GrayReleaseService class, which may contain the following functions:
[0055] Managing deployments of different versions
[0056] Gradually roll out new versions based on a certain percentage or specific user group
[0057] Monitor the performance and stability of new releases
[0058] Roll back to an older version in case of problems
[0059] Here is a simple example of a GrayReleaseService class written in Python:
[0060]
[0061]
[0062]
[0063] GrayReleaseService includes but is not limited to integration with deployment systems, monitoring systems, and user management systems.
[0064] In this embodiment, specifically, in Java, the getInstance() method is often used to implement the singleton pattern, ensuring that a class has only one instance and providing a global access point. In Python, although not common, we can use a similar pattern to implement a singleton class. Here is how to modify the GrayReleaseService class to support getting instances through the getInstance() method:
[0065]
[0066]
[0067]
[0068]
[0069] In this implementation, the new method is overridden to ensure that every time you try to create a new instance of GrayReleaseService, the same instance is actually returned. This way, no matter where in your code you call getInstance(), you will get the same GrayReleaseService instance.
[0070] In this embodiment, specifically, in the GrayReleaseService class, we can add getConfig and updateConfig methods to obtain and update the cloud control release configuration. The following is a simple implementation of these two methods. For the sake of example, I will use a dictionary to simulate the storage of cloud control configuration, but in actual applications, these configurations may be stored in a database, configuration file, or remote configuration service.
[0071]
[0072]
[0073]
[0074] In this example, the getConfig method returns the current cloud control configuration, while the updateConfig method accepts a new configuration dictionary and updates the existing configuration. When updating the configuration, check whether release_percentage is between 0 and 100, and ensure the validity of user_groups.
[0075] In this embodiment, specifically, when processing product notifications, especially those involving the release of specific tenants and functional modules (i.e., gradually increasing the availability of functions), the GrayReleaseService class can be extended to include logic for processing such notifications. The following is how to implement the method for handling message changes and performing release operations in the GrayReleaseService class:
[0076]
[0077]
[0078]
[0079]
[0080] In this example, the notifyFeatureRelease method is used to handle product notifications, which accepts the tenant ID and feature ID, and then updates the configuration to reflect the new rollout ratio. The gradual_rollout_for_tenant_feature method is used to perform the actual rollout operation.
[0081] In this embodiment, specifically, in software development, SDK (Software Development Kit) is a set of tools, libraries, documents and sample codes provided for a specific software or hardware platform so that developers can develop applications more easily. GrayReleaseService SDK refers to a set of tools and interfaces that provide developers with grayscale release functions.
[0082] Below I will provide a simple conceptual implementation of the GrayReleaseService SDK, which will contain basic functions for initialization, obtaining configuration, updating configuration, and performing grayscale release operations.
[0083]
[0084]
[0085]
[0086] This SDK example uses asynchronous programming, which is a common way to handle I / O operations (such as network requests) in modern Python. In actual use, you need to replace the pseudo code parts (such as http_get and http_post) with actual network request codes to interact with the backend service.
[0087] In this embodiment, specifically, calling the init method generally refers to the initialization method that is automatically called when an instance of a class is created in object-oriented programming. In different programming languages, this method may have different names and syntax, but the concepts are similar. The following is a general text description that describes the process of calling the init method:
[0088] Defining a class: First, you need to define a class, which is a blueprint for creating objects with specific properties and methods.
[0089] Writing an init method: In a class definition, you write a special method (__init__ in Python) that is automatically called when an instance of the class is created. In this method, you can set the initial state of the object, such as assigning attribute values.
[0090] Create an instance: When you use the class name and pass the corresponding parameters to create an instance of a class, the programming language automatically calls the init method. This instance is a specific object of the class.
[0091] Initialize the object: The init method is executed, which uses the arguments passed to the constructor to initialize the object's internal state. This may include performing calculations, allocating memory, setting default values, etc.
[0092] Object ready: Once the init method is executed, the object is fully initialized and ready for use. At this point, the object's properties and methods can be accessed and manipulated according to the class definition.
[0093] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of various changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for switching back based on long connections, characterized in that: The following steps are involved: S1. Define GrayReleaseService class, and set the design mode to singleton mode; S2. Package the entire GrayReleaseService into an npm package and store it on the White Dragon Horse private server; S3. Introduce GrayReleaseService SDK in the project entry file, and use GrayReleaseService.getInstance() to get the instance, initialize it once, call it multiple times, and the input parameter is the callback of the long connection message monitoring; S4. Call the init method to register a long connection message listener to receive reminders of volume change messages.
2. The method for switching back based on long connection according to claim 1 is characterized in that: The specific steps in S1 are as follows: S11, input parameters are used for volume data callback; S12, static method getInstance is used to obtain a singleton instance; S13, initialize init, getConfig to obtain the cloud control volume configuration, and updateConfig to update the cloud control volume configuration.
3. The method for switching back based on long connection according to claim 1 is characterized in that: In S4, on the function A page that needs to be released, the GrayReleaseService instance is used to pass the release identifier to obtain the release status. When multiple release identifiers exist at the same time, the same release identifier is cached to reduce the number of release interface requests.
4. The method for switching back based on long connection according to claim 1 is characterized in that: In S4, the message change is a product notification that the function A of the tenant CP1 needs to be scaled up. The R&D department updates the scale-up identifier cloud control configuration corresponding to the function A through the interface, thereby triggering the message change.
5. The method for switching back based on long connection according to claim 1 is characterized in that: In S4, the front end receives the message change, hits the tenant CP1, determines whether the release flag corresponding to function A is turned on, and decides whether to display function A, completes real-time release, and supports full and single tenant release.
6. The method for switching back based on long connection according to claim 1 is characterized in that: In the S1, for the implementation of the GrayReleaseService class, it includes the basic functions of gray release (Gray Release), and its main responsibility is to manage the gray release process, including setting candidate versions, setting the user ratio of gray release, actually executing gray release, monitoring, and rolling back when necessary.
