Method and device for upgrading SDK (Software Development Kit) during running

By launching dynamic upgrade strategies in the cloud service and using class loaders to isolate the upgraded version of SDK components, the upgrade problem caused by fragmented distribution of SDK versions in the cloud service is solved, and dynamic upgrade of SDK and continuous operation of applications are achieved.

CN120215993APending Publication Date: 2025-06-27ALIBABA (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510228202.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

In cloud services, different servers on the data plane may have inconsistent SDK versions, resulting in fragmented distribution of SDK versions, which makes it difficult to upgrade the SDK version, especially without affecting the operation of the original version of SDK components.

Method used

By launching a dynamic upgrade policy under the control surface, specifying the upgrade scope, and using the class loader to load the upgraded version of SDK components in a memory isolation from the original version of SDK, generating and initializing the upgraded version SDK component instance, and finally routing the request to the upgraded version SDK component instance.

Benefits of technology

It realizes dynamic upgrade of the SDK, without stopping the original version of the SDK, and does not need to restart or re-release the network application after the upgrade is completed, solving the upgrade problem caused by fragmented distribution of the SDK version.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120215993A_ABST
    Figure CN120215993A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a method and a device for upgrading an SDK (Software Development Kit) during running. According to the embodiment of the invention, the dynamic upgrading strategy is uniformly issued to the server, the upgrading range is specified in the dynamic upgrading strategy, meanwhile, the SDK component of the upgraded version is independently loaded in a mode of isolating from the SDK memory of the original version through the class loader, and the SDK component instance of the upgraded version is generated; according to the method and the device, the SDK component instance of the upgrade version is initialized, and the request for the SDK component instance is routed to the SDK component instance of the upgrade version after the initialization of the SDK component instance of the upgrade version is completed, so that the running of the SDK of the original version does not need to be stopped in the upgrade process, and the dynamic upgrade of the SDK can be realized without restarting or reissuing a network application program of the SDK after the upgrade is completed. The upgrade problem caused by fragmented distribution of the version of the SDK component on the server in the cloud service is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cloud services, and in particular, to a method and device for upgrading an SDK during runtime. Background Art

[0002] An SDK (Software Development Kit) refers to a collection of software development tools designed to help developers create, test, and deploy software applications more quickly and conveniently. The SDK components provide pre-written code libraries and tools, and developers do not need to write complex functions from scratch but only need to call the APIs in the SDK.

[0003] For large-scale network applications that rely on multiple different servers on the data plane to run, it is necessary to call the SDK on the network or the local SDK through the network. Different servers on the data plane may have problems of inconsistent SDK versions and fragmented distribution of SDK versions for various reasons. At the same time, since the existing SDK components are continuously being used, how to upgrade the SDK version without affecting the support of the original version of the SDK components for the operation of network applications is a problem that needs to be solved. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a method and device for upgrading an SDK during runtime, expecting to complete the dynamic upgrade of the SDK while keeping the original version of the SDK running and without the need for the network application using the SDK to be restarted and republished.

[0005] In a first aspect, an embodiment of the present invention provides a method for upgrading an SDK during runtime, where the method includes:

[0006] Receiving a dynamic upgrade policy sent by a control plane;

[0007] In response to the upgrade scope of the dynamic upgrade policy including the local machine, loading the SDK components of the upgrade version into a class loader, and the class loader generating an SDK component instance based on a storage space independent of the original version of the SDK components;

[0008] Initializing the SDK component instance according to the dynamic upgrade policy, and at the same time, routing requests for the SDK component instance to the original version of the SDK component instance;

[0009] In response to the SDK component instance being in a ready state, routing requests for the SDK component instance to the upgrade version of the SDK component instance.

[0010] In a second aspect, an embodiment of the present invention provides a device for upgrading an SDK during runtime, where the device includes:

[0011] A receiving unit, configured to receive a dynamic upgrade policy sent by a control plane;

[0012] A loading unit, configured to, in response to the upgrade scope of the dynamic upgrade policy including the local device, load an SDK component of an upgraded version into a class loader, where the class loader generates an SDK component instance based on a storage space independent of that of an SDK component instance of an original version;

[0013] An initialization unit, configured to initialize the SDK component instance according to the dynamic upgrade policy, and at the same time, route requests for the SDK component instance to an SDK component instance of the original version;

[0014] A switching unit, configured to, in response to the SDK component instance being in a ready state, route requests for the SDK component instance to an SDK component instance of the upgraded version.

[0015] In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes a memory and a processor, the memory is configured to store one or more computer program instructions, and the one or more computer program instructions are executed by the processor to implement the method as described in the first aspect.

[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where computer programs or data are stored in the computer-readable storage medium, and when the computer programs are executed by a processor, the method as described in the first aspect is implemented.

[0017] In the embodiment of the present invention, by uniformly sending a dynamic upgrade policy to a server, specifying an upgrade scope in the dynamic upgrade policy, and at the same time, in a manner of isolating the memory of the upgraded version of the SDK from that of the original version through a class loader, independently loading the SDK component of the upgraded version and generating an instance of the SDK component of the upgraded version, and routing requests for the SDK component instance to the SDK component instance of the upgraded version after the initialization of the instance of the SDK component of the upgraded version is completed. Thus, during the upgrade process, it is not necessary to stop the operation of the SDK of the original version, and after the upgrade is completed, it is not necessary to restart or republish a network application using the SDK to implement the dynamic upgrade of the SDK. This solves the upgrade problem caused by the fragmented distribution of the SDK component versions on the server in cloud services. Description of the Drawings

[0018] Through the following description of the embodiments of the present invention with reference to the drawings, the above and other objects, features, and advantages of the present invention will become clearer. In the drawings:

[0019] Figure 1 is a flowchart of a method for upgrading an SDK during runtime according to an embodiment of the present invention;

[0020] Figure 2 is a block diagram of the cloud service system according to an embodiment of the present invention;

[0021] Figure 3 is a state diagram of the state machine for initializing the state of the SDK component instance according to an embodiment of the present invention;

[0022] Figure 4 is a schematic diagram of the SDK upgrade software architecture according to an embodiment of the present invention;

[0023] Figure 5 is a block diagram of the device for upgrading the SDK during runtime according to an embodiment of the present invention;

[0024] Figure 6 is a schematic diagram of the electronic device according to an embodiment of the present invention. Detailed implementation manners

[0025] The following describes the present application based on embodiments, but the present application is not limited to these embodiments. In the following detailed description of the present application, some specific details are described in detail. Those skilled in the art can fully understand the present application without the description of these details. In order to avoid obscuring the essence of the present application, well-known methods, processes, flows, elements, and circuits are not described in detail.

[0026] In addition, those of ordinary skill in the art should understand that the drawings provided herein are for illustrative purposes only, and the drawings are not necessarily drawn to scale.

[0027] Unless the context clearly requires otherwise, the words such as "including" and "comprising" in the entire application document should be interpreted in an inclusive sense rather than an exclusive or exhaustive sense; that is, it is the meaning of "including but not limited to".

[0028] In the description of the present application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more.

[0029] For the solutions described in this specification and embodiments, if they involve personal information processing, they will be processed on the premise of having a legal basis (such as obtaining the consent of the personal information subject, or being necessary for performing a contract, etc.), and will only be processed within the specified or agreed scope. If a user refuses to process personal information other than the necessary information required for basic functions, it will not affect the user's use of basic functions.

[0030] Figure 1 Flowchart of the method for upgrading the SDK during runtime according to an embodiment of the present invention. As Figure 1 shown, the method for upgrading the SDK during runtime in this embodiment includes the following steps:

[0031] In step S100, a dynamic upgrade policy sent by the control plane is received.

[0032] In this embodiment, the data plane can periodically poll the policies sent by the control plane or receive various policies pushed by the control plane.

[0033] The control plane is the management and decision-making core in the cloud service, mainly responsible for resource allocation, scheduling, policy configuration, and monitoring of the cluster status.

[0034] Opposite to the control plane is the data plane, which is the part in the cloud service that directly bears customer business data and application programs and is responsible for executing specific tasks and data processing. The data plane includes multiple servers running the cloud architecture, and SDK components for business application programs to call are set on these servers. Due to different installation times of different servers or other reasons during operation, for some important and widely used SDK components, the SDK component versions on different servers are fragmented. That is, the versions of the SDK components running on different servers are different.

[0035] Figure 2 The block diagram of the cloud service system according to the embodiment of the present invention is shown. As Figure 2 shown, the control plane 21 may include one or more different servers 21a, 21b, etc., which are communicatively connected to each other through a local area network or a wide area network and can be accessed and controlled by the client 23 through the network. The data plane 22 also includes multiple different servers 22a, 22b, 22c, etc. Taking the server 22a as an example, the server 22a includes general or dedicated computing hardware for running an operating system and underlying application programs. Based on the hardware architecture, a data plane underlying application program 221 supporting the cloud service is set. The data plane underlying application program 221 is used to provide underlying support for running user application programs in the cloud service. Above the data plane underlying application program 221 layer, SDK components 222 for business application programs to call can be set. The SDK component instances can return corresponding response results in response to requests from the business application program 223 in the running state. The business application program 223 can run on the server 22a or be set on other servers. The versions of the SDK components on the servers 22a, 22b, 22c may be different. The control plane 21 can upgrade the versions of the SDK components on different servers 22a, 22b, 22c by sending a dynamic upgrade policy to the data plane through the network. It should be understood that the above servers can be physical servers or virtual servers based on virtual machine technology.

[0036] In the prior art, although the control plane can understand whether the SDK version in different servers is a lower version, there is a lack of means to comprehensively perform runtime upgrades on SDK components without interrupting the support for application programs. If the service of the SDK components is suspended for upgrading, the resource provisioning ability of the cloud server will be affected.

[0037] In this embodiment, the system administrator can formulate and generate a dynamic upgrade policy in the control plane according to the actual situation. Among them, the dynamic upgrade policy gradually upgrades the versions of the SDK components of different servers in the server cluster in the form of gray-scale upgrade. In the dynamic upgrade policy, the identifier of the server to be upgraded can be specified, so that the server receiving the dynamic upgrade policy can determine whether the upgrade policy includes the local machine. If it does, the process of SDK runtime upgrade is started. If it does not, even if the version of its SDK components is lower, it remains unchanged.

[0038] Specifically, in the dynamic upgrade policy, a specific server can be specified within the upgrade scope by the IP address of the server, or a group of specific servers can be specified within the upgrade scope by the last digits of the IP address. It should be understood that other server identifiers can also be used to specify the server or virtual server to be upgraded, such as the MAC address, etc.

[0039] Specifically, the dynamic upgrade policy can be sent to the data plane in the form of, for example, an XML or JSON file.

[0040] Step S200: In response to the upgrade scope of the dynamic upgrade policy including the local machine, load the SDK components of the upgrade version into the class loader, and the class loader generates an SDK component instance based on an independent storage space;

[0041] If the server on the data plane determines that the upgrade scope includes the local machine when receiving the dynamic upgrade policy, for example, the local IP address is included in the IP address list corresponding to the upgrade scope, then the dynamic upgrade process is triggered on the local machine.

[0042] In the dynamic upgrade process, an instance of a loader class is independently generated for the SDK components of the upgraded version, that is, a Class Loader. The role of the class loader is to dynamically load the code and required resources of the SDK components of the upgraded version. The class loader can be an independent module or component, responsible for reading code or data from the file system, network, database, or other sources, and loading it into memory for use by the business application. At the same time, in order to ensure that the operation of the SDK component instances of the original version remains unaffected. The class loader in this embodiment generates SDK component instances based on an independent storage space. That is, the memory range used for its loading is isolated from the memory ranges used by other class loaders. Thus, during the loading process and subsequent usage, the operation or parallel upgrade of SDK components of other versions will not be modified or affected. The class loader isolates the code or resources loaded by different loaders through namespaces, contexts, or other mechanisms. A typical process for the class loader to load SDK components includes finding the code or resources to be loaded according to the specified path or rules, reading the code or resources into memory for compilation or interpretation. For code modules, it may be necessary to resolve dependencies and initialize. For resources, it may be necessary to resolve the format and load it into memory.

[0043] In an alternative implementation, the class loader inherits from the URLClassLoader class to achieve having the original class loader while being able to load all the code and resources for the SDK components and implement memory isolation. URLClassLoader is a class in Java, belonging to the java.net package, and is used to dynamically load Java class files. It is an implementation of the Java class loader (ClassLoader), allowing the program to load class files (.class files) or JAR files from a specified URL address at runtime. This enables Java programs to dynamically load and run classes without including these classes in the project's classpath at compile time.

[0044] At the same time, in this embodiment, if the server receives dynamic upgrade policies indicating the simultaneous upgrade of multiple versions of SDK components, a class loader is independently generated for each version of the SDK components, thereby achieving memory isolation between different versions.

[0045] At the same time, while steps S100 and S200 are being carried out, the SDK component instances of the original version do not stop working. The corresponding SDK component instances of the original version continue to run and receive requests from the business application, returning corresponding responses. The server will route the requests from the business application to the SDK component instances of the original version.

[0046] Step S300: Initialize the SDK component instance according to the dynamic upgrade policy. Meanwhile, route requests for the SDK component instance to the original version of the SDK component instance.

[0047] After the SDK component is loaded into memory, that is, after the SDK component instance is generated, the SDK component instance can be initialized. The initialization process of the SDK component instance is a key step in integrating the functions provided by the SDK into the application. Since many SDK components are stateful SDK components, that is, the SDK component will save certain context information or state data according to the settings of the configuration file. During the upgrade, the control plane will use the state information (or configuration information) of these SDK component instances that need to be loaded into the upgraded version of the SDK component instance, such as the settings and switches of certain options, as part of the dynamic upgrade policy content. The server can trigger the initialization of the SDK component asynchronously according to the dynamic upgrade policy. The asynchronous method is used because the original version of the SDK component is still in use, and the occupation of system resources may be uncertain. The asynchronous method can select a time when the system resources are relatively sufficient to initialize the SDK component to ensure that the performance of the running application is not affected.

[0048] Meanwhile, although the upgraded version of the SDK component instance has been generated, before the initialization is completed, requests for the SDK component instance are still routed to the original version of the SDK component instance.

[0049] In this embodiment, step S300 may specifically include the following steps:

[0050] Step S310: Obtain the SDK configuration status corresponding to the dynamic upgrade policy.

[0051] In this step, extract the SDK configuration status of the stateful SDK component from the dynamic upgrade policy. That is, at least one of the context information, state data, or configuration data that needs to be loaded into the SDK component instance during initialization.

[0052] Step S320: Trigger the initialization of the SDK component instance based on the SDK configuration status.

[0053] In one implementation, a state machine can be used to monitor the initialization process and status of the SDK component instance.

[0054] Step S330: Generate a corresponding initialization state machine to monitor the initialization process.

[0055] Figure 3 It is the state diagram of the state machine for initializing the SDK component instance in the embodiment of the present invention. As Figure 3As shown, the state machine includes multiple different states. After initialization is triggered, the SDK component instance is in the unready state for initialization 31. Subsequently, according to the SDK configuration status, parameters, status, etc. of the SDK component are configured. If problems are encountered during the configuration process, it jumps to the configuration failure state 32. If the configuration is completed, it jumps to the configuration success state 33, and then post-configuration processing is performed, such as clearing the memory allocated during parameter configuration, etc. After the processing is completed, it jumps to the ready state for initialization 34. In subsequent steps, the state machine represents that the SDK component instance is in the ready state, indicating that the initialization is successfully completed.

[0056] In step S340, in response to the state machine representing that the SDK component instance is in the ready state, it is determined that the initialization is completed.

[0057] In step S350, in response to the state machine representing that the SDK component instance is in the configuration failure state, initialization is re-triggered.

[0058] If the configuration fails, it can jump back to the unready state for initialization to start attempting initialization again after a predetermined condition is triggered. Among them, the predetermined condition can be, for example, waiting for a predetermined time.

[0059] Step S400, in response to the SDK component instance being in the ready state, route the request for the SDK component instance to the upgraded version of the SDK component instance.

[0060] After the initialization of the upgraded version of the SDK component instance is completed, an operation of dynamically switching traffic is performed. That is, the request for the SDK component instance is switched from being originally sent to the original version of the SDK component instance to being sent to the upgraded SDK component instance, and the upgraded SDK component instance sends a response to the source of the request.

[0061] Specifically, the process of switching the request route can be further optimized through container technology. A container is a lightweight and portable software running environment that encapsulates an application and its runtime environment (including code, configuration files, dependent libraries, etc.) together, enabling it to run consistently in different operating systems and hardware environments. The core of container technology is to utilize the virtualization function of the operating system, rather than relying on hardware virtualization like a virtual machine (VM). Through container technology, the generation and cleaning of SDK component instances can be flexibly performed. In the corresponding implementation, step S400 may include the following steps:

[0062] Step S410, the policy execution node receives the request for the SDK component instance and sends the request to the policy execution node dynamic proxy;

[0063] Step S420, the dynamic proxy of the policy execution node forwards the request to the SDK component instance of the upgraded version in response to the SDK component instance of the upgraded version being in a ready state; and,

[0064] Step S430, the SDK component instance of the upgraded version sends a response to the request to the policy execution node.

[0065] It should be understood that before the initialization of the SDK component instance of the upgraded version is completed, the dynamic proxy of the policy execution node routes the requests of the business application to the SDK component instance of the original version.

[0066] Figure 4 It is a schematic diagram of the SDK upgrade software architecture in an implementation manner of an embodiment of the present invention. As Figure 4 shown, in the corresponding implementation manner, the class loader 41 is deployed to include a policy decision point. The SDK upgrade software architecture also includes a policy enforcement point 42 (Policy Enforcement Point, PEP). Among them, PEP is a component in the access control architecture responsible for intercepting access requests and sending them to the PDP for evaluation, and PDP is a component that evaluates authorization requests according to predefined policies and makes decisions. The PDP can run as an independent component. In this implementation manner, a container 43 is set between the policy decision node 41 and the policy enforcement node 42. The container 43 is used for the class loader 41 to generate SDK component instances. That is to say, in the container 43, the class loader 411 of the SDK component of the original version loads and generates the SDK component instance 44a of the original version. At the same time, the class loader 412 of the SDK component of the upgraded version loads and generates the SDK component instance 44b of the upgraded version in an isolated manner in the container 43. The SDK component instances 44a and 44b do not use overlapping memory ranges, so they can run independently and in an isolated manner. At the same time, a PEP dynamic proxy 45 also runs in the container. The PEP is used to receive requests for the SDK instance and route them to different SDK component instances. Before the SDK component instance of the upgraded version is generated and the initialization is completed, the PEP dynamic proxy 45 routes the request to the SDK component instance 44a of the original version. At the same time, the PEP 42 receives the response from the SDK component instance 44a of the original version. The PEP dynamic proxy 45 is used to switch the request for the SDK component from being sent to the SDK component instance 44a of the original version to being sent to the SDK component instance 44b of the upgraded version when the upgraded SDK component instance is in a ready state according to the state of the SDK component. At the same time, the policy execution node 42 switches to receiving the response to the request from the SDK component instance 44b of the upgraded version and then forwards it to the application. Thus, the traffic switching is completed. InFigure 4 Among them, the solid line part represents the data flow before the switch, while the dashed line part represents the data flow after the switch.

[0067] Therefore, during the entire SDK upgrade process, the processing of requests for SDK components will not be interrupted. Before the upgraded version of the SDK component instance is successfully initialized, the policy execution node 42 routes all requests to the original version of the SDK component instance for response. After the upgraded version of the SDK component instance is initialized and ready, the policy execution node 42 routes all requests to the upgraded version of the SDK component instance for response. There is no need for the application to be restarted or republished, and during continuous operation, the SDK component upgrade can be achieved without affecting the operation of the application.

[0068] In step S500, after the traffic switch is successful, the cleaning process of the original version of the SDK component instance is triggered.

[0069] In some implementation manners, step S500 may include the following steps:

[0070] Step S510, stop the original version of the SDK component instance.

[0071] Step S520, clean the storage space corresponding to the original version of the SDK component instance.

[0072] Step S530, clean the software resources occupied by the original version of the SDK component instance.

[0073] Step S540, clean the class loader used to generate the original version of the SDK component instance.

[0074] Thus, the system resources can be further optimized.

[0075] At the same time, a rollback mechanism can also be set in this instance. Rollback refers to the act of restoring a program or data to the most recent correct version or the previous correct state when an error occurs in the program or data. The rollback mechanism is widely used in multiple fields such as software development, database management, and system deployment, aiming to ensure the stability of the system and the integrity of the data. If a problem occurs during the operation of the upgraded version of the SDK component instance, it can be rolled back to the original version of the SDK component.

[0076] In an alternative implementation, after the traffic switching is successful, the cleaning process of the SDK component instances of the original version may not be performed, that is, the above step S500 is omitted. If a problem occurs with the SDK components of the upgraded version, the control plane issues a rollback policy to all or part of the servers running the SDK components of the upgraded version on the data plane. After receiving the rollback policy, since the SDK component instances of the original version have not been cleared, the control switches the request and response traffic from the SDK component instances of the upgraded version back to the SDK component instances of the original version that have not been stopped in the container. Thus, the rollback operation can be completed.

[0077] In another alternative implementation, after each successful upgrade, the SDK component instances of the original version are cleared. If a problem occurs with the SDK components of the upgraded version, the control plane issues a rollback policy to all or part of the servers running the SDK components of the upgraded version on the data plane. After receiving the rollback policy, based on the same process as the upgrade, a class loader is independently generated for the SDK components of the original version in an isolated manner, the SDK components of the original version are loaded, and after the corresponding instances are generated and initialized, the control switches the request and response traffic from the SDK component instances of the upgraded version back to the SDK component instances of the original version that have not been stopped in the container. Thus, the rollback operation can be completed. The rollback method of this implementation can save system resources and improve resource utilization efficiency.

[0078] In the embodiments of the present invention, by uniformly issuing a dynamic upgrade policy to the server and specifying the upgrade scope in the dynamic upgrade policy, at the same time, the SDK components of the upgraded version are independently loaded through a class loader in a memory isolation manner from the original version SDK, and instances of the SDK components of the upgraded version are generated, and after the initialization of the instances of the SDK components of the upgraded version is completed, the requests for the SDK component instances are routed to the instances of the SDK components of the upgraded version. Thus, during the upgrade process, it is not necessary to stop the operation of the original version SDK, and after the upgrade is completed, it is not necessary to restart or republish the network applications using the SDK to achieve dynamic upgrade of the SDK.

[0079] Figure 5 It is a block diagram of the device for runtime upgrade of the SDK in the embodiments of the present invention. As Figure 5 shown, the device for runtime upgrade of the SDK in this embodiment includes:

[0080] A receiving unit 51, configured to receive a dynamic upgrade policy issued by the control plane;

[0081] A loading unit 52, configured to, in response to the upgrade scope of the dynamic upgrade policy including the local machine, load the SDK components of the upgraded version into a class loader, and the class loader generates SDK component instances based on a storage space independent of the SDK component instances of the original version;

[0082] An initialization unit 53, configured to initialize the SDK component instance according to the dynamic upgrade policy. Meanwhile, route requests for the SDK component instance to the original version of the SDK component instance;

[0083] A switching unit 54, configured to route requests for the SDK component instance to the upgraded version of the SDK component instance in response to the SDK component instance being in a ready state.

[0084] In some embodiments, the device further includes a cleaning module, configured to trigger a cleaning process for the original version of the SDK component instance after routing requests for the SDK component instance to the upgraded version of the SDK component instance.

[0085] In some implementation manners, the cleaning process includes:

[0086] Stop the original version of the SDK component instance;

[0087] Clean the storage space corresponding to the original version of the SDK component instance;

[0088] Clean the software resources occupied by the original version of the SDK component instance;

[0089] Clean the class loader used to generate the original version of the SDK component instance.

[0090] In some embodiments, the initialization unit 53 is specifically configured to:

[0091] Obtain the SDK configuration status corresponding to the dynamic upgrade policy;

[0092] Trigger the initialization of the SDK component instance based on the SDK configuration status;

[0093] Generate a corresponding initialization state machine to monitor the initialization process;

[0094] Determine that the initialization is completed in response to the state machine indicating that the SDK component instance is in a ready state.

[0095] In some embodiments, the class loader generates the SDK component instance in the container as a policy decision node, and the container has a policy execution node dynamic proxy for communicating with SDK component instances of each version;

[0096] The switching module 54 is specifically configured to:

[0097] The policy execution node receives the request for the SDK component instance, and sends the request to the policy execution node dynamic proxy;

[0098] The policy execution node dynamic proxy forwards the request to the upgraded version of the SDK component instance in response to the upgraded version of the SDK component instance being in a ready state; and,

[0099] The upgraded version of the SDK component instance sends a response to the policy execution node for the request.

[0100] In some embodiments, the class loader inherits from the URLClassLoader class.

[0101] In some embodiments, the upgrade scope of the dynamic upgrade policy includes the local machine specifically as follows:

[0102] The upgrade scope of the dynamic upgrade policy includes the network address or the tail number of the network address of the local machine.

[0103] In the embodiments of the present invention, by uniformly sending the dynamic upgrade policy to the server and specifying the upgrade scope in the dynamic upgrade policy, at the same time, the upgraded version of the SDK component is independently loaded in a manner of memory isolation from the original version of the SDK through the class loader, and an instance of the upgraded version of the SDK component is generated, and after the initialization of the instance of the upgraded version of the SDK component is completed, the request for the SDK component instance is routed to the upgraded version of the SDK component instance. Thus, during the upgrade process, it is not necessary to stop the operation of the original version of the SDK, and after the upgrade is completed, it is not necessary to restart or republish the network application using the SDK to achieve the dynamic upgrade of the SDK.

[0104] Figure 6 It is a schematic diagram of the electronic device according to the embodiments of the present invention. As Figure 6 shown, the electronic device includes a general computer hardware structure, which at least includes a processor 61 and a memory 62, and is used to constitute the server according to the embodiments of the present invention.

[0105] The processor 61 and the memory 62 are connected through a bus 63. The memory 62 is suitable for storing instructions or programs executable by the processor 61. The processor 61 can be an independent microprocessor or a set of one or more microprocessors. Thus, the processor 61 executes the instructions stored in the memory 62 to perform the method flow of the embodiments of the present invention as described above to implement the processing of data and the control of other devices. The bus 63 connects the above-mentioned multiple components together, and at the same time connects the above-mentioned components to the display controller 64 and the display device and the input / output (I / O) device 65. The input / output (I / O) device 65 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a somatosensory input device, a printer, and other devices well known in the art. Typically, the input / output (I / O) device 65 is connected to the system through an input / output (I / O) controller 66.

[0106] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, an apparatus (device), or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can be implemented as a computer program product on one or more computer-readable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.

[0107] The present application is described with reference to the flowcharts of methods, apparatuses (devices), and computer program products according to the embodiments of the present application. It should be understood that each process in the flowchart can be implemented by computer program instructions.

[0108] These computer program instructions can be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured article including an instruction device that implements the process Figure 1 specified functions in one or more of these processes.

[0109] These computer program instructions can also be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the Figure 1 specified functions in one or more of these processes.

[0110] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, and the computer-readable program is used for a computer to execute the above-mentioned partial or all method embodiments.

[0111] That is, those skilled in the art can understand that all or part of the steps in implementing the above-mentioned method embodiments can be completed by specifying relevant hardware through a program. The program is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical disks, etc., which can store program codes.

[0112] The above are only the preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various modifications and changes can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.

Claims

1. A method for upgrading SDK runtime, characterized in that: The method comprises: Receive the dynamic upgrade strategy issued by the control plane; In response to the upgrade scope of the dynamic upgrade strategy including the local machine, loading the upgraded version of the SDK component into the class loader, the class loader generating an SDK component instance based on a storage space independent of the original version of the SDK component; Initializing the SDK component instance according to the dynamic upgrade strategy, and routing requests for the SDK component instance to the original version of the SDK component instance; In response to the SDK component instance being in a ready state, a request for the SDK component instance is routed to the upgraded version of the SDK component instance.

2. The method according to claim 1, characterized in that After routing the request for the SDK component instance to the upgraded version of the SDK component instance, the method further includes: Trigger the cleanup process of the original version of the SDK component instance.

3. The method according to claim 2, characterized in that The cleaning process includes: Stop the SDK component instance of the original version; Clean up the storage space corresponding to the SDK component instance of the original version; Cleaning up the software resources occupied by the SDK component instance of the original version; Clean up the class loader used to generate the SDK component instance of the original version.

4. The method according to claim 1, characterized in that: Initializing the SDK component instance according to the dynamic upgrade strategy includes: Obtain the SDK configuration status corresponding to the dynamic upgrade strategy; Triggering SDK component instance initialization based on the SDK configuration state; Generate the corresponding initialization state machine to monitor the initialization process; In response to the state machine indicating that the SDK component instance is in a ready state, it is determined that initialization is completed.

5. The method according to claim 1, characterized in that The class loader generates the SDK component instance in a container as a policy decision node, and the container has a policy execution node dynamic agent that communicates with each version of the SDK component instance; Routing requests to SDK component instances to upgraded versions of SDK component instances includes: The policy execution node receives the request for the SDK component instance and sends the request to the policy execution node dynamic agent; In response to the upgraded version of the SDK component instance being in a ready state, the policy execution node dynamic agent forwards the request to the upgraded version of the SDK component instance; and The upgraded version of the SDK component instance sends a response to the request to the policy execution node.

6. The method according to claim 1, characterized in that The class loader inherits from the URLClassLoader class.

7. The method according to claim 1, characterized in that The upgrade scope of the dynamic upgrade strategy includes: The upgrade scope of the dynamic upgrade strategy includes the network address or the last number of the network address of the local computer.

8. A device for upgrading SDK during runtime, characterized in that: The device comprises: A receiving unit, used to receive a dynamic upgrade strategy sent by the control plane; A loading unit, configured to load an upgraded version of the SDK component into a class loader in response to the upgrade scope of the dynamic upgrade strategy including the local machine, wherein the class loader generates an SDK component instance based on a storage space independent of the original version of the SDK component; An initialization unit, used to initialize the SDK component instance according to the dynamic upgrade strategy, and at the same time, route the request for the SDK component instance to the original version SDK component instance; The switching unit is used to route the request for the SDK component instance to the upgraded version of the SDK component instance in response to the SDK component instance being in a ready state.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or data, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.