Resource management method and device for cloud simulation engine

By building HTTP management services, using resource state lists to optimize the startup process of the cloud simulation engine, the problem of long startup time of the cloud simulation engine is solved, and rapid acquisition and startup are achieved, and user experience is improved.

CN119201348AActive Publication Date: 2024-12-27BEIJING GLOBAL CROWN JINYANG TECH DEV CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411350740.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-12-27
Estimated Expiration
2044-09-26

AI Technical Summary

Technical Problem

The existing cloud simulation engine has a long startup time, resulting in poor user experience.

Method used

By building HTTP management services, using the warm-up state resource list, the stop state resource list and the running state resource list, the quick acquisition and startup of SEs is achieved, ensuring that SEs are always in the warm-up state, thereby shortening the startup time.

Benefits of technology

Reducing the acquisition and startup time of SE to milliseconds, significantly improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201348A_ABST
    Figure CN119201348A_ABST
Patent Text Reader

Abstract

The invention provides a resource management method and device for a cloud simulation engine, and the method proposes the construction of an HTTP management service which is used for obtaining an SE, firstly obtaining the SE from a preheating state resource list, adding the SE into a running state resource list to start the SE, and if no available SE exists in the preheating state resource list, starting the SE; if yes, obtaining the SE from the stop state resource list, moving the SE into the preheating state resource list and then starting the SE; if the SE does not exist in the stop state resource list, a new SE is started, and the new SE is moved into the preheating state resource list to be started again. According to the method and the device, the SE is quickly acquired by controlling that the SE of the designated station is always in the preheating state (that is, the SEs in the preheating state resource list are all the preheating state SEs). The SE requesting operation and the SE starting operation are converted into the synchronous operation, so that the SE obtaining time is shortened to a millisecond level, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer simulation technology, and in particular to a resource management method and device for a cloud simulation engine. Background Art

[0002] A simulation software is usually divided into two main parts: model building and simulation calculation (hereinafter referred to as SE (Simulation Engine)). It can be simply understood as front-end editing and back-end computing services. The workflow is as follows: First, the user creates and configures the simulation model in the model building software. Then, the model building software will parse out the key information required in the model and pass this information to SE. SE then searches the hard disk for the required files based on the parsed path and uses the algorithms or data in the files for simulation calculations. The calculation results will be returned to the model building software for further analysis and display.

[0003] In order to realize simulation more quickly and display simulation results conveniently, it is currently proposed to place SE in the cloud to utilize the large amount of resources in the cloud service for large-scale simulation. At the same time, SE can be dynamically turned on when it is needed and quickly turned off when it is not in use.

[0004] However, it currently takes a long time to turn on SE, resulting in a poor user experience. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a resource management method and device for a cloud simulation engine to solve the problem of a long waiting time required to start a SE.

[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0007] A first aspect of the present invention discloses a resource management method for a cloud simulation engine, the method comprising:

[0008] When receiving a first request to run a cloud simulation engine, determining whether the total number of resources in the configuration file is greater than or equal to the number of preheated resources in the configuration file; wherein the resources include the cloud simulation engine; the total number of resources is the number of cloud simulation engines that can be started; the preheated number of resources is the number of cloud simulation engines in a preheated state;

[0009] If it is greater than or equal to, refresh the status of all resources in the cache database, and obtain a preheating state resource list, a stop state resource list, and a running state resource list from the cache database;

[0010] Calculate the sum of the quantities of all resources included in the preheating state resource list, the stopped state resource list and the running state resource list to obtain the target resource quantity; wherein the preheating state resource list includes the resources in the preheating state, the stopped state resource list includes the resources in the stopped state, and the running state resource list includes the resources in the running state;

[0011] If the target resource quantity is not greater than the total resource quantity, or the quantity of the resources included in the preheating state resource list is greater than 0, and / or the quantity of the resources included in the stop state resource list is greater than 0, extracting a user ID from the first request;

[0012] If the number of the resources included in the preheating state resource list is greater than 0, obtaining resources from the preheating state resource list according to the first request and marking them as target resources;

[0013] Parsing the target resource to obtain application programming interface information corresponding to the target resource;

[0014] Writing the user ID into the application programming interface information corresponding to the target resource and storing it in the running status resource list;

[0015] If the number of the resources included in the preheating state resource list is 0, but the number of the resources included in the stopped state resource list is greater than 0, resources are obtained from the stopped state resource list, marked as resources to be started, and the resources to be started are stored in the preheating state resource list, and the step of returning to execute if the number of the resources included in the preheating state resource list is greater than 0, obtaining resources from the preheating state resource list according to the first request and marking them as target resources is performed;

[0016] If the number of the resources included in the preheating state resource list is 0, and the number of the resources included in the stopped state resource list is 0, but the target resource number is not greater than the total resource number, new resources are opened based on the cache database, and the new resources are stored in the preheating state resource list, and the step of obtaining resources from the preheating state resource list and marking them as target resources according to the first request is returned to execute if the number of the resources included in the preheating state resource list is greater than 0.

[0017] Preferably, refreshing the status of all resources in the cache database includes:

[0018] Obtain a list of preheating state resources, a list of stopped state resources, a list of running state resources, and a refresh time identifier from the cache database;

[0019] Calculate the sum of the quantities of all resources in the preheating state resource list, the stopped state resource list, and the running state resource list to obtain a resource count quantity;

[0020] When the number of preheating resources is greater than the number of resources in the preheating state resource list, and the number of resources in the stopped state resource list is greater than 0, extracting resources from the stopped state resource list based on the refresh time identifier and adding them to the preheating state resource list;

[0021] When the number of preheating resources is greater than the number of resources in the preheating state resource list, and the number of resources in the stop state resource list is 0, determining whether the total number of resources is greater than the resource count number;

[0022] If the total number of resources is greater than the resource count number, constructing new resources based on the cache database, and storing the new resources in the preheating state resource list based on the refresh time identifier;

[0023] When the number of the preheating resources is not greater than the number of the resources in the preheating state resource list, the refresh process ends.

[0024] Preferably, obtaining a refresh time identifier from the cache database includes:

[0025] Obtain a refresh time identifier from the cache database;

[0026] If the refresh time identifier does not exist in the cache database, a new refresh time identifier is obtained based on the K8S service, and the expiration time of the new refresh time identifier is set;

[0027] The new refresh time identifier after the set expiration time is stored in the cache database, and the process returns to execute the step of obtaining the refresh time identifier from the cache database.

[0028] Preferably, the opening of the new resource based on the cache database and storing the new resource in the preheating state resource list includes:

[0029] Initialize an empty port array, and obtain the number of the resources that need to be run from the first request;

[0030] According to the number, n unused ports are obtained from the cache database and added to the port array, where n is the number of ports required for one resource;

[0031] Mark the port in the port array as a used port;

[0032] Based on the port array and K8S service, the number of the resources is enabled and the new resources are added to the preheated state resource list.

[0033] Preferably, the method further comprises:

[0034] When receiving a second request to stop using the cloud simulation engine, obtaining a resource ID in the second request;

[0035] Determine whether the number of resources in the current preheating state resource list is less than the number of preheating resources;

[0036] If it is less than, searching the resource corresponding to the resource ID from the running status resource list;

[0037] Deleting the resource corresponding to the resource ID from the running state resource list, and adding the resource corresponding to the resource ID to the preheating state resource list;

[0038] If it is not less than, searching the resource corresponding to the resource ID from the running status resource list;

[0039] Send a stop command to the K8S service to stop the resource corresponding to the resource ID;

[0040] When the resource corresponding to the resource ID is stopped successfully, the resource corresponding to the resource ID is deleted from the running state resource list, and the resource corresponding to the resource ID is added to the stopped state resource list.

[0041] Preferably, the method further comprises:

[0042] Periodically parsing all resources in the running status resource list to obtain target application programming interface information corresponding to each resource in the running status resource list;

[0043] For each target application programming interface information, obtaining the configuration time in the target application programming interface information;

[0044] Calculate the time difference between the current time and the configured time;

[0045] If the time difference is greater than the time threshold, the resource corresponding to the current time difference is deleted from the running state resource list, and is added to the stopped state resource list.

[0046] A second aspect of the present invention discloses a resource management device for a cloud simulation engine, the device comprising:

[0047] A judgment unit, configured to judge whether the total number of resources in the configuration file is greater than or equal to the number of preheated resources in the configuration file when receiving a first request to run the cloud simulation engine; wherein the resources include the cloud simulation engine; the total number of resources is the number of cloud simulation engines that can be started; and the preheated number of resources is the number of cloud simulation engines in a preheated state;

[0048] A first acquisition unit is used to refresh the status of all resources in the cache database if it is greater than or equal to, and acquire a preheating state resource list, a stop state resource list, and a running state resource list from the cache database;

[0049] A calculation unit, configured to calculate the sum of the quantities of all resources included in the preheating state resource list, the stopped state resource list, and the running state resource list to obtain a target resource quantity; wherein the preheating state resource list includes the resources in the preheating state, the stopped state resource list includes the resources in the stopped state, and the running state resource list includes the resources in the running state;

[0050] an extracting unit, configured to extract a user ID from the first request if the target resource quantity is not greater than the total resource quantity, or the quantity of the resources included in the preheating state resource list is greater than 0, and / or the quantity of the resources included in the stop state resource list is greater than 0;

[0051] A second acquisition unit, configured to acquire resources from the preheating state resource list according to the first request and mark them as target resources if the number of the resources included in the preheating state resource list is greater than 0;

[0052] A parsing unit, used for parsing the target resource to obtain application programming interface information corresponding to the target resource;

[0053] A storage unit, used to write the user ID into the application programming interface information corresponding to the target resource, and store it in the running status resource list;

[0054] a third acquisition unit, configured to, if the number of the resources included in the preheating state resource list is 0, but the number of the resources included in the stopped state resource list is greater than 0, acquire resources from the stopped state resource list, mark them as resources to be started, store the resources to be started in the preheating state resource list, and return to execute the second acquisition unit;

[0055] The fourth acquisition unit is used to open new resources based on the cache database if the number of the resources included in the preheating state resource list is 0, and the number of the resources included in the stopped state resource list is 0, but the target resource number is not greater than the total resource number, and store the new resources in the preheating state resource list, and return to execute the second acquisition unit.

[0056] Preferably, the first acquisition unit includes:

[0057] An acquisition module is used to obtain a preheating state resource list, a stop state resource list, a running state resource list and a refresh time identifier from a cache database;

[0058] A calculation module, used to calculate the sum of the quantities of all resources in the preheating state resource list, the stopped state resource list and the running state resource list to obtain a resource count quantity;

[0059] An extraction module, configured to extract resources from the stop state resource list and add them to the preheat state resource list based on the refresh time identifier when the number of the preheating resources is greater than the number of resources in the preheating state resource list and the number of resources in the stop state resource list is greater than 0;

[0060] A judging module, configured to judge whether the total resource quantity is greater than the resource count quantity when the number of the preheating resources is greater than the number of the resources in the preheating state resource list and the number of the resources in the stop state resource list is 0;

[0061] A storage module, configured to construct new resources based on the cache database if the total number of resources is greater than the resource count number, and store the new resources in the preheating state resource list based on the refresh time identifier;

[0062] The end module is used to end the refresh process when the number of the preheating resources is not greater than the number of the resources in the preheating state resource list.

[0063] Preferably, the acquisition module includes:

[0064] An acquisition submodule, used to acquire a refresh time identifier from the cache database;

[0065] A submodule is set to obtain a new refresh time identifier based on the K8S service if the refresh time identifier does not exist in the cache database, and to set an expiration time of the new refresh time identifier;

[0066] The storage submodule is used to store the new refresh time identifier after the set expiration time into the cache database, and return to execute the acquisition submodule.

[0067] Preferably, the fourth obtaining unit includes:

[0068] An initialization module, used for initializing an empty port array and obtaining the number of the resources to be run from the first request;

[0069] A first adding module is used to obtain n unused ports from the cache database according to the number and add them to the port array, where n is the number of ports required for one resource;

[0070] A marking module, used for marking the ports in the port array as used ports;

[0071] The second adding module is used to enable the number of the resources based on the port array and the K8S service and add the new resources to the preheating state resource list.

[0072] Based on the above-mentioned embodiment of the present invention, a resource management method and device for a cloud simulation engine are provided. The method proposes to build an HTTP management service for obtaining SE. First, SE is obtained from the preheating state resource list and added to the running state resource list to turn on SE. If there is no available SE in the preheating state resource list, SE is obtained from the stopped state resource list and moved into the preheating state resource list and then turned on; if there is no SE in the stopped state resource list, a new SE is turned on and moved into the preheating state resource list and then turned on. The present invention realizes the rapid acquisition of SE by controlling that a designated SE is always in the preheating state (that is, all SEs in the preheating state resource list are preheating state SEs). Requesting SE and turning on SE are converted into synchronous operations, so that the time to obtain SE is shortened to milliseconds, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0074] Figure 1 A flow chart of a resource management method for a cloud simulation engine provided by an embodiment of the present invention;

[0075] Figure 2A flowchart of refreshing the status of all resources in a cache database provided by an embodiment of the present invention;

[0076] Figure 3 A flowchart of returning SE provided by an embodiment of the present invention;

[0077] Figure 4 A flowchart of a timing method provided by an embodiment of the present invention;

[0078] Figure 5 A structural block diagram of a resource management device for a cloud simulation engine provided in an embodiment of the present invention. DETAILED DESCRIPTION

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

[0080] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0081] As can be seen from the background technology, by deploying SE to the cloud, you can use the almost unlimited resources provided by cloud services to perform large-scale, parallel offline simulations, and summarize and store the simulation results, thereby achieving fast simulation and convenient display. Based on the services and tariffs of cloud service providers, you can use the K8S architecture to orchestrate Docker and encapsulate SE as a Docker image. This method supports dynamically turning on SE when business needs it (charged by the second) and quickly turning it off when not in use (free of charge), effectively avoiding waste of resources, and can support the simultaneous opening of thousands or even tens of thousands of SEs.

[0082] However, the current challenge is that the startup time of SE is about 8-10 seconds, which directly affects the user experience.

[0083] Therefore, an embodiment of the present invention provides a resource management method and device for a cloud simulation engine. The method proposes to construct an HTTP management service for obtaining SE. First, SE is obtained from a preheating state resource list and added to a running state resource list to enable SE. If there is no available SE in the preheating state resource list, SE is obtained from a stopped state resource list and moved into the preheating state resource list and then enabled. If there is no SE in the stopped state resource list, a new SE is enabled and moved into the preheating state resource list and then enabled. The present invention achieves rapid acquisition of SE by controlling that a designated SE is always in a preheating state (i.e., all SEs in the preheating state resource list are preheating state SEs). Requesting SE and enabling SE are converted into synchronous operations, so that the time to obtain SE is shortened to milliseconds, thereby improving user experience.

[0084] See also Figure 1 , showing a flow chart of a resource management method for a cloud simulation engine provided by an embodiment of the present invention.

[0085] It should be noted that in cloud services, Docker is an open source container platform for automating the deployment, expansion and management of applications. Generally, there are more than ten states of Docker, and the states involved in this solution include: stopped - free of charge; stopped; running - charged; deleted - free of charge; the maximum number of enabled (i.e. the total number of resources described below); preheating number (i.e. the number of preheating resources described below).

[0086] The embodiment of the present invention aims to construct an HTTP management service, which provides two interfaces, namely, an SE acquisition interface and a SE return interface. The HTTP management service realizes the rapid operation of SE by controlling a designated SE to be in a preheating state (ie, SE is not performing simulation).

[0087] In the embodiment of the present invention, a total of 6 data variables are recorded (these data variables are stored in the cache database (redis)), as follows:

[0088] token (refresh time identifier)--expires after a specified time. When it expires, the variable is refreshed through the corresponding refresh method; token refers to the credential for the HTTP management service to access the k8s service. The k8s service will receive instructions from the HTTP management service only after the token is successfully verified;

[0089] Standby - a machine that is in operation (i.e., executing simulation);

[0090] stopped - a machine in a stopped state;

[0091] engaged - a machine in the warm-up state (i.e. not performing simulation);

[0092] count--the sum of standby+stopped+engaged;

[0093] usedPorts--Ports already in use.

[0094] The resource management method of the cloud simulation engine is the 'getSe' method mentioned below, which includes:

[0095] It should be noted that the 'getSe' method is used to obtain an available computing resource (SE), and this method implements resource allocation and management by calling a cache database and some auxiliary functions.

[0096] Step S101: When receiving the first request to run the cloud simulation engine, determine whether the total number of resources in the configuration file is greater than or equal to the number of preheating resources in the configuration file. If the total number of resources in the configuration file is greater than or equal to the number of preheating resources in the configuration file, execute step S102; if the total number of resources in the configuration file is less than the number of preheating resources in the configuration file, end the process.

[0097] Among them, resources include cloud simulation engines; the total number of resources is the number of cloud simulation engines that can be turned on; the number of preheating resources is the number of cloud simulation engines in the preheating state.

[0098] It is understandable that the total resource quantity and the preheated resource quantity are pre-written into the configuration file. The first request is used to request to run a cloud simulation engine, and the first request usually includes the number of cloud simulation engines to be run, indicating how many cloud simulation engines the user needs to run.

[0099] In the specific implementation of step S101, when receiving the first request sent by the user through the front end, it is determined whether the total number of resources in the configuration file is greater than or equal to the number of preheated resources. If the total number of resources in the configuration file is greater than or equal to the number of preheated resources, step S102 is executed; if the total number of resources in the configuration file is less than the number of preheated resources, it indicates that the number of resources that can be opened is insufficient, and the process ends.

[0100] The following further describes step S101 with reference to an example:

[0101] Step S101 can be regarded as the first step in the 'getSe' method: initial verification. The following is a detailed logical description of the first step in the 'getSe' method (process A1-process A3).

[0102] Process A1: Determine whether the total resource quantity ('seCfg.totalAmount') in the configuration file (seCfg) is greater than or equal to the preheating resource quantity ('seCfg.standbyAmount').

[0103] Process A2: If the conditions are not met, the status code '13002' is returned, indicating that the number of resources is insufficient, and the method ends.

[0104] Process A3: If the conditions are met, execute step S102.

[0105] It should be noted that ses is the resource (SE) status obtained from the cache database.

[0106] Step S102: If it is greater than or equal to, refresh the status of all resources in the cache database, and obtain a preheating state resource list, a stop state resource list, and a running state resource list from the cache database.

[0107] In the process of implementing step S102, when the total number of resources in the configuration file is greater than or equal to the number of preheated resources, the status of all resources in the cache database is refreshed, and a preheated state resource list (i.e., the 'seStandby' collection in the following content), a stopped state resource list (i.e., the 'seStopped' collection), and an running state resource list (i.e., the 'seEngaged' collection) are obtained from the cache database.

[0108] It is understandable that the 'seStandby' collection, 'seStopped' collection, 'seEngaged' collection, and 'usedPorts' collection in the cache database are stored in a set manner, which ensures that each element in the collection is unique.

[0109] Take the 'seEngaged' collection as an example. The information of one element (i.e. a resource being simulated) is composed of: 'SEID:IP:PORT1:PORT2:OSK:USER_ID:TIMESTAMP', where multiple segments are separated by ':'. The meaning of each segment is:

[0110] SE ID. By operating this ID, you can find SE related information;

[0111] IP of SE;

[0112] SE's port 1, which may provide http service;

[0113] SE's port 2, which may provide websocket services. You can directly access different services provided by SE through ip+port 1 / port 2;

[0114] OSK, when notifying SE to start, generates a one-time connection password and informs SE and the front end at the same time. When the front end connects to SE, it uses OSK for authentication;

[0115] USER_ID, records the user ID that starts this SE;

[0116] TIMESTAMP, the time of startup. In many places of the embodiment of the present invention, whether to stop the SE is determined by judging whether this time has expired.

[0117] It should be noted that the specific implementation method of refreshing the status of all resources in the cache database is detailed in the following embodiments of the present invention. Figure 2 Refreshing the state of all resources in the cache database can be considered as the second step in the 'getSe' method, namely the 'flushSe' method.

[0118] Step S103: Calculate the total number of all resources included in the preheating state resource list, the stopped state resource list, and the running state resource list to obtain the target resource number.

[0119] The preheating state resource list includes resources in the preheating state, the stopping state resource list includes resources in the stopping state, and the running state resource list includes resources in the running state.

[0120] In the specific implementation of step S103, the number of all resources included in the preheating state resource list is obtained, the number of all resources included in the stop state resource list is obtained, the number of all resources included in the running state resource list is obtained, and the sum of these numbers is calculated to obtain the target resource number.

[0121] The following further describes step S102 and step S103 with reference to an example:

[0122] Step S102 and step S103 can be regarded as the third step in the 'getSe' method: obtaining the current SE state, namely the 'getSes' method. The following is a detailed logical description of the 'getSes' method (process B1-process B6).

[0123] Process B1: Get the member list of the 'seStandby' collection from the cache database.

[0124] Process B2: Get the member list of the 'seStopped' collection from the cache database.

[0125] Process B3: Get the member list of the 'seEngaged' collection from the cache database.

[0126] Procedure B4: Calculate the number of 'ses.standbyCount', 'ses.stoppedCount' and 'ses.engagedCount'. That is, calculate the number of all resources included in the 'seStandby' collection, the number of all resources included in the 'seStopped' collection, and the number of all resources included in the 'seEngaged' collection.

[0127] Procedure B5: Store the total ('ses.standbyCount+ses.stoppedCount+ses.engagedCount') into the 'seCount' key of the cache database. The total is also 'ses.totalCount'.

[0128] Procedure B6: Returns an object containing all lists and counts.

[0129] Step S104: If the target resource quantity is not greater than the total resource quantity, or the quantity of resources included in the preheating state resource list is greater than 0, and / or the quantity of resources included in the stop state resource list is greater than 0, extract the user ID from the first request.

[0130] It should be noted that before step S104, it is necessary to determine whether the target resource quantity is not greater than the total resource quantity, and determine whether the quantity of resources included in the preheating state resource list and the quantity of resources included in the stop state resource list are both 0.

[0131] If the target resource quantity is greater than or equal to the total resource quantity, and the number of resources included in the preheating state resource list and the number of resources included in the stop state resource list are both 0, it means that there are no available resources (the SE resources returned in the 'getSe' method have reached the upper limit) and the process ends.

[0132] In the specific implementation of step S104, if the target resource quantity is not greater than the total resource quantity, or the number of resources included in the preheating state resource list is greater than 0, and / or the number of resources included in the stop state resource list is greater than 0, the user ID is extracted from the first request.

[0133] The following further describes step S104 with reference to an example:

[0134] Step S104 can be regarded as the fourth step in the 'getSe' method: verifying the resource quantity and obtaining the user ID. The following is a detailed logical description of the fourth step in the 'getSe' method (process C1-process C3).

[0135] Procedure C1: Checks if 'ses.totalCount' is greater than or equal to 'seCfg.totalAmount' and if 'ses.standbyCount' and 'ses.stoppedCount' are both 0.

[0136] It should be noted that, in theory, 'ses.totalCount' will not be greater than 'seCfg.totalAmount', but distributed deployment or other unpredictable problems may cause 'ses.totalCount' to be greater than 'seCfg.totalAmount'. Once this problem occurs, the HTTP management service will loop verification indefinitely and start SE.

[0137] Process C2: If the conditions are met, it returns that the SE resources have reached the upper limit, indicating that there are no available resources and the method ends.

[0138] Process C3: If the condition is not met, that is, 'ses.totalCount' is not greater than 'seCfg.totalAmount', or 'ses.standbyCount' is greater than 0, and / or 'ses.stoppedCount' is greater than 0. Then extract the user ID from 'ctx' of the first request. Here it is hard-coded as 'null', and in actual applications it is extracted from 'ctx'.

[0139] It should be noted that the extracted user ID is used to pass the user ID to the SE that is about to perform simulation. The simulation result of the SE will write the user ID into the cache database together to indicate which user ID completed the simulation.

[0140] Step S105: If the number of resources included in the preheating state resource list is greater than 0, a resource is obtained from the preheating state resource list according to the first request and marked as a target resource.

[0141] In the specific implementation of step S105, if the number of resources included in the preheating state resource list is greater than 0, the number of resources to be run (denoted as amount) is obtained from the first request, and amount resources are obtained from the preheating state resource list and marked as target resources.

[0142] Step S106: parse the target resource to obtain the application programming interface information corresponding to the target resource.

[0143] It should be noted that the application programming interface information includes but is not limited to resource ID, IP, HTTP port, WS port and password.

[0144] In the specific implementation of step S106, the amount target resources are parsed respectively to obtain the application programming interface information corresponding to each target resource.

[0145] Step S107: Write the user ID into the application programming interface information corresponding to the target resource and store it in the running status resource list.

[0146] In the specific implementation of step S107, the target resource is removed from the preheating state resource list, and then the user ID is written into the application programming interface information corresponding to the target resource and stored in the running state resource list, and the allocation time of the target resource is recorded.

[0147] It can be understood that moving the target resource from the preheating state resource list to the running state resource list means that the target resource is converted from the preheating state to the running state to perform the simulation operation.

[0148] It should be noted that when the HTTP management service cannot be notified to start or close a SE due to SE simulation anomalies, network anomalies, etc., the SE can be managed by "allocating time". For example, a timer can be used to uniformly handle SEs that have been turned on for too long.

[0149] In some embodiments, after storing the target resource in the running status resource list, the HTTP management service will pass a callback API to the target resource. The API specifies the user's project address, connection password, disconnection / no access, and other information or self-destruction information that needs to be returned to the HTTP management service at various stages when the SE is running.

[0150] The following further describes steps S105 to S107 with reference to examples:

[0151] Steps S105 to S107 can be regarded as the fifth step in the 'getSe' method: allocating resources from the 'seStandby' set to the 'seEngaged' set. The following is a detailed logical description of the fifth step in the 'getSe' method (process D1-process D4).

[0152] Process D1: If 'ses.standbyCount' is greater than 0, parse 'ses.standbyList[0]' to obtain the resource ID, IP, HTTP port, WS port and password.

[0153] Process D2: Remove the resource from the 'seStandby' collection and add it to the 'seEngaged' collection, recording the allocation time.

[0154] Process D3: Call the 'flushSe' method to refresh the SE state.

[0155] Process D4: returns success (that is, resource allocation is successful) and resource information.

[0156] It should be noted that, if amount=2 in the first request, then process D1 to process D4 are executed twice, that is, 2 resources are allocated from the 'seStandby' set to the 'seEngaged' set.

[0157] Step S108: If the number of resources contained in the preheating state resource list is 0, but the number of resources contained in the stopped state resource list is greater than 0, obtain the resources from the stopped state resource list, mark them as resources to be started, and store the resources to be started in the preheating state resource list, and return to execute step S105.

[0158] In the process of implementing step S108, if the number of resources contained in the preheating state resource list is 0, but the number of resources contained in the stopped state resource list is greater than 0, then according to the first request, the resources are restarted from the 'seStopped' collection to the 'seStandby' collection, that is, the resources are obtained from the stopped state resource list, marked as resources to be started, and the resources to be started are stored in the preheating state resource list, and the process returns to execute step S105.

[0159] It can be understood that resources are obtained from the stopped state resource list, marked as resources to be started, and stored in the preheated state resource list. Specifically, amount is obtained from the first request, amount resources are obtained from the stopped state resource list, marked as resources to be started, these amount resources are removed from the stopped state resource list, and these amount resources are stored in the preheated state resource list. At this time, the number of resources included in the preheated state resource list is greater than 0, and the process returns to execute step S105.

[0160] Step S109: If the number of resources contained in the preheating state resource list is 0, and the number of resources contained in the stopped state resource list is 0, but the number of target resources is not greater than the total number of resources, new resources are opened based on the cache database, and the new resources are stored in the preheating state resource list, and the process returns to step S105.

[0161] In the process of implementing step S109, if the number of resources included in the preheating state resource list is 0, and the number of resources included in the stopped state resource list is 0, but the number of target resources is not greater than the total number of resources, that is, the number of resources included in the running state resource list is not greater than the total number of resources at this time, then it means that new resources can also be opened. Specifically, new resources are opened based on the cache database, and the new resources are stored in the preheating state resource list, and the process returns to execute step S105.

[0162] It can be understood that opening a new resource based on the cache database and storing the new resource in the preheated state resource list is specifically (process E1-process E4):

[0163] Process E1: Initialize an empty port array and obtain the amount of resources that need to be run from the first request.

[0164] Process E2: Obtain n unused ports from the cache database according to the amount and add them to the port array, where n is the number of ports required for a resource.

[0165] For example, amount = 2, that is, the user needs 2 resources for simulation; n = 5, these 5 ports can build a resource. The specific process E2 is: get 5 unused ports from the cache database and add them to the port array. The process E2 is executed twice. At this time, there are 10 unused ports in the port array, and 2 resources can be opened.

[0166] Process E3: Mark the ports in the port array as used ports.

[0167] Process E4: Enable resources based on the port array and the number of K8S services and add new resources to the preheating state resource list.

[0168] Combined with the previous example, that is to say, through the K8S service, two resources are opened based on the 10 used ports in the port array, and these two resources are added to the preheating state resource list.

[0169] The following further describes the process E1 to process E4 with reference to examples:

[0170] Process E1 to process E4 can be regarded as the 'getPorts' method in the 'getSe' method, that is, the method of opening a new resource. The following is a detailed logical description of the 'getPorts' method (process F1-process F6).

[0171] Process F1: Initialize an empty 'ports' array (ie, port array).

[0172] Process F2: Loop 'amount' times, obtain n unused ports from the cache database, and add them to the 'ports' array. Amount is the number of resources that need to be run in the first request.

[0173] Process F3: Add the obtained port to the 'seUsedPorts' collection of the cache database.

[0174] Procedure F4: Returns the 'ports' array.

[0175] Process F5: Notify the K8S service to start amount new SEs based on the 'ports' array and add them to the 'seStandby' collection. That is, the status of amount new SEs is in the preheating state.

[0176] Process F6: Add the composition information of the new SE to the 'seStandby' collection of cache data and increase the value of 'ses.totalCount'.

[0177] In an embodiment of the present invention, it is proposed to build an HTTP management service for obtaining SE. First, when the first request is received, a preheating state resource list, a running state resource list and a stopped state resource list are obtained, and the total number of all resources is calculated. Then, SE is obtained from the preheating state resource list and added to the running state resource list to enable SE. If there is no available SE in the preheating state resource list, SE is obtained from the stopped state resource list and moved into the preheating state resource list and then enabled; if there is no SE in the stopped state resource list, a new SE is enabled and moved into the preheating state resource list and then enabled. If the number of available SEs in the configuration reaches the upper limit, it is prompted that the available SEs have reached the upper limit. The present invention realizes the rapid acquisition of SE by controlling that there is always a designated SE in the preheating state (that is, the SEs in the preheating state resource list are all preheating state SEs). Requesting SE and enabling SE are converted into synchronous operations, so that the time to obtain SE is shortened to milliseconds, thereby improving the user experience.

[0178] The above embodiments of the present invention Figure 1 For details on how to refresh the status of all resources in the cache database, see Figure 2 , showing a flowchart of refreshing the status of all resources in a cache database provided by an embodiment of the present invention, including:

[0179] It should be noted that the method to refresh the status of all resources in the cache database is the 'flushSe' method.

[0180] Step S201: obtaining a preheating state resource list, a stop state resource list, a running state resource list and a refresh time identifier from a cache database.

[0181] It should be noted that the specific implementation method of obtaining the preheating state resource list, the stopped state resource list, and the running state resource list from the cache database is detailed in Figure 1 The step S102 shown is not repeated here.

[0182] It can be understood that the specific process of obtaining the refresh time mark from the cache database is as follows (process F1-process F3):

[0183] Process F1: Obtain the refresh time stamp from the cache database.

[0184] When implementing process F1, get the token from the cache database. If the token is obtained, it means that the token has not expired, and the token is returned to end the process. If the token cannot be obtained, it means that the token has expired and has been automatically deleted, so it cannot be obtained, and process F2 is executed.

[0185] Process F2: If the refresh time stamp does not exist in the cache database, a new refresh time stamp is obtained based on the K8S service, and the expiration time of the new refresh time stamp is set.

[0186] When implementing process F2, if the refresh time identifier does not exist in the cache database, a new refresh time identifier is obtained from the K8S service, and the expiration time of the new refresh time identifier is set.

[0187] Process F3: Store the new refresh time identifier after the expiration time is set in the cache database, and return to execute process F1.

[0188] The following further describes the process F1 to process F3 with reference to examples:

[0189] Process F1 to process F3 can be regarded as the 'getSeToken' method in the 'flushSe' method, that is, the method for obtaining the refresh time identifier. The following is a detailed logical description of the 'getSeToken' method (process H1-process H4).

[0190] Process H1: Get the 'seToken' value (that is, the refresh time token) from the cache database.

[0191] Process H2: If 'seToken' does not exist or has expired, get a new token from the k8s service.

[0192] Process H3: Store the new token in the cache database and set the expiration time to m.

[0193] For example, m=23.5 hours (3600*23.5 seconds).

[0194] It should be noted that m only needs to be less than 24 hours. If it is set to 1, it is unnecessary to generate a new token when accessing the k8s service. If it is set to 24 hours, it is possible that the token will expire just after it is obtained. At this time, when the token is used to operate the k8s service, the k8s service will return that the token has expired, causing the entire access link to fail.

[0195] Procedure H4: returns 'seToken'.

[0196] In the specific implementation of step S201, the preheating state resource list, the stop state resource list, the running state resource list and the refresh time identifier are obtained from the cache database through the 'getSes' method and the 'getSeToken' method.

[0197] Step S202: Calculate the sum of the quantities of all resources in the preheating state resource list, the stopped state resource list, and the running state resource list to obtain the resource count quantity.

[0198] It is understandable that the specific implementation method of calculating the sum of the number of all resources in the preheating state resource list, the stopped state resource list and the running state resource list to obtain the resource count number is detailed in Figure 1 In step S103 shown, the target resource quantity in step S103 and the resource count quantity in step S202 are different in name, but both represent the 'ses.totalCount' value, so they are not repeated here.

[0199] Step S203: when the number of preheating resources is greater than the number of resources in the preheating state resource list, and the number of resources in the stopped state resource list is greater than 0, extract resources from the stopped state resource list based on the refresh time identifier and add them to the preheating state resource list.

[0200] It should be noted that before step S203, it is determined whether the number of preheating resources is greater than the number of resources in the preheating state resource list. If the number of preheating resources is not greater than the number of resources in the preheating state resource list, step S206 is executed and the refresh process ends. If the number of preheating resources is greater than the number of resources in the preheating state resource list, step S203 is executed.

[0201] In the process of implementing step S203, if the number of preheating resources is greater than the number of resources in the preheating state resource list, but the number of resources in the stopped state resource list is greater than 0, the refresh time identifier is sent to the K8S service, and the resources in the stopped state resource list are restarted by the K8S service, and the restarted resources are moved to the preheating state resource list until the number of preheating resources is no greater than the number of resources in the preheating state resource list, or the number of resources in the stopped state resource list is 0.

[0202] It can be understood that when the number of preheating resources is greater than the number of resources in the preheating state resource list, and the number of resources in the stop state resource list is 0, step S204 is executed.

[0203] Step S204: When the number of preheating resources is greater than the number of resources in the preheating state resource list, and the number of resources in the stop state resource list is 0, determine whether the total number of resources is greater than the resource count number.

[0204] In the specific implementation of step S204, when the number of preheating resources is greater than the number of resources in the preheating state resource list, and the number of resources in the stop state resource list is 0, it is determined whether the total number of resources is greater than the resource count number. That is, it is determined whether new resources can be started. If the total number of resources is greater than the resource count number, step S205 is executed. If the total number of resources is not greater than the resource count number, it means that no new resources can be started, and the refresh process ends at this time.

[0205] Step S205: If the total number of resources is greater than the resource count number, new resources are constructed based on the cache database, and the new resources are stored in the preheating state resource list based on the refresh time identifier.

[0206] In the process of implementing step S205, if the number of preheating resources is greater than the number of resources in the preheating state resource list, and the number of resources in the stop state resource list is 0, but the total number of resources is greater than the resource count number, new resources are constructed based on the cache database, and the new resources are stored in the preheating state resource list based on the refresh time identifier.

[0207] It should be noted that the specific implementation method of building new resources based on the cache database and storing the new resources in the preheated state resource list based on the refresh time identifier is detailed in Figure 1 The 'getPorts' method in step S109 is not described in detail here.

[0208] Step S206: When the number of preheating resources is not greater than the number of resources in the preheating state resource list, the refresh process ends.

[0209] In the specific implementation of step S206, when the number of preheating resources is not greater than the number of resources in the preheating state resource list, the refresh process is terminated.

[0210] In an embodiment of the present invention, the sum of the number of all resources in the preheating state resource list, the stop state resource list, and the running state resource list is obtained and calculated to obtain the resource count number. According to the total resource number and the preheating resource number in the configuration file, the resources in the preheating state resource list, the stop state resource list, and the running state resource list are refreshed, which improves the operation efficiency, shortens the time for users to obtain SE, and helps to improve the user experience.

[0211] In the embodiment of the present invention Figure 1 The details of obtaining the SE interface are described in Figure 3 , the details of returning SE are explained.

[0212] It should be noted that the method for returning SE is the 'returnSe' method, which is used to return an allocated computing resource (SE) and change its state from 'engaged' to 'standby' or 'stopped'. The method includes:

[0213] Step S301: when receiving a second request to stop using the cloud simulation engine, obtaining a resource ID in the second request.

[0214] In the specific implementation of step S301, when receiving the second request sent by the user through the front end, the resource ID in the second request is obtained. The second request is used to request to stop using the cloud simulation engine. The resource ID in the second request is the ID of the resource (SE) that needs to be stopped.

[0215] The following further describes step S301 with reference to an example:

[0216] The content described in step S301 is the first step in the 'returnSe' method: extracting the content of the resource ID. The following is a detailed logical description of the first step in the 'returnSe' method: obtaining the resource ID from the HTTP request context 'ctx.params'.

[0217] Step S302: determine whether the number of resources in the current preheating state resource list is less than the number of preheating resources.

[0218] In the specific implementation of step S302, the number of resources in the current preheating state resource list is obtained, and it is determined whether the number of resources in the current preheating state resource list is less than the number of preheating resources. If the number of resources in the current preheating state resource list is less than the number of preheating resources, step S303 is executed; if the number of resources in the current preheating state resource list is not less than the number of preheating resources, step S305 is executed.

[0219] Step S303: If it is less than, search the resource corresponding to the resource ID from the running status resource list.

[0220] In the specific implementation of step S303, if the number of resources in the current preheating state resource list is less than the number of preheating resources, the resource corresponding to the resource ID in the second request is searched from the running state resource list, and step S304 is executed.

[0221] Step S304: Delete the resource corresponding to the resource ID from the running state resource list, and add the resource corresponding to the resource ID to the preheating state resource list.

[0222] In the specific implementation process of step S304, the resource corresponding to the resource ID is deleted from the running state resource list, and the resource corresponding to the resource ID is added to the preheating state resource list.

[0223] The following further describes steps S302 to S304 with reference to examples:

[0224] The contents of step S302 to step S304 are the second step of the 'returnSe' method: checking the quantity. The following is a detailed logical description of the second step of the 'returnSe' method (process I1-process I5):

[0225] Process I1: Call the 'getSes' method to obtain the status list and quantity statistics of all current resources.

[0226] Procedure I2: If 'ses.standbyCount' is less than 'seCfg.standbyAmount', search 'ses.engagedList' for the resource corresponding to the resource ID in the HTTP request context 'ctx.params'.

[0227] Process I3: If the resource is found, parse the resource to obtain the resource ID, IP, HTTP port, WS port and password.

[0228] Process I4: Remove the resource from the 'seEngaged' collection and add it to the 'seStandby' collection, resetting the corresponding user ID and configuration time of the resource.

[0229] Process I5: Returns success.

[0230] Step S305: If it is not less than, searching the resource corresponding to the resource ID from the running status resource list.

[0231] In the specific implementation of step S305, if the number of resources in the current preheating state resource list is not less than the number of preheating resources, the resource corresponding to the resource ID is searched from the running state resource list, and step S306 is executed.

[0232] Step S306: Send a stop instruction to the K8S service to stop the resources corresponding to the resource ID.

[0233] In the specific implementation process of step S306, a stop instruction is sent to the K8S service to stop the resource corresponding to the resource ID in the running status resource list.

[0234] Step S307: When the resource corresponding to the resource ID is stopped successfully, the resource corresponding to the resource ID is deleted from the running state resource list, and the resource corresponding to the resource ID is added to the stopped state resource list.

[0235] In the process of implementing step S307, when the K8S service successfully stops the resource corresponding to the resource ID, the resource corresponding to the resource ID is removed from the running state resource list, and the resource corresponding to the resource ID is added to the stopped state resource list.

[0236] The following further describes steps S305 to S307 with reference to examples:

[0237] The contents of step S305 to step S307 are the third step of the 'returnSe' method: ('stopse' method) stop SE. The following is a detailed logical description of the 'stopse' method (process J1-process J7):

[0238] Process J1: Get the member list of the 'seEngaged' collection from the cache database.

[0239] Process J2: Find the resource in the 'seEngaged' collection that starts with the resource ID in 'ctx.params'.

[0240] Process J3: If the resource is found, call the 'getSeToken' method to obtain the 'seToken' value.

[0241] Process J4: Request the K8S service to stop the resource.

[0242] In some specific embodiments, a 3-time timer is set to query the shutdown status of the SE every 10 seconds. After the shutdown is successful, the resource is removed from the 'seEngaged' collection and added to the 'seStopped' collection. Figure 4 The timing method introduced is for recycling.

[0243] It should be noted that the timer can be 3 times or any number of times. The specific number depends on the actual situation and is not specifically limited here.

[0244] Process J5: In the K8S service, a return value of 'true' indicates a successful operation, and a return value of 'false' indicates a failed operation.

[0245] Process J6: If the stop operation fails, the HTTP management service returns that the resource has been returned.

[0246] It is understandable that process J6 is about the operation of HTTP management service. The success or failure of HTTP management service cannot affect the logic of front-end / user / user end. Therefore, process J6 returns "returned" so that the caller can continue to complete other business logic without worrying about whether the return is successful. As for the return failure of HTTP management service, it is handled by HTTP management service. Figure 4 The timing method shown refreshes abnormal SEs uniformly.

[0247] Process J7: After the stop operation is successful, the HTTP management service returns that the resource has been returned.

[0248] In the embodiment of the present invention, the content related to returning SE in HTTP management service is introduced. When returning SE, HTTP management service stops the SE, and after stopping successfully, the state of the SE is changed from running state to stopped state. Timely returning SE helps to improve resource utilization and optimize the performance of management service, thereby improving user experience.

[0249] In the embodiment of the present invention Figure 1 In step S107, it is mentioned that when resources are stored in the running state resource list, the allocation time of resources will be recorded when the state is running. Figure 4 , the timing method proposed in the embodiment of the present invention is described in detail.

[0250] It can be understood that this timing method is used to deal with SEs that are turned on for too long. The timing method includes:

[0251] Step S401: Periodically parse all resources in the running status resource list to obtain target application programming interface information corresponding to each resource in the running status resource list.

[0252] In the specific implementation of step S401, all resources in the current running status resource list are periodically obtained (for example, once every 30 seconds), each resource is traversed and parsed, and the target application programming interface information corresponding to each resource in the running status resource list is obtained.

[0253] It should be noted that the target application programming interface information includes but is not limited to resource ID, SE's IP, SE's http service port, SE's WS port, USER_ID and TIMESTAMP startup time (ie, configuration time).

[0254] Step S402: For each target application programming interface information, obtain the configuration time in the target application programming interface information.

[0255] In the specific process of implementing step S402, for each target application programming interface information, the configuration time is obtained from the target application programming interface information.

[0256] That is, obtain the configuration time of each resource in the running status resource list.

[0257] Step S403: Calculate the time difference between the current time and the configured time.

[0258] In the specific implementation of step S403, the time difference between the current time and each configured time is calculated.

[0259] Step S404: If the time difference is greater than the time threshold, the resource corresponding to the current time difference is deleted from the running state resource list, and added to the stopped state resource list.

[0260] In the process of implementing step S404, each time difference is compared with the time threshold. If the time difference is greater than the time threshold, it means that the start time of the resource corresponding to the configuration time corresponding to the time difference is too long. At this time, the resource corresponding to the configuration time is deleted from the running status resource list and added to the stopped status resource list.

[0261] In some specific embodiments, the resource ID and stop time of the resource added to the stop status resource list in step S404 are written into the log.

[0262] The following further describes step S404 with reference to examples (process K1 to process K4):

[0263] Process K1: Get the current 'seEngaged' collection from the cache database.

[0264] Process K2: Traverse each resource in 'engagedList', parse its component information to obtain configuration time and other information.

[0265] Process K3: Calculate the time difference between the current time and the configured time. If the time difference is greater than the timeout time (in seconds) configured by 'seCfg.returnEngagedTimeout (SE maximum occupied time)', call the 'stopSe' method to stop the resource.

[0266] Process K4: Output logs, in which the ID of the stopped resource and the stop time are recorded.

[0267] In the embodiment of the present invention, the occupancy timeout mechanism is embodied by a timing method to refresh the excessive occupancy caused by connection interruption and other problems. Specifically, the time difference between the time when the resource is turned on and the current time is calculated. If the time difference is greater than the timeout time configured for the maximum time that the SE can be occupied, the resource is stopped. Stopping the SE in time helps to improve resource utilization and optimize the performance of management services. This improves the user experience.

[0268] The above-mentioned embodiment of the present invention Figure 1 The proposed resource management method for a cloud simulation engine corresponds to Figure 5 , shows a structural block diagram of a resource management device of a cloud simulation engine provided by an embodiment of the present invention. The management device includes: a judgment unit 501, a first acquisition unit 502, a calculation unit 503, an extraction unit 504, a second acquisition unit 505, a parsing unit 506, a storage unit 507, a third acquisition unit 508 and a fourth acquisition unit 509.

[0269] The judgment unit 501 is used to judge whether the total number of resources in the configuration file is greater than or equal to the number of preheating resources in the configuration file when receiving the first request to run the cloud simulation engine; wherein the resources include cloud simulation engines; the total number of resources is the number of cloud simulation engines that can be turned on; and the number of preheating resources is the number of cloud simulation engines in a preheating state.

[0270] The first acquisition unit 502 is configured to refresh the status of all resources in the cache database if the value is greater than or equal to the value, and acquire a preheating state resource list, a stop state resource list, and a running state resource list from the cache database.

[0271] The calculation unit 503 is used to calculate the total number of all resources included in the preheating state resource list, the stopped state resource list and the running state resource list to obtain the target resource number; wherein the preheating state resource list includes resources in the preheating state, the stopped state resource list includes resources in the stopped state, and the running state resource list includes resources in the running state.

[0272] The extraction unit 504 is used to extract the user ID from the first request if the target resource quantity is not greater than the total resource quantity, or the quantity of resources included in the preheating state resource list is greater than 0, and / or the quantity of resources included in the stop state resource list is greater than 0.

[0273] The second acquisition unit 505 is configured to acquire resources from the preheating state resource list according to the first request and mark the resources as target resources if the number of resources included in the preheating state resource list is greater than 0.

[0274] The parsing unit 506 is used to parse the target resource and obtain the application programming interface information corresponding to the target resource.

[0275] The storage unit 507 is used to write the user ID into the application programming interface information corresponding to the target resource and store it in the running status resource list.

[0276] The third acquisition unit 508 is used to acquire resources from the stopped state resource list if the number of resources included in the preheating state resource list is 0, but the number of resources included in the stopped state resource list is greater than 0, mark them as resources to be started, and store the resources to be started in the preheating state resource list, and return to execute the second acquisition unit.

[0277] The fourth acquisition unit 509 is used to open new resources based on the cache database if the number of resources included in the preheating state resource list is 0, and the number of resources included in the stopped state resource list is 0, but the number of target resources is not greater than the total number of resources, and store the new resources in the preheating state resource list, and return to execute the second acquisition unit.

[0278] In an embodiment of the present invention, it is proposed to build an HTTP management service for obtaining SE. First, when the first request is received, a preheating state resource list, a running state resource list and a stopped state resource list are obtained, and the total number of all resources is calculated. Then, SE is obtained from the preheating state resource list and added to the running state resource list to enable SE. If there is no available SE in the preheating state resource list, SE is obtained from the stopped state resource list and moved into the preheating state resource list and then enabled; if there is no SE in the stopped state resource list, a new SE is enabled and moved into the preheating state resource list and then enabled. If the number of available SEs in the configuration reaches the upper limit, it is prompted that the available SEs have reached the upper limit. The present invention realizes the rapid acquisition of SE by controlling that there is always a designated SE in the preheating state (that is, the SEs in the preheating state resource list are all preheating state SEs). Requesting SE and enabling SE are converted into synchronous operations, so that the time to obtain SE is shortened to milliseconds, thereby improving the user experience.

[0279] Combination Figure 5 The content shown is that the first acquisition unit 502 includes: an acquisition module, a calculation module, an extraction module, a judgment module, a storage module and an end module.

[0280] The acquisition module is used to obtain a preheating state resource list, a stop state resource list, a running state resource list and a refresh time identifier from the cache database.

[0281] The calculation module is used to calculate the sum of the quantities of all resources in the preheating state resource list, the stopping state resource list and the running state resource list to obtain the resource count quantity.

[0282] The extraction module is used to extract resources from the stop state resource list and add them to the preheat state resource list based on the refresh time identifier when the number of preheat resources is greater than the number of resources in the preheat state resource list and the number of resources in the stop state resource list is greater than 0.

[0283] The judgment module is used to judge whether the total number of resources is greater than the resource count number when the number of preheating resources is greater than the number of resources in the preheating state resource list and the number of resources in the stop state resource list is 0. If the total number of resources is greater than the resource count number, the storage module is executed; when the number of preheating resources is not greater than the number of resources in the preheating state resource list, the end module is executed.

[0284] The storage module is used to construct new resources based on the cache database if the total number of resources is greater than the resource count number, and store the new resources in the preheating state resource list based on the refresh time identifier.

[0285] The end module is used to end the refresh process when the number of preheating resources is not greater than the number of resources in the preheating status resource list.

[0286] Combination Figure 5 The content shown, the acquisition module, includes: an acquisition sub-module, a setting sub-module and a storage sub-module.

[0287] The acquisition submodule is used to obtain the refresh time identifier from the cache database.

[0288] Set up a submodule to obtain a new refresh time identifier based on the K8S service and set the expiration time of the new refresh time identifier if the refresh time identifier does not exist in the cache database.

[0289] The storage submodule is used to store the new refresh time identifier after the set expiration time into the cache database and return to execute the acquisition submodule.

[0290] Combination Figure 5As shown in the content, the fourth acquisition unit 509 includes: an initialization module, a first adding module, a marking module and a second adding module.

[0291] The initialization module is used to initialize an empty port array and obtain the number of resources that need to be run from the first request.

[0292] The first adding module is used to obtain n unused ports from the cache database according to the number and add them to the port array, where n is the number of ports required for a resource.

[0293] The marking module is used to mark the ports in the port array as used ports.

[0294] The second adding module is used to enable resources based on the port array and the number of K8S services and add new resources to the preheating state resource list.

[0295] Combination Figure 5 According to the content shown, the management device also includes: a fifth acquisition unit, a quantity determination unit, a first search unit, a first deletion unit, a second search unit, a stop unit and a second deletion unit.

[0296] The fifth acquisition unit is used to acquire the resource ID in the second request when receiving the second request to stop using the cloud simulation engine.

[0297] The quantity determination unit is used to determine whether the number of resources in the current preheating state resource list is less than the number of preheating resources.

[0298] The first searching unit is configured to search for a resource corresponding to the resource ID from a running status resource list if the resource ID is less than .

[0299] The first deleting unit is used to delete the resource corresponding to the resource ID from the running state resource list, and add the resource corresponding to the resource ID to the preheating state resource list.

[0300] The second searching unit is configured to search for a resource corresponding to the resource ID from a running status resource list if the resource ID is not less than the resource ID.

[0301] The stop unit is used to send a stop command to the K8S service to stop the resource corresponding to the resource ID.

[0302] The second deleting unit is used to delete the resource corresponding to the resource ID from the running state resource list when the resource corresponding to the resource ID is stopped successfully, and add the resource corresponding to the resource ID to the stopped state resource list.

[0303] Combination Figure 5 The method further includes: an information parsing unit, a sixth acquiring unit, a time difference calculating unit and a third deleting unit.

[0304] The parsing information unit is used to periodically parse all resources in the running status resource list to obtain target application programming interface information corresponding to each resource in the running status resource list;

[0305] a sixth acquisition unit, configured to acquire, for each target application programming interface information, a configuration time in the target application programming interface information;

[0306] A time difference calculation unit is used to calculate the time difference between the current time and the configured time;

[0307] The third deleting unit is used to delete the resources corresponding to the current time difference from the running state resource list and add them to the stopped state resource list if the time difference is greater than the time threshold.

[0308] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0309] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0310] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A resource management method for a cloud simulation engine, characterized in that: The method comprises: When receiving a first request to run a cloud simulation engine, determining whether the total number of resources in the configuration file is greater than or equal to the number of preheated resources in the configuration file; wherein the resources include the cloud simulation engine; the total number of resources is the number of cloud simulation engines that can be started; the preheated number of resources is the number of cloud simulation engines in a preheated state; If it is greater than or equal to, refresh the status of all resources in the cache database, and obtain a preheating state resource list, a stop state resource list, and a running state resource list from the cache database; Calculate the sum of the quantities of all resources included in the preheating state resource list, the stopped state resource list and the running state resource list to obtain the target resource quantity; wherein the preheating state resource list includes the resources in the preheating state, the stopped state resource list includes the resources in the stopped state, and the running state resource list includes the resources in the running state; If the target resource quantity is not greater than the total resource quantity, or the quantity of the resources included in the preheating state resource list is greater than 0, and / or the quantity of the resources included in the stop state resource list is greater than 0, extracting a user ID from the first request; If the number of the resources included in the preheating state resource list is greater than 0, obtaining resources from the preheating state resource list according to the first request and marking them as target resources; Parsing the target resource to obtain application programming interface information corresponding to the target resource; Writing the user ID into the application programming interface information corresponding to the target resource and storing it in the running status resource list; If the number of the resources included in the preheating state resource list is 0, but the number of the resources included in the stopped state resource list is greater than 0, resources are obtained from the stopped state resource list, marked as resources to be started, and the resources to be started are stored in the preheating state resource list, and the step of returning to execute if the number of the resources included in the preheating state resource list is greater than 0, obtaining resources from the preheating state resource list according to the first request and marking them as target resources is performed; If the number of the resources included in the preheating state resource list is 0, and the number of the resources included in the stopped state resource list is 0, but the target resource number is not greater than the total resource number, new resources are opened based on the cache database, and the new resources are stored in the preheating state resource list, and the step of obtaining resources from the preheating state resource list and marking them as target resources according to the first request is returned to execute if the number of the resources included in the preheating state resource list is greater than 0.

2. The method according to claim 1, characterized in that: The state of all resources in the refresh cache database includes: Obtain a list of preheating state resources, a list of stopped state resources, a list of running state resources, and a refresh time identifier from the cache database; Calculate the sum of the quantities of all resources in the preheating state resource list, the stopped state resource list, and the running state resource list to obtain a resource count quantity; When the number of preheating resources is greater than the number of resources in the preheating state resource list, and the number of resources in the stopped state resource list is greater than 0, extracting resources from the stopped state resource list based on the refresh time identifier and adding them to the preheating state resource list; When the number of preheating resources is greater than the number of resources in the preheating state resource list, and the number of resources in the stop state resource list is 0, determining whether the total number of resources is greater than the resource count number; If the total number of resources is greater than the resource count number, constructing new resources based on the cache database, and storing the new resources in the preheating state resource list based on the refresh time identifier; When the number of the preheating resources is not greater than the number of the resources in the preheating state resource list, the refresh process ends.

3. The method according to claim 2, characterized in that The obtaining of a refresh time identifier from the cache database includes: Obtain a refresh time identifier from the cache database; If the refresh time identifier does not exist in the cache database, a new refresh time identifier is obtained based on the K8S service, and the expiration time of the new refresh time identifier is set; The new refresh time identifier after the set expiration time is stored in the cache database, and the process returns to execute the step of obtaining the refresh time identifier from the cache database.

4. The method according to claim 1, characterized in that: The opening of the new resource based on the cache database and storing the new resource in the preheating state resource list includes: Initialize an empty port array, and obtain the number of the resources that need to be run from the first request; According to the number, n unused ports are obtained from the cache database and added to the port array, where n is the number of ports required for one resource; Mark the port in the port array as a used port; Based on the port array and K8S service, the number of the resources is enabled and the new resources are added to the preheated state resource list.

5. The method according to claim 1, characterized in that: The method further comprises: When receiving a second request to stop using the cloud simulation engine, obtaining a resource ID in the second request; Determine whether the number of resources in the current preheating state resource list is less than the number of preheating resources; If it is less than, searching the resource corresponding to the resource ID from the running status resource list; Deleting the resource corresponding to the resource ID from the running state resource list, and adding the resource corresponding to the resource ID to the preheating state resource list; If it is not less than, searching the resource corresponding to the resource ID from the running status resource list; Send a stop command to the K8S service to stop the resource corresponding to the resource ID; When the resource corresponding to the resource ID is stopped successfully, the resource corresponding to the resource ID is deleted from the running state resource list, and the resource corresponding to the resource ID is added to the stopped state resource list.

6. The method according to claim 1, characterized in that The method further comprises: Periodically parsing all resources in the running status resource list to obtain target application programming interface information corresponding to each resource in the running status resource list; For each target application programming interface information, obtaining the configuration time in the target application programming interface information; Calculate the time difference between the current time and the configured time; If the time difference is greater than the time threshold, the resource corresponding to the current time difference is deleted from the running state resource list, and is added to the stopped state resource list.

7. A resource management device for a cloud simulation engine, characterized in that: The device comprises: A judgment unit, configured to judge whether the total number of resources in the configuration file is greater than or equal to the number of preheated resources in the configuration file when receiving a first request to run the cloud simulation engine; wherein the resources include the cloud simulation engine; the total number of resources is the number of cloud simulation engines that can be started; and the preheated number of resources is the number of cloud simulation engines in a preheated state; A first acquisition unit is used to refresh the status of all resources in the cache database if it is greater than or equal to, and acquire a preheating state resource list, a stop state resource list, and a running state resource list from the cache database; A calculation unit, configured to calculate the sum of the quantities of all resources included in the preheating state resource list, the stopped state resource list, and the running state resource list to obtain a target resource quantity; wherein the preheating state resource list includes the resources in the preheating state, the stopped state resource list includes the resources in the stopped state, and the running state resource list includes the resources in the running state; an extracting unit, configured to extract a user ID from the first request if the target resource quantity is not greater than the total resource quantity, or the quantity of the resources included in the preheating state resource list is greater than 0, and / or the quantity of the resources included in the stop state resource list is greater than 0; A second acquisition unit, configured to acquire resources from the preheating state resource list according to the first request and mark them as target resources if the number of the resources included in the preheating state resource list is greater than 0; A parsing unit, used for parsing the target resource to obtain application programming interface information corresponding to the target resource; A storage unit, used to write the user ID into the application programming interface information corresponding to the target resource, and store it in the running status resource list; a third acquisition unit, configured to, if the number of the resources included in the preheating state resource list is 0, but the number of the resources included in the stopped state resource list is greater than 0, acquire resources from the stopped state resource list, mark them as resources to be started, store the resources to be started in the preheating state resource list, and return to execute the second acquisition unit; The fourth acquisition unit is used to open new resources based on the cache database if the number of the resources included in the preheating state resource list is 0, and the number of the resources included in the stopped state resource list is 0, but the target resource number is not greater than the total resource number, and store the new resources in the preheating state resource list, and return to execute the second acquisition unit.

8. The device according to claim 7, characterized in that The first acquisition unit includes: An acquisition module is used to obtain a preheating state resource list, a stop state resource list, a running state resource list and a refresh time identifier from a cache database; A calculation module, used to calculate the sum of the quantities of all resources in the preheating state resource list, the stopped state resource list and the running state resource list to obtain a resource count quantity; An extraction module, configured to extract resources from the stop state resource list and add them to the preheat state resource list based on the refresh time identifier when the number of the preheating resources is greater than the number of resources in the preheating state resource list and the number of resources in the stop state resource list is greater than 0; A judging module, configured to judge whether the total resource quantity is greater than the resource count quantity when the number of the preheating resources is greater than the number of the resources in the preheating state resource list and the number of the resources in the stop state resource list is 0; A storage module, configured to construct new resources based on the cache database if the total number of resources is greater than the resource count number, and store the new resources in the preheating state resource list based on the refresh time identifier; The end module is used to end the refresh process when the number of the preheating resources is not greater than the number of the resources in the preheating state resource list.

9. The device according to claim 8, characterized in that The acquisition module comprises: An acquisition submodule, used to acquire a refresh time identifier from the cache database; A submodule is set to obtain a new refresh time identifier based on the K8S service if the refresh time identifier does not exist in the cache database, and to set an expiration time of the new refresh time identifier; The storage submodule is used to store the new refresh time identifier after the set expiration time into the cache database, and return to execute the acquisition submodule.

10. The device according to claim 7, characterized in that The fourth acquiring unit includes: An initialization module, used for initializing an empty port array and obtaining the number of the resources to be run from the first request; A first adding module, used for acquiring n unused ports from the cache database according to the number and adding them to the port array, wherein n is the number of ports required for one resource; A marking module, used for marking the ports in the port array as used ports; The second adding module is used to enable the number of the resources based on the port array and the K8S service and add the new resources to the preheating state resource list.

Citation Information

Patent Citations

  • Cloud simulation integration and scheduling method and device, computer equipment and storage medium

    CN111459621A

  • Cloud simulation method based on container architecture

    CN116149794A

  • Workflow engine based on micro-service architecture

    CN116738467A

  • Simulation engine calling control method and device and simulation system

    CN117112185A

  • Container cloud-based system resource monitoring method and related device

    WO2020248507A1