Project creation method, device, server and storage medium
By creating a container queue in the container management system and using meta-information to quickly obtain and schedule containers, the problem of long time-consuming container creation is solved and the project creation speed and development efficiency are improved.
Patent Information
- Application Number
- CN202210429463.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-22
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2042-04-22
AI Technical Summary
The existing container management system takes a long time to create containers and is limited by network speed, which affects the speed of project creation.
By creating a container queue in the container management system, buffering container creation requirements, and storing meta-information in the container queue, the meta-information is used to quickly obtain and schedule containers to achieve efficient management and scheduling of containers.
It greatly reduces the time waiting for container creation to be completed, improves project creation speed and development efficiency, and improves the reliability of container management.
Smart Images

Figure CN114860203B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a project creation method, device, server and storage medium. Background Art
[0002] Container technology is a virtualization technology that packages the operating environment resources required to run applications (such as libraries, frameworks, and dependencies) into easy-to-port containers, thereby providing an independent, fully functional operating environment for the applications within the container.
[0003] At present, containers required for project development are generally created through container management systems to develop projects based on containers. For example, the container management system can be the open source container automation operation and maintenance platform Kubernetes. Kubernetes receives a container creation request, schedules the nodes it manages, and pulls the container image through the nodes to complete the creation of the container.
[0004] However, in the above technical solution, it takes a long time for Kubernetes to schedule nodes, for nodes to pull container images, and for containers to be created on nodes. In addition, it is limited by the network speed, resulting in slow container creation, which affects the speed of project creation. Summary of the invention
[0005] The present disclosure provides a project creation method, device, server and storage medium, which can effectively improve the speed of project creation. The technical solution of the present disclosure is as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a project creation method is provided, the method comprising:
[0007] Send a container creation request to a container management system, which includes multiple nodes for running containers, and the container provides the environment resources required for the project to run;
[0008] In response to successfully creating a target container in a target node of the container management system, adding meta information of the target container to a container queue, the meta information indicating a location of the target container in the container management system;
[0009] In response to an item creation request for a first item, the first item is created in a target node of the container management system based on the container queue.
[0010] In one possible implementation, the project creation method further includes:
[0011] At every target duration, the number of containers in the container queue is detected;
[0012] When the number of containers is less than the target number, the container creation request is sent to the container management system, and the container creation request instructs the container management system to create a new container.
[0013] In a possible implementation, in response to the project creation request for the first project, creating the first project in the target node of the container management system based on the container queue includes:
[0014] In response to the project creation request, obtaining meta information of the target container from the container queue;
[0015] Based on the meta information of the target container, the first project is created in the target container running in the target node.
[0016] In a possible implementation manner, the meta information of the target container includes the network address of the target node and identification information of the target container;
[0017] The step of creating the first project in the target container running in the target node based on the meta information of the target container includes:
[0018] Based on the network address of the target node, access the target node in the container management system;
[0019] Determine, based on the identification information of the target container, the target container running in the target node;
[0020] The first item is created in the target container.
[0021] In a possible implementation manner, after creating the first project in the target node of the container management system based on the container queue in response to the project creation request for the first project, the method further includes:
[0022] Sending the container creation request to the container management system, wherein the container creation request instructs the container management system to create a new container;
[0023] In response to successfully creating the new container in the container management system, metadata of the new container is added to the container queue.
[0024] In one possible implementation, the project creation method further includes:
[0025] In response to successfully creating a target container in a target node of the container management system, accessing the target container;
[0026] When the target container is accessed successfully, the meta information of the target container is added to the container queue.
[0027] In one possible implementation, the project creation method further includes:
[0028] In the case of failure to access the target container, sending a container deletion instruction to the container management system, where the container deletion instruction is used to instruct the container management system to delete the target container;
[0029] Resend the container creation request to the container management system.
[0030] In a possible implementation, the container queue includes multiple sub-queues, and the sub-queues correspond to container types.
[0031] In a possible implementation, in response to successfully creating a target container in a target node of the container management system, adding the meta information of the target container to the container queue includes:
[0032] In response to successfully creating a target container in a target node of the container management system, determining a container type of the target container;
[0033] Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the container type of the target container;
[0034] Add the meta information of the target container to the target subqueue.
[0035] In a possible implementation, in response to the project creation request for the first project, creating the first project in the target node of the container management system based on the container queue includes:
[0036] Based on the project creation request, determine a target container type corresponding to the first project;
[0037] Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the target container type, the target subqueue including meta information of multiple containers belonging to the target container type;
[0038] Based on the target subqueue, the target container running in the target node and belonging to the target container type is determined, and the first item is created in the target container.
[0039] According to a second aspect of an embodiment of the present disclosure, there is provided a project creation device, the device comprising:
[0040] A sending unit is configured to execute sending a container creation request to a container management system, the container management system includes a plurality of nodes for running containers, and the container provides environmental resources required for running the project;
[0041] an adding unit, configured to, in response to successfully creating a target container in a target node of the container management system, add meta information of the target container to a container queue, the meta information indicating a location of the target container in the container management system;
[0042] The creating unit is configured to execute, in response to a project creation request for the first project, creating the first project in a target node of the container management system based on the container queue.
[0043] In a possible implementation manner, the project creation device further includes:
[0044] A detection unit is configured to detect the number of containers included in the container queue at every target time period;
[0045] The sending unit is further configured to send the container creation request to the container management system when the number of containers is less than the target number, wherein the container creation request instructs the container management system to create a new container.
[0046] In a possible implementation manner, the creation unit includes:
[0047] An information acquisition subunit is configured to execute, in response to the project creation request, acquiring meta information of the target container from the container queue;
[0048] The creation subunit is configured to execute, based on the meta information of the target container, creating the first project in the target container running in the target node.
[0049] In a possible implementation manner, the meta information of the target container includes a network address of the target node and identification information of the target container; and the creation subunit is configured to execute:
[0050] Based on the network address of the target node, access the target node in the container management system;
[0051] Determine, based on the identification information of the target container, the target container running in the target node;
[0052] The first item is created in the target container.
[0053] In a possible implementation manner, the project creation device further includes:
[0054] The sending unit is configured to execute sending the container creation request to the container management system, where the container creation request instructs the container management system to create a new container;
[0055] The adding unit is configured to, in response to successfully creating the new container in the container management system, add the meta information of the new container to the container queue.
[0056] In a possible implementation manner, the project creation device further includes:
[0057] An access unit is configured to execute, in response to successfully creating a target container in a target node of the container management system, accessing the target container;
[0058] The adding unit is configured to add the meta information of the target container to the container queue when the access to the target container is successful.
[0059] In a possible implementation manner, the project creation device further includes:
[0060] a deleting unit, configured to send a container deletion instruction to the container management system when access to the target container fails, wherein the container deletion instruction is used to instruct the container management system to delete the target container;
[0061] The sending unit is configured to resend the container creation request to the container management system.
[0062] In a possible implementation, the container queue includes multiple sub-queues, and the sub-queues correspond to container types.
[0063] In a possible implementation manner, the adding unit is configured to execute:
[0064] In response to successfully creating a target container in a target node of the container management system, determining a container type of the target container;
[0065] Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the container type of the target container;
[0066] Add the meta information of the target container to the target subqueue.
[0067] In one possible implementation, the creation unit is configured to execute:
[0068] Based on the project creation request, determine a target container type corresponding to the first project;
[0069] Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the target container type, the target subqueue including meta information of multiple containers belonging to the target container type;
[0070] Based on the target subqueue, the target container running in the target node and belonging to the target container type is determined, and the first item is created in the target container.
[0071] According to a third aspect of an embodiment of the present disclosure, a server is provided, the server comprising:
[0072] one or more processors;
[0073] A memory for storing program codes executable by the processor;
[0074] The processor is configured to execute the program code to implement the above-mentioned project creation method.
[0075] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, which includes: when the program code in the computer-readable storage medium is executed by a processor of a server, the server is enabled to execute the above-mentioned project creation method.
[0076] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product, comprising a computer program, which implements the above-mentioned project creation method when executed by a processor of a server.
[0077] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0079] Figure 1 is a schematic diagram of an implementation environment of a project creation method according to an exemplary embodiment;
[0080] Figure 2 is a flowchart of a project creation method according to an exemplary embodiment;
[0081] Figure 3 is a flowchart of a project creation method according to an exemplary embodiment;
[0082] Figure 4 is a schematic diagram of a container queue according to an exemplary embodiment;
[0083] Figure 5 is a block diagram of a project creation device according to an exemplary embodiment;
[0084] Figure 6 It is a block diagram of a server according to an exemplary embodiment. DETAILED DESCRIPTION
[0085] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0086] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0087] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions. For example, the container images, code files, etc. involved in this application are all obtained with full authorization.
[0088] Figure 1 This is a schematic diagram of an implementation environment of a project creation method provided by an embodiment of the present disclosure, see Figure 1 The implementation environment includes: a server 110, a terminal 120, a container management system 130 and a container image repository 140.
[0089] Among them, the server 110 provides the terminal 120 with the (remote) container required for project creation, so that the terminal 120 can develop the project in the Cloud IDE (Cloud Integrated Development Environment). The server 110 sends a container creation request to the container management system 130, instructing the container management system 130 to pull the container image from the container image repository 140. The container management system 130 creates the container required for the project operation based on the pulled container image. Based on the project creation request of the terminal 120, the server 110 can obtain the created container to create a project.
[0090] Among them, the container management system 130 includes multiple nodes for running containers. In some embodiments, the container management system 130 includes multiple working nodes 131 for running containers and a control node 132 for managing the multiple working nodes. In this example, the control node 132 of the container management system 130 responds to the container creation request sent by the server 110 and schedules the working node 131 to create the container. Based on the container creation task sent by the control node, the working node 131 pulls the container image from the container image repository 140, creates the container, and starts the created container to an accessible state, that is, starts the created container to a state that can be used to run the project.
[0091] Among them, the container image repository 140 is used to store multiple container images. In some embodiments, the container image repository 140 is a public repository. In this example, the container image repository 140 can be accessed based on the network address of the container image repository 140. Further, based on information such as the name and description of the container image, the required container image can be downloaded from the container image repository 140. In other embodiments, the container image repository 140 is a private repository. In this example, the container image repository 140 needs to be accessed based on corresponding permission information, for example, an account and account password for accessing the container image repository.
[0092] Among them, the container image is a static read-only file that contains the basic resources and configuration information required for the container to run, such as application code, runtime, library, and environment variables. In some embodiments, the container image is an executable software package that encapsulates the application code and its dependencies.
[0093] Among them, the container is a running instance of the container image, and the container can provide the environment resources required for the project to run. In some embodiments, the container includes one or a group of applications and the environment resources required to run the application, such as libraries, frameworks, and dependencies. Multiple containers are isolated from each other, based on which different applications in different containers have independent and fully functional operating environments.
[0094] Among them, the server 110 can be an independent physical server, or a server cluster or distributed file system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms. Optionally, the number of the above-mentioned servers 110 can be more or less, and the embodiments of the present disclosure are not limited to this. Of course, the server 110 can also include other functional servers to provide more comprehensive and diversified services.
[0095] The terminal 120 may run an application that supports the use of the project creation service. The terminal 120 may be at least one of a smart phone, a smart watch, a desktop computer, a laptop, a virtual reality terminal, an augmented reality terminal, a wireless terminal, and a laptop computer. The terminal 120 has a communication function and can communicate with the server 110 to use the project creation service provided by the server 110. The terminal 120 may generally refer to one of a plurality of terminals, and this embodiment is only illustrated by the terminal 120. Those skilled in the art may know that the number of the above terminals may be more or less.
[0096] The container management system 130 may be an independent physical server, or a server cluster or a distributed file system composed of multiple physical servers.
[0097] The server 110 and the terminal 120 and the container management system 130 may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present disclosure.
[0098] Next, based on the implementation environment of the above-mentioned project creation method, the project creation method provided by the embodiment of the present disclosure is introduced. Figure 2 is a flowchart of a project creation method according to an exemplary embodiment. Figure 2 As shown, the method is used in the above server 110, and includes the following steps:
[0099] In step 201, the server sends a container creation request to a container management system, where the container management system includes a plurality of nodes for running containers, and the container provides environmental resources required for running a project.
[0100] The definitions of the container management system, nodes, containers, and environment resources are as follows: Figure 1 The corresponding description is not repeated here.
[0101] In an embodiment of the present disclosure, the server instructs the container management system to create a container by sending a container creation request to the container management system. In some embodiments, the container management system creates a container and starts the created container to an accessible state, that is, starts the created container to a state that can be used to run a project, thereby providing the server with environmental resources that can be directly called and required to run the project.
[0102] In step 202, in response to successfully creating a target container in a target node of the container management system, the server adds meta information of the target container to a container queue, where the meta information indicates a location of the target container in the container management system.
[0103] In the embodiment of the present disclosure, the target node is a working node for running containers in the container management system (see Figure 1 The container management system creates the target container in the target node based on the container creation request, and starts the created target container to a state that can be used to run the project.
[0104] The meta information can be used to describe and retrieve the target container. For example, the network address of the target node where the target container is located, the name of the target container, and the version information of the target container. Optionally, the meta information also includes the acquisition path of the container image corresponding to the target container.
[0105] The container queue is used to store the metadata of the created container. In some embodiments, the container queue is stored in a cache area of the server and can be read and written by the server. In some embodiments, the server receives the metadata of the target container returned by the container management system and adds the metadata of the target container to the container queue.
[0106] It is understandable that the amount of data in the meta information is relatively small compared to the amount of data in the container itself. Therefore, the server only needs to store a small amount of data to accurately determine the target container. Furthermore, by storing the meta information of the created container in the container queue, the server can efficiently manage and schedule multiple created containers.
[0107] In step 203, the server creates the first project in the target node of the container management system based on the container queue in response to the project creation request for the first project.
[0108] The first project refers to: implementing the specified function by running and adjusting the application code in CloudIDE. In the disclosed embodiment, the server responds to the project creation request and provides the first project with the container required for project creation, so that the first project can be created, run and implement subsequent function development in Cloud IDE.
[0109] In the embodiment of the present disclosure, the meta information in the container queue can be used as an index information for obtaining containers that have been created in the container management system. Based on the meta information in the container queue, the server can quickly schedule the target container in the target node to the first project, thereby creating the first project in the target container.
[0110] Through the above technical solution, a container queue is used to buffer container creation needs, so that when developing a project, the created container can be obtained based on the container queue to create a project, which greatly reduces the time spent waiting for the container to be created, effectively improves the speed of project creation, and thus improves the efficiency of project development.
[0111] Above Figure 2 The following is only the basic process of the present disclosure. Figure 1 The implementation environment of the project creation method provided is Figure 2 On the basis of the corresponding embodiments, the technical solution provided by the present disclosure is further explained by introducing the interaction process between the server 110, the terminal 120, the container management system 130 and the container image repository 140. Figure 3 is a flowchart of a project creation method according to an exemplary embodiment. Figure 3 , the method comprising:
[0112] In step 301, the server detects the number of containers included in the container queue at every target time duration.
[0113] The definitions of the container queue and the container refer to steps 201 to 203, which are not described in detail here. It can be understood that the meta information stored in the container queue corresponds to the created container, based on which the number of meta information in the container queue is also the number of containers.
[0114] In some embodiments, the container queue is stored in a cache area of the server, and the server reads the amount of meta information in the container queue from the cache area every target time period.
[0115] In some embodiments, the container queue includes multiple subqueues, which correspond to container types. Among them, different container types correspond to different container functions. For example, the container types include but are not limited to: 1. Business container, used to run applications; 2. Ephemeral container, which can be used to debug and troubleshoot container failures, and can also access processes in other containers. 3. Initial container, which can be used to initialize the required configuration before running the application. 4. Sidecar container, which can be used to perform various auxiliary tasks, such as testing the working status of other containers, downloading or copying files. In some embodiments, different subqueues correspond to different target durations. Optionally, the server can determine the target duration corresponding to each subqueue setting according to the container usage corresponding to various container types. For example, for business containers with high usage frequency, set the number of business containers included in the subqueue corresponding to the business container to be detected every 1 second; for ephemeral containers with a usage frequency lower than that of business containers, set the number of ephemeral containers included in the subqueue corresponding to the ephemeral container to be detected every 3 seconds.
[0116] It should be noted that the above container types are only exemplary, and the embodiments of the present disclosure do not limit the classification method of container types.
[0117] In step 302, when the number of containers is less than the target number, the server sends a container creation request to the container management system.
[0118] The definition of the container management system is as follows: Figure 1 and Figure 2 The description in the corresponding content will not be repeated here.
[0119] The target number may be the length of the container queue. For example, if the length of the container queue is 20, the target number is 20. The target number may also be set according to container usage and the length of the container queue. For example, if the length of the container queue is 20 and the container usage frequency is high, the target number is set to 19. If the container usage frequency is low, the target number is set to 10.
[0120] In some embodiments, the container queue includes multiple subqueues, which correspond to container types. In this example, the server can set corresponding target quantities for each subqueue according to the container usage corresponding to the various container types and the lengths of each subqueue. For example, the length of the subqueue corresponding to the frequently used business container is 20, and the target quantity corresponding to the business container can be set to 15; the length of the subqueue corresponding to the temporary container with a lower usage frequency than the business container is 10, and the target quantity corresponding to the temporary container can be set to 5.
[0121] The container creation request is used to instruct the container management system to create a new container. In some embodiments, the container creation request indicates that the new container to be created is of a default type. In this example, the container creation request indicates that the new containers to be created are all of a default type and have the same default parameters.
[0122] In other embodiments, the container creation request is triggered based on a subqueue corresponding to any container type. In this example, the container creation request carries the container type to instruct the container management system to create a new container of the specified type with specified parameters.
[0123] Through the above technical solution, the problem of insufficient number of containers can be discovered in time, so that the container management system is requested to create new containers to ensure that the number of created containers is sufficient, so that available containers can be provided for the project at any time, thereby improving the reliability of the project creation service.
[0124] Furthermore, multiple sub-queues are set for different container types, so that a suitable target duration can be set according to the container usage corresponding to the container type, thereby timely detecting the insufficient number of containers and saving unnecessary waste of resources.
[0125] In some embodiments, the server can provide project creation services for multiple terminals. Based on this, the server can determine the commonly used container types and commonly used nodes with high frequency of use by analyzing the relevant information of multiple projects corresponding to the multiple terminals, so that the container creation request sent to the container management system carries the information of the commonly used container type and the information of the commonly used node to instruct the container management system to create a new container belonging to the commonly used container type in the commonly used node. Optionally, the commonly used node refers to: a node whose number of uses exceeds a threshold within a preset time period. Among them, using a node includes: using a container in a node to run a project.
[0126] In this example, the server determines the use of nodes by the multiple terminals based on the nodes where the multiple projects corresponding to the multiple terminals are located, thereby determining the commonly used nodes. For example, the multiple terminals correspond to 7 projects, 2 projects corresponding to the multiple terminals are running in node 1, and 5 projects corresponding to the multiple terminals are running in node 2, then node 2 is a commonly used node. The process of determining the commonly used container type is similar to the process of determining the commonly used nodes described above, and will not be repeated here.
[0127] Through the above technical solution, new containers of common types are created in common nodes according to the project operation situation, which can effectively meet the potential needs of project creation and improve the efficiency of project creation.
[0128] In step 303, the control node in the container management system sends a container creation task to the target node in response to the container creation request.
[0129] The definitions of the container management system and control node refer to the above Figure 1 and Figure 2 The description in the corresponding content will not be repeated here.
[0130] In an embodiment of the present disclosure, the container management system includes a plurality of working nodes for running containers and a control node for managing the plurality of working nodes. In some embodiments, the control node determines the target node that can be used to create a container from the plurality of working nodes in response to the container creation request, thereby sending the container creation task to the target node to instruct the target node to create a new node.
[0131] In some embodiments, the container creation request carries a container type, and the control node sends a container creation task for the container type to the target node based on the container creation request to instruct the target node to create a new node belonging to the container type.
[0132] In step 304, the target node pulls the container image of the target container from the container image repository based on the container creation task.
[0133] For details about container image repositories, container images, and the principles of pulling container images, please refer to Figure 1 The corresponding content will not be elaborated here.
[0134] In some embodiments, the target node pulls the container image of the target container from the container image repository based on the container creation task and according to a default container type and default parameters.
[0135] In other embodiments, the target node pulls the container image of the target container from a container image repository based on the container creation task and in accordance with a specified container type and specified parameters.
[0136] In step 305, the target node creates a target container based on the container image of the target container, and returns creation success information to the control node, where the creation success information indicates that the target container is successfully created in the target node of the container management system.
[0137] For the principle of creating containers based on container images, please refer to Figure 1 The corresponding content will not be elaborated here.
[0138] In the embodiment of the present disclosure, the creation success message carries the meta information of the target container. Based on this, the server can obtain the meta information of the target container in response to the creation success message.
[0139] In step 306, the control node returns the creation success information to the server.
[0140] In step 307, in response to the creation success information, the server adds the meta information of the target container to the container queue, and the meta information indicates the location of the target container in the container management system.
[0141] The principle of step 307 and the definition of the meta information can be found in step 202 and will not be described in detail here.
[0142] In the embodiment of the present disclosure, the server can add the meta information of the target container to the container queue in response to the creation success information.
[0143] In some embodiments, the container queue includes multiple subqueues, and the subqueues correspond to container types. In this example, the server determines the container type of the target container in response to the creation success information; then determines the target subqueue corresponding to the container type of the target container from the multiple subqueues of the container queue; and then adds the meta information of the target container to the target subqueue.
[0144] In the above technical solution, using multiple sub-queues to correspond to different container types can effectively reduce the length of the container queue and increase the speed of obtaining meta information from the container queue, thereby further increasing the speed of project creation.
[0145] In some embodiments, the server accesses the target container in response to the creation success information, and if the access to the target container is successful, the meta information of the target container is added to the container queue. In other embodiments, if the access to the target container fails, a container deletion instruction is sent to the container management system, and the container deletion instruction is used to instruct the container management system to delete the target container; based on this, the server re-sends the container creation request to the container management system to instruct the container management system to re-create the target container.
[0146] The above technical solution can avoid the situation where the container is successfully created but cannot be accessed, that is, the container is successfully created but cannot be started to a state where it can be used to run the project, thereby reducing the risk of internal operating failures in the container, thereby improving the reliability of the container, and further improving the reliability of the project creation service provided by the server.
[0147] The above steps 301 to 307 describe a process of creating a container. The server points to multiple created containers based on the container queue. Based on this, the embodiment of the present disclosure provides a schematic diagram of a container queue according to an exemplary embodiment. Figure 4, the server 401 can obtain the created container based on the container queue 402; when the number of containers in the container queue is less than the queue length, the container management system 403 is instructed to create a new container and add the newly created container to the container queue 402.
[0148] On this basis, the server can provide the created container based on the project creation requirements of the terminal. Next, the process of project creation based on the container queue is explained.
[0149] In step 308, the server obtains the meta information of the target container from the container queue in response to the project creation request for the first project.
[0150] The first item refers to step 203 and will not be described in detail here.
[0151] The project creation request is used to request the server to allocate environmental resources required for running the project to the first project. In some embodiments, the multiple created containers included in the container queue are all of default types and have default parameters. In this example, the server responds to the project creation request and obtains the meta information of the target container from the container queue to allocate the target container to the first project for use.
[0152] In some other embodiments, the container queue includes multiple subqueues, and the subqueues correspond to container types. In this example, the project creation request carries the project information of the first project, and the project information includes the container information corresponding to the first project, such as the type of container, the specification parameters of the container, and the number of containers. Based on this, the server determines the target container type corresponding to the first project based on the project creation request; and then determines the target subqueue corresponding to the target container type from the multiple subqueues of the container queue, wherein the target subqueue includes the meta information of multiple containers belonging to the target container type.
[0153] In some other embodiments, the container queue includes multiple subqueues, which correspond to container types. Each subqueue is provided with an allocation weight, which is determined based on the container usage of the container type corresponding to the subqueue. Exemplarily, the server counts the number of times various types of containers are used at regular intervals, and updates the allocation weights of the subqueues corresponding to various types according to the proportion of the number of times various types of containers are used in the total number of times containers are used. Optionally, the allocation weight can be determined based on the container usage corresponding to multiple terminals using the server, and can also be determined based on the container usage corresponding to the terminal that created the project request, which is not limited in the embodiments of the present disclosure.
[0154] In some embodiments, the server can determine the common nodes and common container types corresponding to any terminal based on the project operation status of the terminal, wherein the common nodes corresponding to the terminal refer to: nodes that the terminal has used more than a threshold number of times within a preset time period; the common container types corresponding to the terminal refer to: container types corresponding to containers that the terminal has used more than a threshold number of times within a preset time period. (Refer to the process of determining common nodes and common container types in step 302). Based on this, the server responds to the project creation request for the first project, obtains the common nodes and common container types of the first terminal corresponding to the first project, and thus preferentially schedules the target container belonging to the common container type in the common nodes for the first project.
[0155] Through the above technical solution, the potential demand of each terminal for project creation is analyzed according to the project operation situation, so that personalized services that meet the project creation needs of different users can be provided, further improving the efficiency of project creation.
[0156] In step 309, the server creates the first project in the target container running in the target node based on the meta information of the target container.
[0157] In the disclosed embodiment, the meta information is information determined when the target container is created, and can be used to describe and retrieve the target container. Based on the meta information of the target container, the server can connect to the target container, thereby allocating the target container to the first project. Optionally, the server completes the process of allocating the container by mapping the port of the target container to the port corresponding to the terminal of the first project.
[0158] In some embodiments, the meta information of the target container includes the network address of the target node and the identification information of the target container. Based on the network address of the target node, the server can access the target node in the container management system, thereby determining the target container running in the target node based on the identification information of the target container, and then creating the first project in the target container.
[0159] In some other embodiments, there are multiple containers of different types running on the target node, and the first item corresponds to a container of the target container type. In this example, the server determines the target container of the target container type running on the target node based on the meta information of the target container determined from the target subqueue corresponding to the target container type, thereby creating the first item in the target container.
[0160] In some embodiments, the project creation request carries the project information of the first project, the project information includes the code information of the first project, and the code information indicates the location where the code file corresponding to the first project is stored, for example, the network address of the project warehouse where the code file is stored. The server sends the project information of the first project to the target container, instructing the target container to download the code file corresponding to the first project to the target container, thereby completing the creation of the first project in the target container.
[0161] Through the above technical solution, the creation of the first project can be completed quickly without wasting time waiting for the container to be created, which effectively improves the speed of project creation.
[0162] Furthermore, personalized container allocation for projects can further improve the efficiency of project development.
[0163] In some embodiments, since the creation of the first item occupies the target container, in order to maintain a sufficient number of containers in the container queue, the server sends a container creation request to the container management system to instruct the container management system to create a new container. The process includes the following steps 1 to 2:
[0164] In step 1, the server sends a container creation request to the container management system, where the container creation request instructs the container management system to create a new container.
[0165] The container creation request sent in this step is the same as that in step 302, and will not be described in detail here.
[0166] In step 2, in response to successfully creating the new container in the container management system, the server adds the meta information of the new container to the container queue.
[0167] This step is the same as step 307 and will not be described in detail here.
[0168] In some embodiments, if after executing the above step 1, the server detects that the number of containers in the container queue is less than the target number, the server waits for the container management system to feedback the container creation result, and then detects the number of containers in the container queue again. For example, if a new container is successfully created in the container management system, the server first adds the metadata of the new container to the container queue, and then detects whether the number of containers in the container queue is less than the target number.
[0169] Through the technical solution provided by the embodiments of the present disclosure, a container queue is used to buffer container creation needs, so that when developing a project, the created container can be obtained based on the container queue to create a project, which greatly reduces the time spent waiting for the container to be created, effectively improves the speed of project creation, and thus improves the efficiency of project development.
[0170] Furthermore, by setting sub-queues corresponding to multiple container types, it is possible to flexibly provide a rich set of container options for project creation, which effectively improves the project creation speed while also improving the applicability of the project creation method of the disclosed embodiment to different business scenarios.
[0171] Figure 5 is a block diagram of a project creation device according to an exemplary embodiment. Figure 5 , the device comprises:
[0172] A sending unit 501 is configured to execute sending a container creation request to a container management system, where the container management system includes a plurality of nodes for running containers, and the container provides environment resources required for running a project;
[0173] An adding unit 502 is configured to execute, in response to successfully creating a target container in a target node of the container management system, adding meta information of the target container to a container queue, the meta information indicating a location of the target container in the container management system;
[0174] The creating unit 503 is configured to execute, in response to a project creation request for the first project, creating the first project in a target node of the container management system based on the container queue.
[0175] In a possible implementation manner, the project creation device further includes:
[0176] A detection unit is configured to detect the number of containers included in the container queue at every target time period;
[0177] The sending unit is further configured to send the container creation request to the container management system when the number of containers is less than the target number, wherein the container creation request instructs the container management system to create a new container.
[0178] In a possible implementation manner, the creating unit 503 includes:
[0179] An information acquisition subunit is configured to execute, in response to the project creation request, acquiring meta information of the target container from the container queue;
[0180] The creation subunit is configured to execute, based on the meta information of the target container, creating the first project in the target container running in the target node.
[0181] In a possible implementation manner, the meta information of the target container includes a network address of the target node and identification information of the target container; and the creation subunit is configured to execute:
[0182] Based on the network address of the target node, access the target node in the container management system;
[0183] Determine, based on the identification information of the target container, the target container running in the target node;
[0184] The first item is created in the target container.
[0185] In a possible implementation manner, the project creation device further includes:
[0186] The sending unit 501 is configured to execute sending the container creation request to the container management system, where the container creation request instructs the container management system to create a new container;
[0187] The adding unit 502 is configured to execute, in response to successfully creating the new container in the container management system, adding the meta information of the new container to the container queue.
[0188] In a possible implementation manner, the project creation device further includes:
[0189] An access unit is configured to execute, in response to successfully creating a target container in a target node of the container management system, accessing the target container;
[0190] The adding unit 502 is configured to add the meta information of the target container to the container queue when the access to the target container is successful.
[0191] In a possible implementation manner, the project creation device further includes:
[0192] a deleting unit, configured to send a container deletion instruction to the container management system when access to the target container fails, wherein the container deletion instruction is used to instruct the container management system to delete the target container;
[0193] The sending unit 501 is configured to resend the container creation request to the container management system.
[0194] In a possible implementation, the container queue includes multiple sub-queues, and the sub-queues correspond to container types.
[0195] In a possible implementation manner, the adding unit 502 is configured to execute:
[0196] In response to successfully creating a target container in a target node of the container management system, determining a container type of the target container;
[0197] Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the container type of the target container;
[0198] Add the meta information of the target container to the target subqueue.
[0199] In a possible implementation manner, the creating unit 503 is configured to execute:
[0200] Based on the project creation request, determine a target container type corresponding to the first project;
[0201] Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the target container type, the target subqueue including meta information of multiple containers belonging to the target container type;
[0202] Based on the target subqueue, the target container running in the target node and belonging to the target container type is determined, and the first item is created in the target container.
[0203] Through the technical solution provided by the embodiments of the present disclosure, a container queue is used to buffer container creation needs, so that when developing a project, the created container can be obtained based on the container queue to create a project, which greatly reduces the time spent waiting for the container to be created, effectively improves the speed of project creation, and thus improves the efficiency of project development.
[0204] It should be noted that: the project creation device provided in the above embodiment only uses the division of the above functional modules as an example when creating a project. In actual applications, the above functional distribution can be completed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the project creation device provided in the above embodiment and the project creation method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0205] Figure 6 It is a block diagram of a server according to an exemplary embodiment. The server 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 601 and one or more memories 602, wherein the one or more memories 602 store at least one program code, and the at least one program code is loaded and executed by the one or more processors 601 to implement the process executed by the server in the project creation method provided by the above-mentioned various method embodiments. Of course, the server 600 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 600 may also include other components for implementing device functions, which will not be described in detail here.
[0206] In an exemplary embodiment, a computer-readable storage medium including a program code is also provided, such as a memory 602 including the program code, and the program code can be executed by a processor 601 of a server 600 to complete the project creation method. Optionally, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact-disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0207] In an exemplary embodiment, a computer program product is also provided, including a computer program, which implements the above-mentioned project creation method when executed by a processor.
[0208] In some embodiments, the computer program involved in the embodiments of the present disclosure may be deployed and executed on a computer device, or on multiple computer devices located at one location, or on multiple computer devices distributed at multiple locations and interconnected by a communication network. Multiple computer devices distributed at multiple locations and interconnected by a communication network may constitute a blockchain system.
[0209] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0210] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A project creation method, It is characterized in that The method comprises: Sending a container creation request to a container management system, wherein the container management system includes multiple nodes for running containers, and the container provides environmental resources required for project operation; In response to successfully creating a target container in a target node of the container management system, adding meta information of the target container to a container queue, the meta information indicating a location of the target container in the container management system; In response to a project creation request for a first project, creating the first project in a target node of the container management system based on the container queue; In response to the project creation request for the first project, creating the first project in the target node of the container management system based on the container queue includes: In response to the project creation request, obtaining meta information of the target container from the container queue; Based on the meta information of the target container, connect to the target container running in the target node, and create the first project in the target container.
2. The project creation method according to claim 1, It is characterized in that The method further comprises: At every target time duration, detecting the number of containers included in the container queue; When the number of containers is less than the target number, the container creation request is sent to the container management system, wherein the container creation request instructs the container management system to create a new container.
3. The project creation method according to claim 1, It is characterized in that The meta information of the target container includes the network address of the target node and the identification information of the target container; The step of connecting to the target container running in the target node based on the meta information of the target container, and creating the first project in the target container includes: Accessing the target node in the container management system based on the network address of the target node; Determine the target container running in the target node based on the identification information of the target container; The first item is created in the target container.
4. The project creation method according to claim 1, It is characterized in that After creating the first project in the target node of the container management system based on the container queue in response to the project creation request for the first project, the method further includes: Sending the container creation request to the container management system, wherein the container creation request instructs the container management system to create a new container; In response to successfully creating the new container in the container management system, adding metadata of the new container to the container queue.
5. The project creation method according to claim 1, It is characterized in that The method further comprises: In response to successfully creating the target container in the target node of the container management system, accessing the target container; When the target container is accessed successfully, the meta information of the target container is added to the container queue.
6. The project creation method according to claim 5, It is characterized in that The method further comprises: In the case of failure to access the target container, sending a container deletion instruction to the container management system, wherein the container deletion instruction is used to instruct the container management system to delete the target container; Resend the container creation request to the container management system.
7. The project creation method according to claim 1, It is characterized in that The container queue includes a plurality of sub-queues, and the sub-queues correspond to container types.
8. The project creation method according to claim 7, It is characterized in that In response to successfully creating a target container in a target node of the container management system, adding the meta information of the target container to a container queue includes: In response to successfully creating the target container in the target node of the container management system, determining a container type of the target container; Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the container type of the target container; The meta information of the target container is added to the target sub-queue.
9. The project creation method according to claim 7, It is characterized in that In response to the project creation request for the first project, creating the first project in the target node of the container management system based on the container queue includes: Based on the project creation request, determining a target container type corresponding to the first project; Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the target container type, the target subqueue including meta information of multiple containers belonging to the target container type; Based on the target subqueue, the target container running in the target node and belonging to the target container type is determined, and the first item is created in the target container.
10. A project creation device, It is characterized in that The device comprises: A sending unit is configured to execute sending a container creation request to a container management system, wherein the container management system includes a plurality of nodes for running containers, and the containers provide environmental resources required for project operation; an adding unit, configured to, in response to successfully creating a target container in a target node of the container management system, add meta information of the target container to a container queue, wherein the meta information indicates a location of the target container in the container management system; a creating unit configured to execute, in response to a project creation request for a first project, creating the first project in a target node of the container management system based on the container queue; The creation unit comprises: an information acquisition subunit, configured to execute, in response to the project creation request, acquiring meta information of the target container from the container queue; The creation subunit is configured to execute, based on the meta information of the target container, connecting to the target container running in the target node, and creating the first project in the target container.
11. The project creation device according to claim 10, It is characterized in that The device also includes: A detection unit is configured to detect the number of containers included in the container queue every target time period; The sending unit is further configured to send the container creation request to the container management system when the number of containers is less than the target number, wherein the container creation request instructs the container management system to create a new container.
12. The project creation device according to claim 10, It is characterized in that The meta information of the target container includes the network address of the target node and the identification information of the target container; the creation subunit is configured to execute: Accessing the target node in the container management system based on the network address of the target node; Determine the target container running in the target node based on the identification information of the target container; The first item is created in the target container.
13. The project creation device according to claim 10, It is characterized in that The device also includes: The sending unit is configured to send the container creation request to the container management system, where the container creation request instructs the container management system to create a new container; The adding unit is configured to add the meta information of the new container to the container queue in response to successfully creating the new container in the container management system.
14. The project creation device according to claim 10, It is characterized in that The device also includes: An access unit configured to access the target container in response to successfully creating the target container in a target node of the container management system; The adding unit is configured to add the meta information of the target container to the container queue if the access to the target container is successful.
15. The project creation device according to claim 14, It is characterized in that The device also includes: a deleting unit, configured to send a container deletion instruction to the container management system when access to the target container fails, wherein the container deletion instruction is used to instruct the container management system to delete the target container; The sending unit is configured to resend the container creation request to the container management system.
16. The project creation device according to claim 10, It is characterized in that The container queue includes a plurality of sub-queues, and the sub-queues correspond to container types.
17. The project creation device according to claim 16, It is characterized in that The adding unit is configured to perform: In response to successfully creating the target container in the target node of the container management system, determining a container type of the target container; Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the container type of the target container; The meta information of the target container is added to the target sub-queue.
18. The project creation device according to claim 16, It is characterized in that The creation unit is configured to execute: Based on the project creation request, determining a target container type corresponding to the first project; Determine, from the multiple subqueues of the container queue, a target subqueue corresponding to the target container type, the target subqueue including meta information of multiple containers belonging to the target container type; Based on the target subqueue, the target container running in the target node and belonging to the target container type is determined, and the first item is created in the target container.
19. A server, It is characterized in that The server comprises: one or more processors; a memory for storing program code executable by the processor; The processor is configured to execute the program code to implement the project creation method according to any one of claims 1 to 9.
20. A computer-readable storage medium, It is characterized in that When the program code in the computer-readable storage medium is executed by a processor of a server, the server is enabled to execute the project creation method according to any one of claims 1 to 9.
21. A computer program product, It is characterized in that The invention comprises a computer program, which implements the project creation method according to any one of claims 1 to 9 when being executed by a processor.
