Method and device for service expansion
By receiving service expansion information and generating consistent expansion instances, the problem of inconsistent expansion instances and production environment instance versions during service expansion is solved, and efficient service expansion and deployment iteration compatibility is achieved.
Patent Information
- Application Number
- CN201910708555.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-01
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2039-08-01
AI Technical Summary
During the service expansion process, it is difficult for the prior art to ensure consistency between the expansion instance and the service instance version in the production environment, especially in scenarios where iterations are frequently deployed.
By receiving service expansion information, a service package matching the service identity is obtained as the target service package based on the preset service package set, and whether the target service package is consistent with the target service instance. Responsive to consistency, a scalable instance is generated to ensure consistent delivery with the production environment instance.
The version consistency between the expanded instance and the production environment instance is achieved, priority is given to the completion of the deployment iteration task, and the delivery quality and overall efficiency of the expanded instance are improved.
Smart Images

Figure CN110442349B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a method and device for service expansion. Background Art
[0002] With the rapid development of Internet technology, the deployment iteration frequency of service instances running on service clusters is getting higher and higher. Therefore, the process of service expansion often involves the deployment iteration of services in the production environment.
[0003] There are usually two related methods: one is to use tools with orchestration and file distribution capabilities to deploy the service expansion instance according to the program source provided by the user, and then add the expansion instance to the production environment. In this way, the expansion task and the service deployment iteration task run independently without interfering with each other. The second is to use the lock grabbing method to determine the execution order of the expansion task and the deployment iteration task of the same service cluster, so as to ensure the consistency of the expansion instance version through the mutual exclusion method. Summary of the invention
[0004] The embodiments of the present disclosure provide a method and apparatus for service expansion.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for service expansion, the method comprising: receiving service expansion information, wherein the service expansion information includes a service identifier of a service to be expanded; based on a preset service package set, obtaining a service package matching the service identifier as a target service package, wherein the service packages in the preset service package set are generated based on a service instance of the service to be expanded in a production environment; determining whether the target service package is consistent with the target service instance, wherein the target service instance includes a service instance of the service to be expanded that is in the production environment at a current moment; in response to determining that the target service package is consistent with the target service instance, generating an expansion instance of the service to be expanded based on the target service package.
[0006] In some embodiments, the above-mentioned obtaining a service package that matches the service identifier as a target service package based on a preset service package set includes: in response to determining that there is no service package that matches the service identifier in the service package set, executing the following service package update steps: obtaining an instance list in the production environment that matches the service identifier; selecting a service instance from the instance list as a data source instance of the service package according to the execution order of the service instances in the deployment iteration scenario indicated by the instance list; packaging the data source instance of the service package into a data source instance package, and storing it in the service package set; in response to the data source instance package being stored in the service package set, obtaining a data source instance package from the service package set as the target service package.
[0007] In some embodiments, the service package corresponds to a version number; and the above-mentioned determining whether the target service package is consistent with the target service instance includes: determining whether the version number corresponding to the target service package is consistent with the version number corresponding to the service package of the target service instance.
[0008] In some embodiments, the service package includes a service component file set; and the above-mentioned determination of whether the target service package is consistent with the target service instance includes: selecting a target number of service component files from the service component file set in the target service package to generate a file set to be verified; determining whether the files in the file set to be verified are consistent with the component files corresponding to the target service instance.
[0009] In some embodiments, the above-mentioned generation of the set of files to be verified includes: obtaining file verification information indicating the range of the verified files; and selecting service component files from the service component file set in the target service program package according to the file verification information to generate the set of files to be verified.
[0010] In some embodiments, the method further includes: in response to determining that the target service package is inconsistent with the target service instance, deleting the data source instance package from the service package set; and continuing to perform the service package update step.
[0011] In some embodiments, the above-mentioned generation of an expanded instance of the service to be expanded based on the target service package includes: obtaining a list of instances matching the service identifier in the production environment at the current moment as a target instance list; in response to determining that there is a service instance matching the target service in the target instance list, generating an expanded instance of the service to be expanded based on the target service package and the initial expanded instance.
[0012] In some embodiments, the method further includes: in response to determining that there is no instance matching the target service in the target instance list, deleting the data source instance package from the service package set; and continuing to perform the service package update step.
[0013] In some embodiments, the method further includes: in response to generating the capacity expansion instance, publishing the capacity expansion instance to the production environment.
[0014] In some embodiments, the method also includes: determining whether the capacity expansion instance in the production environment is consistent with the target service instance; in response to determining that the capacity expansion instance in the production environment is consistent with the target service instance, determining whether there is a service instance matching the target service in the target instance list; in response to determining that there is a service instance matching the target service in the target instance list, running an automated testing program, and generating test results; based on the test results, sending information indicating whether the service expansion is completed.
[0015] In a second aspect, an embodiment of the present disclosure provides a device for service expansion, the device comprising: a receiving unit, configured to receive service expansion information, wherein the service expansion information includes a service identifier of a service to be expanded; an acquisition unit, configured to acquire a service package matching the service identifier as a target service package based on a preset service package set, wherein the service packages in the preset service package set are generated based on a service instance of the service to be expanded in a production environment; a first determination unit, configured to determine whether the target service package is consistent with the target service instance, wherein the target service instance includes a service instance of the service to be expanded that is in the production environment at the current moment; a generation unit, configured to generate an expansion instance of the service to be expanded based on the target service package in response to determining that the target service package is consistent with the target service instance.
[0016] In some embodiments, the acquisition unit includes: an update module, configured to execute the following service package update steps in response to determining that there is no service package matching the service identifier in the service package collection: obtaining a list of instances in the production environment that match the service identifier; selecting a service instance from the instance list as a data source instance of the service package according to the execution order of the service instances in the deployment iteration scenario indicated by the instance list; packaging the data source instance of the service package into a data source instance package, and storing it in the service package collection; a first acquisition module, configured to obtain a data source instance package from the service package collection as a target service package in response to the data source instance package being stored in the service package collection.
[0017] In some embodiments, the service package corresponds to a version number; the first determining unit includes: a first determining module configured to determine whether the version number corresponding to the target service package is consistent with the version number corresponding to the service package of the target service instance.
[0018] In some embodiments, the service package includes a service component file set; the above-mentioned first determination unit also includes: a first generation module, configured to select a target number of service component files from the service component file set in the target service package to generate a file set to be verified; a second determination module, configured to determine whether the files in the file set to be verified are consistent with the component files corresponding to the target service instance.
[0019] In some embodiments, the above-mentioned first generation module includes: an acquisition sub-module, configured to obtain file verification information indicating the range of the verification file; a generation sub-module, configured to select service component files from the service component file set in the target service program package according to the file verification information, and generate a set of files to be verified.
[0020] In some embodiments, the apparatus further includes: a first updating unit configured to, in response to determining that the target service package is inconsistent with the target service instance, delete the data source instance package from the service package set; and continue to execute the service package updating step.
[0021] In some embodiments, the above-mentioned generation unit includes: a second acquisition module, configured to obtain a list of instances matching the service identifier at the current moment and in the production environment as a target instance list; a second generation module, configured to generate an expanded instance of the service to be expanded based on the target service package and the initial expanded instance in response to determining that there is a service instance matching the target service in the target instance list.
[0022] In some embodiments, the apparatus further includes: a second updating unit configured to delete the data source instance package from the service package set in response to determining that there is no instance matching the target service in the target instance list; and continue to execute the service package updating step.
[0023] In some embodiments, the apparatus further includes: a publishing unit configured to publish the capacity expansion instance to the production environment in response to generating the capacity expansion instance.
[0024] In some embodiments, the device also includes: a second determination unit, configured to determine whether the capacity expansion instance in the production environment is consistent with the target service instance; a third determination unit, configured to determine whether there is a service instance matching the target service in the target instance list in response to determining that the capacity expansion instance in the production environment is consistent with the target service instance; a testing unit, configured to run an automated testing program and generate test results in response to determining that there is a service instance matching the target service in the target instance list; and a sending unit, configured to send information indicating whether the service expansion is completed based on the test results.
[0025] In a third aspect, an embodiment of the present disclosure provides a server, comprising: one or more processors; a storage device on which one or more programs are stored; when the one or more programs are executed by one or more processors, the one or more processors implement the method described in any implementation method in the first aspect.
[0026] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any implementation manner in the first aspect.
[0027] The method and device for service expansion provided by the embodiments of the present disclosure first receive service expansion information. The service expansion information includes a service identifier of the service to be expanded. Then, based on a preset service package set, a service package matching the service identifier is obtained as a target service package. The service packages in the preset service package set are generated based on service instances of the service to be expanded in a production environment. Then, it is determined whether the target service package is consistent with the target service instance. The target service instance includes a service instance of the service to be expanded that is in the production environment at the current moment. Finally, in response to determining that the target service package is consistent with the target service instance, an expansion instance of the service to be expanded is generated based on the target service package. Thereby, consistent delivery of the expansion instance and the production environment instance is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0029] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;
[0030] Figure 2 is a flow chart of an embodiment of a method for service expansion according to the present disclosure;
[0031] Figure 3 is a schematic diagram of an application scenario of a method for service expansion according to an embodiment of the present disclosure;
[0032] Figure 4 is a flow chart of another embodiment of a method for service expansion according to the present disclosure;
[0033] Figure 5 is a structural schematic diagram of an embodiment of a device for service capacity expansion according to the present disclosure;
[0034] Figure 6 It is a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION
[0035] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[0036] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0037] Figure 1 An exemplary architecture 100 is shown to which the method for service capacity expansion or the apparatus for service capacity expansion of the present disclosure can be applied.
[0038] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0039] The terminal devices 101, 102, 103 interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 101, 102, 103, such as web browser applications, search applications, instant messaging tools, email clients, social platform software, text editing applications, software development tools, etc.
[0040] Terminal devices 101, 102, 103 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens and supporting software development, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc. When terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software or software modules (such as software or software modules used to provide distributed services), or they can be implemented as a single software or software module. No specific limitation is made here.
[0041] The server 105 may be a server that provides various services, such as a backend server that provides deployment, iteration, and expansion support for service programs used by the terminal devices 101, 102, and 103. Optionally, the server 105 may also be a cloud server. The backend server may analyze and process the received service expansion information, and generate a service expansion instance if the expansion conditions are met.
[0042] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0043] It should be noted that the method for service capacity expansion provided in the embodiments of the present disclosure is generally executed by the server 105 , and accordingly, the device for service capacity expansion is generally set in the server 105 .
[0044] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0045] Continue to refer Figure 2 , shows a process 200 of an embodiment of a method for service expansion according to the present disclosure. The method for service expansion includes the following steps:
[0046] Step 201: Receive service expansion information.
[0047] In this embodiment, the execution subject of the method for service expansion (such as Figure 1 The server 105 shown in the figure can receive the service expansion information through a wired connection or a wireless connection. The service expansion information can include a service identifier of the service to be expanded. The service identifier can be used to uniquely identify the service. The service identifier can usually be in the form of a string.
[0048] In this embodiment, the execution subject may receive the service expansion information in various ways. As an example, the execution subject may directly receive the service expansion information sent by the terminal used by the user. Among them, the service identifier of the service to be expanded in the service expansion information may be used to indicate the service that the user needs to expand. As another example, the execution subject may receive the service expansion information sent by the electronic device (e.g., a server for pre-security check) connected in communication. Among them, the service expansion information may be generated by the server for pre-security check according to the result of pre-security check on the received user expansion request. The user expansion request may include user information and the service identifier of the service to be expanded. The user information may include but is not limited to at least one of the following: user name, password, IP (Internet Protocol) address, resource (e.g., traffic, network bandwidth, memory, etc.) limit. The pre-security check may include verifying the user information; it may also include matching the resources required for expanding the service to be expanded with the resource limit.
[0049] Step 202: Based on a preset service package set, a service package matching the service identifier is obtained as a target service package.
[0050] In this embodiment, based on a preset service package set, the execution subject may obtain a service package that matches the service identifier in step 201 in various ways. The service package may include a code file and an operating environment. The service packages in the preset service package set may be generated based on service instances of the service to be expanded in a production environment. As an example, in response to the service instance being published to the production environment, the execution subject may package the service instance and the production environment to generate a service package; then, the execution subject may store the generated service package into the preset service package set. In practice, the preset service package set may be stored in a file distribution tool.
[0051] In this embodiment, in response to determining that there is a service package in the service package set that matches the service identifier in step 201, the execution subject may obtain the matching service package, and determine the matching service package as the target service package. The matching may include that the service provided by the service package is consistent with the service indicated by the service identifier.
[0052] Optionally, in the scenario of service deployment iteration, the service package may correspond to a version number. Typically, the version number may correspond to the service package one-to-one.
[0053] Optionally, the service package may include a service component file set, wherein the service component may include a subunit for implementing the provision of the service, and multiple service component files may together form the software foundation of the service component.
[0054] In some optional implementations of this embodiment, the execution subject may also obtain a service package matching the service identifier as the target service package through the following steps:
[0055] In the first step, in response to determining that there is no service package matching the service identifier in the service package set, the following service package update steps are performed:
[0056] S1, obtain the list of instances in the production environment that match the service ID.
[0057] In these implementations, the execution subject may obtain the instance list in the production environment that matches the service identifier in various ways. The instance list may include information about the instance of the service indicated by the service identifier in the production environment. The instance information may include the instance name. Optionally, it may also include the version number corresponding to the instance. As an example, the execution subject may obtain the instance list from a communication-connected electronic device (e.g., a database server). As another example, the execution subject may obtain the instance list locally.
[0058] S2, selecting a service instance from the instance list as a data source instance of the service package according to the service instance execution order in the deployment iteration scenario indicated by the instance list.
[0059] In these implementations, according to the execution order of the service instances in the deployment iteration scenario indicated by the instance list, the execution subject may select the service instance from the instance list obtained in step S1 as the data source instance of the service package. In practice, the execution order of the service instances in the deployment iteration scenario is usually consistent with the arrangement order of the information of the instances in the instance list. Thus, the execution subject may select the service instance indicated by the information of the first instance in the instance list as the data source instance of the service package.
[0060] Based on the above optional implementation method, by using the service instance that is executing the deployment iteration as the data source instance, when the service deployment change of the production environment is triggered, the production environment after the latest deployment iteration is executed can be obtained.
[0061] S3: Pack the data source instance of the service package into a data source instance package and store it in the service package set.
[0062] In these implementations, the execution subject may package the code, production environment, etc. corresponding to the data source instance selected in step S2 to generate a data source instance program package. Then, the execution subject may store the generated data source instance program package into the preset service program package set.
[0063] In the second step, in response to the data source instance program package being stored in the service program package set, the data source instance program package is obtained from the service program package set as a target service program package.
[0064] In these implementations, the execution subject may obtain a data source instance program package from the service program package set updated in step S3; and determine the data source instance program package as the target service program package.
[0065] Step 203: Determine whether the target service package is consistent with the target service instance.
[0066] In this embodiment, the execution subject may determine in various ways whether the target service package obtained in step 202 is consistent with the target service instance. Among them, the target service may include a service instance of the service to be expanded that is currently in the production environment. As an example, based on the version number corresponding to the service package, the execution subject may determine whether the version number corresponding to the target service package is consistent with the version number corresponding to the service package of the target service instance. In a deployment iteration scenario, the target service instance may generally be a service instance corresponding to the version that is executing the deployment iteration task.
[0067] In some optional implementations of this embodiment, based on the service component file set in the service package, the execution subject may determine whether the target service package is consistent with the target service instance according to the following steps:
[0068] In the first step, a target number of service component files are selected from a service component file set in a target service program package to generate a file set to be verified.
[0069] In these implementations, the execution entity may select a target number of service component files from the service component file set in the target service package through various methods. The target number may be any number pre-set according to actual application requirements. The target number may also be a number determined according to a rule, such as the number of files belonging to a specified category. The files of the specified category may be, for example, non-log files. Then, the execution entity may form the set of files to be verified with the selected at least one service component file.
[0070] Optionally, the above execution entity may also generate a set of files to be verified through the following steps:
[0071] S1. Obtain file verification information indicating a verification file range.
[0072] Based on the above optional implementations, the execution subject may obtain the file verification information indicating the verification file range in various ways. As an example, the execution subject may obtain the file verification information from a terminal that sends the service expansion information. As another example, the execution subject may also obtain the pre-stored file verification information locally. The file verification information may be information indicating files that need to be verified or information indicating files that do not need to be verified.
[0073] S2. Selecting service component files from the service component file set in the target service program package according to the file verification information to generate a file set to be verified.
[0074] Based on the above optional implementation, the execution subject may select a service component file from the service component file set in the target service package according to the file verification information obtained in the above step S1 to generate a set of files to be verified. Specifically, the execution subject may select a file that needs to be verified as indicated by the file verification information, and form the set of files to be verified with at least one selected service component file.
[0075] The second step is to determine whether the files in the to-be-verified file set are consistent with the component files corresponding to the target service instance.
[0076] In these implementations, the execution subject may use various methods for verifying file consistency to determine whether the files in the set of files to be verified are consistent with the component files corresponding to the target service instance. The methods may include but are not limited to at least one of the following: md5 (Message Digest Algorithm, version 5), SHA1 (Secure Hash Algorithm, secure hash algorithm), CRC32 (Cyclic Redundancy Check, cyclic redundancy code).
[0077] In these implementations, the execution subject may determine whether each file in the set of files to be verified is consistent with the component file corresponding to the target service instance. Optionally, the execution subject may stop determining whether other files in the set of files to be verified are consistent when it is determined that there is an inconsistent file.
[0078] Based on the above optional implementation method, by directly comparing the consistency of files, it is possible to accurately determine whether the service instance in the production environment (or the service component corresponding to the component file) has been iterated in the deployment iteration scenario without changing the version number (such as the scenario of packaging the iterative version with the same version number).
[0079] Step 204 , in response to determining that the target service package is consistent with the target service instance, generating an expanded instance of the service to be expanded based on the target service package.
[0080] In this embodiment, in response to determining that the target service package is consistent with the target service instance, the execution subject may install the target service package to a preset initial expansion instance. The initial expansion instance may include an execution base environment in which the service program indicated by the target service package can run. Optionally, the execution subject may also execute installation verification logic before installation to improve security.
[0081] In some optional implementations of this embodiment, in response to determining that the target service package is inconsistent with the target service instance, the execution subject may also delete the data source instance package from the service package set; and continue to execute the service package update step. Optionally, the execution subject may also continue to execute the subsequent steps of the method for service expansion. Thus, after a deployment change occurs to a service instance that is a data source instance in a production environment, the data source instance of the expansion instance may be updated. This ensures the consistency of the expansion instance with the service instance in the production environment.
[0082] In some optional implementations of this embodiment, the above-mentioned execution subject may also generate an expansion instance of the service to be expanded through the following steps:
[0083] The first step is to obtain a list of instances in the current moment and production environment that match the service ID as the target instance list.
[0084] In these implementations, the execution subject may obtain a list of instances matching the service identifier in the production environment at the current moment as the target instance list. The instance list may represent the execution order of the deployment iteration of the service to be expanded in the production environment at the current moment. Therefore, the target instance list at this time may be the same as or different from the instance list obtained in the optional implementation in step 202.
[0085] In the second step, in response to determining that there is a service instance matching the target service in the target instance list, an expanded instance of the service to be expanded is generated based on the target service program package and the initial expanded instance.
[0086] In these implementations, in response to determining that there is a service instance matching the target service in the target instance list, the method for generating an expansion instance of the service to be expanded may be consistent with the description of step 204, which is not repeated here.
[0087] Optionally, in response to determining that there is no instance matching the target service in the target instance list, the execution subject may also delete the data source instance package from the service package set; and continue to execute the service package update step. Optionally, the execution subject may also continue to execute the steps after the service package update step in the method for service expansion. Thus, when the service instance as the data source instance no longer participates in the deployment iteration of the service component of the production environment from a previous moment, the consistency of the expanded instance and the service instance of the production environment can still be maintained.
[0088] In some optional implementations of this embodiment, in response to generating an expansion instance, the execution subject may also publish the expansion instance to the production environment. This enables the publication of the expansion instance. Based on the optional implementation, when a deployment iteration occurs in a service in the production environment, the information of the expansion instance may be presented on the console of the user terminal. Thus, the expansion instance may be changed together with other instances in the production environment, and no version differences may be generated.
[0089] Continue to see Figure 3 , Figure 3 FIG. 1 is a schematic diagram of an application scenario of a method for service expansion according to an embodiment of the present disclosure. Figure 3 In the application scenario, user 301 sends service expansion information 305 indicating "adding 1 service aa instance" to server 303 through terminal device 302. Instances 3041 and 3042 are instances of service aa running in the production environment. After receiving service expansion information 305, server 303 can obtain "service aa v1.0" package 306 from the file distribution tool. Afterwards, server 303 can determine whether "service aa v1.0" package 306 is consistent with instance 3041 307. Then, as shown in step 308, in response to determining consistency, server 303 can generate instance 3043. Optionally, server 303 can also publish the generated instance 3042 to the above-mentioned production environment.
[0090] At present, one of the existing technologies is usually to generate a capacity expansion instance based on the service instance in the current production environment identified by the automatic program, which results in the inability to guarantee the version consistency of the generated capacity expansion instance with the current production environment when the service deployment iteration is continuously performed after the capacity expansion task is initiated. The method provided by the above-mentioned embodiment of the present disclosure ensures that the data source instance used to generate the capacity expansion instance is the latest version in the production environment by determining whether there is a service package consistent with the current service instance in the preset service package set. Moreover, by taking the consistency between the target service package and the target service instance as the prerequisite for generating the capacity expansion instance, it is achieved that while giving priority to the deployment iteration task, the delivery quality of the capacity expansion instance is also guaranteed to be "delivered and available".
[0091] It should be noted that, since the deployment iteration of the production environment is often based on the service cluster, all instances in the production environment need to complete the deployment of the new version before the deployment iteration task is considered completed. The expansion task is usually based on an instance, and the expansion task is considered completed only when one instance completes the deployment of all service components in the service. Therefore, compared with the locked scheme that uses mutually exclusive deployment iteration tasks and expansion tasks and the scheme that prioritizes the execution of expansion tasks, the method provided by the above-mentioned embodiment of the present disclosure can achieve the optimization of deployment iteration while taking into account the overall efficiency by giving priority to the completion of deployment iteration tasks that are more difficult to meet.
[0092] Further references Figure 4 , which shows a process 400 of another embodiment of a method for service expansion. The process 400 of the method for service expansion includes the following steps:
[0093] Step 401: Receive service expansion information.
[0094] Step 402: Based on a preset service package set, a service package matching the service identifier is obtained as a target service package.
[0095] Step 403: Determine whether the target service package is consistent with the target service instance.
[0096] Step 404 , in response to determining consistency, generating an expansion instance of the service to be expanded based on the target service program package.
[0097] Step 405: In response to generating the capacity expansion instance, the capacity expansion instance is released to the production environment.
[0098] The above steps 401, 402, 403, 404 and 405 are respectively consistent with steps 201, 202, 203 and 204 and their optional implementations in the aforementioned embodiment. The above descriptions of steps 201, 202, 203 and 204 and their optional implementations are also applicable to steps 401, 402, 403, 404 and 405, and are not repeated here.
[0099] Step 406, determining whether the expanded instance in the production environment is consistent with the target service instance.
[0100] In this embodiment, the execution subject of the method for service expansion (such as Figure 1The server 105 shown in the figure can determine whether the expanded instance in the production environment is consistent with the target service instance according to a method similar to step 403 in the above embodiment. As an example, the above execution subject can traverse the service component list corresponding to the expanded instance to determine whether each service component file is consistent with the corresponding service component file in the target service instance.
[0101] Step 407: In response to determining that the expanded instance in the production environment is consistent with the target service instance, determine whether there is a service instance matching the target service in the target instance list.
[0102] In this embodiment, in response to determining that the expansion instance in the production environment is consistent with the target service instance, the execution subject can determine whether there is a service instance matching the target service in the target instance list. The method for determining whether the service instances match can refer to step 202 in the above embodiment and its optional implementation method, which will not be repeated here.
[0103] It should be noted that the current time corresponding to the target instance list is different from the time in the optional implementation of step 204 in the above embodiment. Therefore, it can be further determined whether a deployment iteration of the service component occurs between the above two times.
[0104] Step 408 , in response to determining that there is a service instance matching the target service in the target instance list, running an automated testing program and generating a test result.
[0105] In this implementation, in response to determining that there is a service instance matching the target service in the target instance list in step 407, the execution subject may determine that the source instance of the generated capacity expansion instance is still participating in the deployment iteration of the service component in the production environment. Then, the execution subject may use various automated testing programs to test the generated capacity expansion instance and generate test results.
[0106] In some optional implementations of this embodiment, in response to determining that there is no service instance matching the target service in the target instance list in step 407, the execution subject may delete the data source instance package from the service package set; and continue to execute the service package update step. Optionally, the execution subject may also continue to execute the steps after the service package update step in the above-mentioned method for service expansion. Thus, when the service instance as the data source instance no longer participates in the deployment iteration of the service component of the production environment from a previous moment, the consistency of the expanded instance and the service instance of the production environment can still be maintained.
[0107] Step 409: Send information indicating whether the service expansion is completed according to the test result.
[0108] In this embodiment, according to whether the test indicated by the test result is passed, the execution subject may send feedback information consistent with the test result to the target terminal. The feedback information may be used to indicate whether the service expansion is completed. The target terminal may be any pre-specified terminal, such as a display device connected to the execution subject for communication. The target terminal may also be a terminal determined according to a rule, such as a terminal that sends the service expansion information. Thus, the completion result of the service expansion may be fed back to the terminal device.
[0109] from Figure 4 It can be seen that Figure 2 Compared with the corresponding embodiment, the process 400 of the method for service expansion in this embodiment embodies the steps of further testing the expansion instance in the production environment, and the step of sending information according to the test results. Therefore, the scheme described in this embodiment can re-check the expansion instance released to the production environment, so that the consistency of the expansion instance and the target service instance can be determined in the scenario where the data source instance of the production environment undergoes deployment iterations from the time when some service components in the expansion instance are deployed to the time when all service components are deployed, so that the expansion instance is completely consistent with the service version and dependent environment of the production environment when it is delivered.
[0110] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for service expansion. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0111] like Figure 5 As shown, the device 500 for service expansion provided by this embodiment includes a receiving unit 501, an acquisition unit 502, a first determination unit 503 and a generation unit 504. The receiving unit 501 is configured to receive service expansion information, wherein the service expansion information includes a service identifier of the service to be expanded; the acquisition unit 502 is configured to acquire a service package matching the service identifier as a target service package based on a preset service package set, wherein the service package in the preset service package set is generated based on a service instance of the service to be expanded in a production environment; the first determination unit 503 is configured to determine whether the target service package is consistent with the target service instance, wherein the target service instance includes a service instance of the service to be expanded that is in the production environment at the current moment; the generation unit 504 is configured to generate an expansion instance of the service to be expanded based on the target service package in response to determining that the target service package is consistent with the target service instance.
[0112] In this embodiment, the specific processing of the receiving unit 501, the obtaining unit 502, the first determining unit 503 and the generating unit 504 in the device for service expansion 500 and the technical effects thereof can be referred to respectively. Figure 2 The relevant descriptions of step 201, step 202, step 203 and step 204 in the corresponding embodiment are not repeated here.
[0113] In some optional implementations of the present embodiment, the acquisition unit 502 may include: an update module (not shown in the figure), and a first acquisition module (not shown in the figure). The update module may be configured to, in response to determining that there is no service package matching the service identifier in the service package set, perform the following service package update steps: obtain a list of instances matching the service identifier in the production environment; select a service instance from the instance list as a data source instance of the service package according to the execution order of the service instances in the deployment iteration scenario indicated by the instance list; and package the data source instance of the service package into a data source instance package and store it in the service package set. The first acquisition module may be configured to, in response to the data source instance package being stored in the service package set, obtain a data source instance package from the service package set as a target service package.
[0114] In some optional implementations of this embodiment, the service package may correspond to a version number. The first determining unit 503 may include: a first determining module (not shown in the figure), configured to determine whether the version number corresponding to the target service package is consistent with the version number corresponding to the service package of the target service instance.
[0115] In some optional implementations of this embodiment, a service component file set may be included in a service program package. The first determination unit 503 may also include: a first generation module (not shown in the figure) and a second determination module (not shown in the figure). The first generation module may be configured to select a target number of service component files from the service component file set in the target service program package to generate a set of files to be verified. The second determination module may be configured to determine whether the files in the set of files to be verified are consistent with the component files corresponding to the target service instance.
[0116] In some optional implementations of this embodiment, the first generation module may include: an acquisition submodule (not shown in the figure) and a generation submodule (not shown in the figure). The acquisition submodule may be configured to acquire file verification information indicating a verification file range. The generation submodule may be configured to select a service component file from a service component file set in a target service program package according to the file verification information to generate a set of files to be verified.
[0117] In some optional implementations of this embodiment, the above-mentioned device 500 for service expansion may also include: a first update unit (not shown in the figure), configured to delete the data source instance package from the service package set in response to determining that the target service package is inconsistent with the target service instance; and continue to execute the service package update step.
[0118] In some optional implementations of this embodiment, the generation unit 504 may include a second acquisition module (not shown in the figure) and a second generation module (not shown in the figure). The second acquisition module may be configured to acquire a list of instances matching the service identifier in the current moment and in the production environment as a target instance list. The second generation module may be configured to generate an expansion instance of the service to be expanded based on the target service package and the initial expansion instance in response to determining that there is a service instance matching the target service in the target instance list.
[0119] In some optional implementations of this embodiment, the above-mentioned device 500 for service expansion may also include: a second update unit (not shown in the figure), configured to delete the data source instance package from the service package set in response to determining that there is no instance matching the target service in the target instance list; and continue to execute the service package update step.
[0120] In some optional implementations of this embodiment, the above-mentioned device 500 for service expansion may also include: a publishing unit (not shown in the figure), configured to publish the expansion instance to the production environment in response to generating the expansion instance.
[0121] In some optional implementations of this embodiment, the above-mentioned device 500 for service expansion may also include: a second determination unit (not shown in the figure), a third determination unit (not shown in the figure), a testing unit (not shown in the figure), and a sending unit (not shown in the figure). Among them, the above-mentioned second determination unit may be configured to determine whether the expansion instance in the production environment is consistent with the target service instance. The above-mentioned third determination unit may be configured to determine whether there is a service instance matching the target service in the target instance list in response to determining that the expansion instance in the production environment is consistent with the target service instance. The above-mentioned testing unit may be configured to run an automated testing program and generate a test result in response to determining that there is a service instance matching the target service in the target instance list. The above-mentioned sending unit may be configured to send information indicating whether the service expansion is completed based on the test result.
[0122] The device provided by the above-mentioned embodiment of the present disclosure receives service expansion information through a receiving unit 501. The service expansion information includes a service identifier of the service to be expanded. Then, based on a preset service package set, an acquisition unit 502 acquires a service package matching the service identifier as a target service package. The service packages in the preset service package set are generated based on service instances of the service to be expanded in a production environment. Afterwards, a first determination unit 503 determines whether the target service package is consistent with the target service instance. The target service instance includes a service instance of the service to be expanded that is in a production environment at the current moment. In response to determining that the target service package is consistent with the target service instance, the generation unit 504 generates an expansion instance of the service to be expanded based on the target service package. Thereby, consistent delivery of the expansion instance and the production environment instance is achieved.
[0123] Reference below Figure 6 , which shows an electronic device (eg, Figure 1 A schematic diagram of the structure of the server in FIG600. Figure 6 The server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0124] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0125] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0126] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0127] It should be noted that the computer-readable medium described in the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0128] The above-mentioned computer-readable medium may be included in the above-mentioned server; or it may exist independently and not be assembled into the server. The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the server, the server: receives service expansion information, wherein the service expansion information includes the service identifier of the service to be expanded; based on a preset service package set, obtains a service package matching the service identifier as a target service package, wherein the service packages in the preset service package set are generated based on service instances of the service to be expanded in a production environment; determines whether the target service package is consistent with the target service instance, wherein the target service instance includes the service instance of the service to be expanded that is in the production environment at the current moment; in response to determining that the target service package is consistent with the target service instance, generates an expansion instance of the service to be expanded based on the target service package.
[0129] Computer program code for performing the operations of the embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0130] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0131] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The described units may also be arranged in a processor, for example, may be described as: a processor comprising a receiving unit, an acquiring unit, a determining unit, and a generating unit. Among them, the names of these units do not constitute a limitation on the units themselves under certain circumstances. For example, the receiving unit may also be described as "a unit for receiving service expansion information, wherein the service expansion information includes a service identifier of the service to be expanded".
[0132] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) to form a technical solution.
Claims
1. A method for service expansion, comprising: Receiving service expansion information, wherein the service expansion information includes a service identifier of the service to be expanded; In response to determining that there is no service package matching the service identifier in the service package set, the following service package update steps are performed: obtaining an instance list in the production environment that matches the service identifier; selecting a service instance from the instance list as a data source instance of a service package according to the execution order of the service instances in the deployment iteration scenario indicated by the instance list; packaging the data source instance of the service package into a data source instance package, and storing it in the service package set; obtaining the data source instance package from the service package set as a target service package, wherein the service packages in the preset service package set are generated based on the service instances of the service to be expanded in the production environment; Determine whether the target service package is consistent with a target service instance, wherein the target service instance includes a service instance of the service to be expanded that is currently in the production environment; In response to determining that the target service package is consistent with the target service instance, generating an expanded instance of the service to be expanded based on the target service package; In response to determining that the target service package is inconsistent with the target service instance, deleting the data source instance package from the service package set; and continuing to execute the service package update step.
2. The method according to claim 1, wherein: The service package has a version number. as well as The determining whether the target service package is consistent with the target service instance includes: Determine whether the version number corresponding to the target service package is consistent with the version number corresponding to the service package of the target service instance.
3. The method according to claim 1, wherein: The service package includes a collection of service component files; as well as The determining whether the target service package is consistent with the target service instance includes: Selecting a target number of service component files from the service component file set in the target service program package to generate a set of files to be verified; Determine whether the files in the to-be-verified file set are consistent with the component files corresponding to the target service instance.
4. The method according to claim 3, wherein: The step of generating a set of files to be verified includes: Obtaining document verification information indicating a scope of the document to be verified; According to the file verification information, a service component file is selected from the service component file set in the target service program package to generate the file set to be verified.
5. The method according to claim 1, wherein: The step of generating the expansion instance of the service to be expanded based on the target service program package includes: Obtaining a list of instances matching the service identifier in the production environment at the current moment as a target instance list; In response to determining that there is a service instance matching the target service in the target instance list, an expanded instance of the service to be expanded is generated based on the target service program package and the initial expanded instance.
6. The method according to claim 5, wherein: The method further comprises: In response to determining that there is no instance matching the target service in the target instance list, deleting the data source instance package from the service package set; and continuing to execute the service package update step.
7. The method according to claim 6, wherein: The method further comprises: In response to generating the capacity expansion instance, the capacity expansion instance is released to the production environment.
8. The method according to claim 7, wherein: The method further comprises: Determining whether the expansion instance in the production environment is consistent with the target service instance; In response to determining that the expanded instance in the production environment is consistent with the target service instance, determining whether there is a service instance matching the target service in the target instance list; In response to determining that there is a service instance matching the target service in the target instance list, running an automated testing program and generating a test result; According to the test result, information indicating whether the service expansion is completed is sent.
9. A device for service expansion, comprising: A receiving unit, configured to receive service expansion information, wherein the service expansion information includes a service identifier of a service to be expanded; The acquisition unit is configured to, in response to determining that there is no service package matching the service identifier in the service package set, perform the following service package update steps: acquire an instance list matching the service identifier in the production environment; select a service instance from the instance list as a data source instance of the service package according to the execution order of the service instances in the deployment iteration scenario indicated by the instance list; package the data source instance of the service package into a data source instance package, and store it in the service package set; acquire the data source instance package from the service package set as a target service package, wherein the service packages in the preset service package set are generated based on the service instances of the service to be expanded in the production environment; A first determining unit is configured to determine whether the target service package is consistent with a target service instance, wherein the target service instance includes a service instance of the service to be expanded that is currently in the production environment; a generating unit configured to generate, in response to determining that the target service package is consistent with the target service instance, an expanded instance of the service to be expanded based on the target service package; The first updating unit is configured to, in response to determining that the target service package is inconsistent with the target service instance, delete the data source instance package from the service package set; and continue to execute the service package updating step.
10. The device according to claim 9, wherein: The service package has a version number. The first determining unit includes: The first determination module is configured to determine whether a version number corresponding to the target service package is consistent with a version number corresponding to the service package of the target service instance.
11. The device according to claim 9, wherein: The service package includes a service component file set; the first determining unit also includes: A first generating module is configured to select a target number of service component files from the service component file set in the target service program package to generate a set of files to be verified; The second determination module is configured to determine whether the files in the to-be-verified file set are consistent with the component files corresponding to the target service instance.
12. The device according to claim 11, wherein The first generation module comprises: an acquisition submodule configured to acquire file verification information indicating a verification file range; The generating submodule is configured to select a service component file from the service component file set in the target service program package according to the file verification information to generate the set of files to be verified.
13. The device according to claim 9, wherein: The generating unit comprises: A second acquisition module is configured to acquire a list of instances matching the service identifier in the production environment at a current moment as a target instance list; The second generating module is configured to generate an expanded instance of the service to be expanded based on the target service program package and the initial expanded instance in response to determining that there is a service instance matching the target service in the target instance list.
14. The device according to claim 13, wherein: The device also includes: The second updating unit is configured to delete the data source instance package from the service package set in response to determining that there is no instance matching the target service in the target instance list; and continue to execute the service package updating step.
15. The device according to claim 14, wherein: The device also includes: The publishing unit is configured to publish the capacity expansion instance to the production environment in response to generating the capacity expansion instance.
16. The device according to claim 15, wherein: The device also includes: A second determining unit is configured to determine whether the expansion instance in the production environment is consistent with the target service instance; A third determining unit is configured to determine whether there is a service instance matching the target service in the target instance list in response to determining that the expansion instance in the production environment is consistent with the target service instance; a testing unit configured to, in response to determining that there is a service instance matching the target service in the target instance list, run an automated testing program and generate a test result; The sending unit is configured to send information indicating whether the service expansion is completed according to the test result.
17. A server, comprising: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
18. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Realization method of stateful service of container cluster based on domestic CPU and OS
CN108628613A
Method for expanding business network and device
CN109495306A