Resource allocation method, device, electronic device and storage medium based on multiple models
By adopting a multi-model resource allocation method in the speech recognition system and using container encapsulation and load balancing technology, the problem of multi-model competition for resources is solved and the stability and efficiency of the system are improved.
Patent Information
- Application Number
- CN202011603677.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-29
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2040-12-29
AI Technical Summary
Various network models in the speech recognition system may compete for memory resources during a large number of speech recognition tasks, causing the system to crash and unable to effectively achieve better recognition results in all aspects.
Adopting a multi-model-based resource allocation method, the network model is converted into containers through container encapsulation technology, and load balancing components and POD units are used for dynamic resource allocation to ensure that each model container runs on the appropriate server, and through elastic scaling monitoring and Automatic scaling objects adjust the number of POD units to avoid resource contention.
It achieves dynamic allocation of resources for multiple network models, avoids system crashes, improves the stability and efficiency of the speech recognition system, and ensures good performance in different environments.
Smart Images

Figure CN112698945B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of load allocation technology, and in particular to a resource allocation method, device, electronic device and computer-readable storage medium based on multiple models. Background Art
[0002] Speech recognition is a complex project. The effect of speech recognition is closely related to the region, scene, language, age, gender, etc. A single network model cannot achieve a good recognition effect in all aspects. Therefore, a speech recognition system is often configured with multiple network models. However, when multiple network models work together, they may compete for memory resources when performing a large number of speech recognition tasks, causing the system to crash. Summary of the invention
[0003] The present invention provides a resource allocation method, device, electronic device and computer-readable storage medium based on multiple models, aiming at dynamically allocating resources to multiple network models.
[0004] To achieve the above object, the present invention provides a resource allocation method based on multiple models, comprising:
[0005] Acquire multiple network models, encapsulate the operating environment of each network model using a pre-built container encapsulation technology, obtain a model container of each network model, and store address information of each model container in a load balancing component;
[0006] In each of the model containers, a pre-built POD unit is called to obtain a POD unit set of the model container, and a service label of the POD unit set is generated;
[0007] Utilizing the load balancing component, receiving a request data set transmitted by a user end, matching a request address in each request data in the request data set with the address information of the model container, and distributing the request data to a corresponding model container according to the matching result;
[0008] The request content in the request data is split to obtain a request block set, and according to the request block set, the number of POD units in the corresponding POD unit set is dynamically adjusted using the service label corresponding to the allocated model container, and the POD unit set is used to obtain computing space resources from a pre-built server to perform data processing on the request block set.
[0009] Optionally, in each of the model containers, calling a pre-built POD unit to obtain a POD unit set of the model container, and generating a service tag of the POD unit set includes:
[0010] Running the model container to obtain a set of quantities of the POD units required to run the model container under multiple preset situations;
[0011] According to the quantity set, a quantity interval of POD units in the model container is set, and any number of POD units in the quantity interval are randomly called to obtain a POD unit set of the model container;
[0012] An elastic scaling monitoring object and an automatic scaling object are set, and a service tag is generated according to the quantity interval of the POD units and the elastic scaling monitoring object and the automatic scaling object.
[0013] Optionally, dynamically adjusting the number of POD units in the corresponding POD unit set by using the service label corresponding to the allocated model container according to the request block set includes:
[0014] According to the number of request blocks in the request block set, the number of POD units in the POD unit set is monitored by using the elastic scaling monitoring object in the service tag, and the POD units in the POD unit set are increased or deleted by using the automatic scaling object in the service tag;
[0015] When the number of the POD units is equal to the number of request blocks in the request block set or reaches the upper limit of the number interval, the POD units are stopped from being increased, and one POD unit is allocated to each request block.
[0016] Optionally, before using the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set, the method further includes:
[0017] Detect the number of connections to the model container on each server;
[0018] The allocated model container is connected to the server having the smallest number of connections to the model container.
[0019] Optionally, the using the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set includes:
[0020] Monitoring the remaining space in the memory computing space in the server, and when the remaining space is greater than the consumed space of the POD unit set, using the POD unit set to receive memory resources and perform data processing on the request block set;
[0021] When the remaining space is less than the consumed space of the POD unit set, the preset elimination strategy is used to clean up the memory computing space of the server until the remaining space is greater than the consumed space of the POD unit set, and the POD unit set is used to receive memory resources to perform data processing on the request block set.
[0022] Optionally, the using the load balancing component to receive a request data set transmitted by a user terminal, and matching a request address in each request data in the request data set with address information of the model container, includes:
[0023] Using the HTTP protocol in the load balancing component, intercepting the request data set sent by the client;
[0024] Obtaining the request address and request content included in each request data in the request data set;
[0025] The request address is matched with the address information of the model container stored in the load balancing component to obtain a matching result.
[0026] Optionally, the using of a pre-built container encapsulation technology to encapsulate the operating environment of each of the network models to obtain a model container of each of the network models includes:
[0027] Obtaining the dependency packages of the network model to obtain the operating environment of the network model;
[0028] The operating environment is encapsulated using a pre-built container encapsulation technology to obtain a model container for each of the network models.
[0029] In order to solve the above problem, the present invention also provides a resource allocation device based on multiple models, the device comprising:
[0030] A container construction module, used to obtain multiple network models, encapsulate the operating environment of each network model using a pre-built container encapsulation technology, obtain a model container of each network model, and store the address information of each model container in a load balancing component;
[0031] A label configuration module, used to call a pre-built POD unit in each of the model containers, obtain a POD unit set of the model container, and generate a service label of the POD unit set;
[0032] A request distribution module, used to use the load balancing component to receive a request data set transmitted by a user end, match the request address in each request data in the request data set with the address information of the model container, and distribute the request data to the corresponding model container according to the matching result;
[0033] A resource dynamic retrieval module is used to split the request content in the request data to obtain a request block set, and according to the request block set, dynamically adjust the number of POD units in the corresponding POD unit set using the service label corresponding to the allocated model container, and use the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set.
[0034] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0035] at least one processor; and,
[0036] a memory communicatively connected to the at least one processor; wherein,
[0037] The memory stores computer program instructions that can be executed by the at least one processor. The computer program instructions are executed by the at least one processor so that the at least one processor can perform the above-mentioned multi-model-based resource allocation method.
[0038] In order to solve the above problems, the present invention also provides a computer-readable storage medium, including a data storage area and a program storage area, the data storage area stores created data, and the program storage area stores a computer program; wherein, when the computer program is executed by a processor, the above-mentioned multi-model-based resource allocation method is implemented.
[0039] The embodiment of the present invention uses container encapsulation technology to convert the network model into a container, increasing the adaptability of the model in different servers. In addition, the embodiment of the present invention configures a load balancing component to transfer the request data to the container, and connects the container to an idle server to prevent resource competition. The dynamic scaling technology is further used to adjust the number of POD units of each container, which can achieve a reasonable allocation of memory resources. The embodiment of the present invention can dynamically allocate resources for multiple network models. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of a flow chart of a resource allocation method based on multiple models provided in an embodiment of the present invention;
[0041] Figure 2 A flow chart of generating service labels in a multi-model based resource allocation method provided in an embodiment of the present invention;
[0042] Figure 3 A flowchart of dynamically adjusting POD units in a multi-model-based resource allocation method provided in an embodiment of the present invention;
[0043] Figure 4A schematic diagram of modules of a resource allocation device based on multiple models provided by an embodiment of the present invention;
[0044] Figure 5 A schematic diagram of the internal structure of an electronic device for implementing a resource allocation method based on multiple models provided by an embodiment of the present invention;
[0045] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0046] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0047] The embodiment of the present application provides a resource allocation method based on multiple models. The execution subject of the resource allocation method based on multiple models includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the resource allocation method based on multiple models can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0048] Reference Figure 1 FIG. 1 is a flow chart of a resource allocation method based on multiple models provided in an embodiment of the present invention. In this embodiment, the resource allocation method based on multiple models includes:
[0049] S1. Acquire multiple network models, encapsulate the operating environment of each network model using a pre-built container encapsulation technology, obtain a model container of each network model, and store the address information of each model container in a load balancing component.
[0050] In the embodiment of the present invention, the network model can be different speech recognition models. Different network models will be affected by the environment of different servers. In order to ensure that each network model can have a good effect in different servers, the embodiment of the present invention encapsulates the network model and constructs it into a container.
[0051] In detail, the embodiment of the present invention obtains the dependency package of the network model to obtain the operating environment of the network model; and uses the pre-built container encapsulation technology to encapsulate the operating environment to obtain the model container of each network model.
[0052] In an embodiment of the present invention, the container encapsulation technology may be Docker container technology, wherein Docker is an open source application container engine for encapsulating and generating a lightweight, portable container. In an embodiment of the present invention, by encapsulating the network model to obtain each model container, resource restriction and isolation of different network models can be achieved.
[0053] Furthermore, the load balancing component in the embodiment of the present invention is an nginx component, which is used to provide a load balancing service for request data sent by a user terminal.
[0054] S2. In each of the model containers, call the pre-built POD unit to obtain the POD unit set of the model container, and generate a service label of the POD unit set.
[0055] In the embodiment of the present invention, the POD unit is the smallest unit that can be created and deployed in Kubernetes, and is an application instance in the Kubernetes cluster. In the embodiment of the present invention, one model container can call multiple POD units, and each POD unit shares the computing space resources of the same server, which can achieve the effect of efficiently exchanging information.
[0056] For details, see Figure 2 As shown, the S2 includes:
[0057] S20: Run the model container to obtain a set of quantities of the POD units required to run the model container under multiple preset situations.
[0058] The embodiment of the present invention can utilize pre-built test cases to run each model container, record the number of POD units called in each model container, and form the number set.
[0059] S21. According to the quantity set, set a quantity interval of POD units in the model container, and randomly call any number of POD units in the quantity interval to obtain a POD unit set of the model container.
[0060] In one application example of the present invention, the data set may be [3, 4, 5, 7, 8, 9, 6], and [3, 9] is set as the number interval of the POD units. When the model container is started, in order to speed up the processing, the number of POD units in the number interval may be randomly retrieved. For example, in the embodiment of the present invention, the value may be 3, and the POD unit set may be (POD1, POD2, POD3).
[0061] S22: Set an elastic scaling monitoring object and an automatic scaling object, and generate a service tag according to the number interval of the POD units and the elastic scaling monitoring object and the automatic scaling object.
[0062] Furthermore, the embodiment of the present invention sets an elastic scaling monitoring object and an automatic scaling object, and constructs a service tag using the quantity interval. The automatic scaling object can delete a POD unit, or import a pre-built POD unit, and the elastic scaling monitoring object can monitor the quantity change of the POD units in the POD unit set in real time.
[0063] S3. Utilize the load balancing component to receive the request data set transmitted by the user end, match the request address in each request data in the request data set with the address information of the model container, and distribute the request data to the corresponding model container according to the matching result.
[0064] In the embodiment of the present invention, the request data set is a collection of request data, wherein the request data may be request information for obtaining resources sent by the user end to the server end.
[0065] In the embodiment of the present invention, the request data includes a request address and a request content. Specifically, the use of the load balancing component to receive a request data set transmitted by a user end and matching the request address in each request data in the request data set with the address information of the model container includes:
[0066] Using the HTTP protocol in the load balancing component, intercepting the request data set sent by the client;
[0067] Obtaining the request address and request content included in each request data in the request data set;
[0068] The request address is matched with the address information of the model container stored in the load balancing component to obtain a matching result.
[0069] Furthermore, the embodiment of the present invention sends the request content in the request data to the model container matched by the request address according to the matching result.
[0070] The embodiment of the present invention utilizes the load balancing component to distribute the request data to different model containers to improve the response capabilities of the multiple network models and eliminate single points of failure, thereby improving the availability of the network models.
[0071] S4. Request content in the request data is split to obtain a request block set, and according to the request block set, the service label corresponding to the allocated model container is used to dynamically adjust the number of POD units in the corresponding POD unit set, and the POD unit set is used to obtain computing space resources from a pre-built server to perform data processing on the request block set.
[0072] In the embodiment of the present invention, each POD unit can call the computing resource space in the server. To ensure fast computing of the model container, the request content needs to be distributed to multiple POD units.
[0073] For details, see Figure 3 As shown, in the embodiment of the present invention, the dynamically adjusting the number of POD units in the corresponding POD unit set according to the request block set and using the service label corresponding to the allocated model container includes:
[0074] Step S40: According to the number of request blocks in the request block set, the elastic scaling monitoring object in the service tag is used to monitor the number of POD units in the POD unit set, and the automatic scaling object in the service tag is used to increase or delete the POD units in the POD unit set;
[0075] Step S41: When the number of the POD units is equal to the number of request blocks in the request block set or reaches the upper limit of the number interval, stop increasing the POD units and allocate one POD unit to each request block.
[0076] Further, in an embodiment of the present invention, the step of using the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set includes:
[0077] Monitoring the remaining space in the memory computing space in the server, and when the remaining space is greater than the consumed space of the POD unit set, using the POD unit set to receive memory resources and perform data processing on the request block set;
[0078] When the remaining space is less than the consumed space of the POD unit set, the preset elimination strategy is used to clean up the memory computing space of the server until the remaining space is greater than the consumed space of the POD unit set, and the POD unit set is used to receive memory resources to perform data processing on the request block set.
[0079] In the embodiment of the present invention, the elimination strategy uses the remote dictionary service (Redis) to set the maximum memory instruction (maxmemory). When the memory usage in the server is greater than maxmemory, the POD units in other containers that are least recently used are preferentially deleted to achieve the effect of clearing memory.
[0080] In detail, in another embodiment of the present invention, before using the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set, the method further includes:
[0081] Detect the number of connections to the model container on each server;
[0082] The allocated model container is connected to the server having the smallest number of connections to the model container.
[0083] The embodiment of the present invention uses a minimum connection number algorithm to query the number of connections of each server to the model container according to the monitoring address of the server, and uses the load balancing component to connect the allocated model container to the server with the smallest number of connections.
[0084] The embodiment of the present invention uses container encapsulation technology to convert the network model into a container, increasing the adaptability of the model in different servers. In addition, the embodiment of the present invention configures a load balancing component to transfer the request data to the container, and connects the container to an idle server to prevent resource competition. The dynamic scaling technology is further used to adjust the number of POD units of each container, which can achieve a reasonable allocation of memory resources. The embodiment of the present invention can dynamically allocate resources for multiple network models.
[0085] like Figure 4 FIG. 1 is a schematic diagram of a module of a resource allocation device based on multiple models according to the present invention.
[0086] The multi-model-based resource allocation device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the multi-model-based resource allocation device can include a container construction module 101, a tag configuration module 102, a request distribution module 103, and a resource dynamic retrieval module 104. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0087] In this embodiment, the functions of each module / unit are as follows:
[0088] The container construction module 101 is used to obtain multiple network models, encapsulate the operating environment of each network model using pre-built container encapsulation technology, obtain the model container of each network model, and store the address information of each model container in a load balancing component.
[0089] In the embodiment of the present invention, the network model can be different speech recognition models. Different network models will be affected by the environment of different servers. In order to ensure that each network model can have a good effect in different servers, the embodiment of the present invention encapsulates the network model and constructs it into a container.
[0090] In detail, the embodiment of the present invention obtains the dependency package of the network model to obtain the operating environment of the network model; and uses the pre-built container encapsulation technology to encapsulate the operating environment to obtain the model container of each network model.
[0091] In an embodiment of the present invention, the container encapsulation technology may be Docker container technology, wherein Docker is an open source application container engine for encapsulating and generating a lightweight, portable container. In an embodiment of the present invention, by encapsulating the network model to obtain each model container, resource restriction and isolation of different network models can be achieved.
[0092] Furthermore, the load balancing component in the embodiment of the present invention is an nginx component, which is used to provide a load balancing service for request data sent by a user terminal.
[0093] The label configuration module 102 is used to call the pre-built POD unit in each of the model containers to obtain the POD unit set of the model container and generate a service label of the POD unit set.
[0094] In the embodiment of the present invention, the POD unit is the smallest unit that can be created and deployed in Kubernetes, and is an application instance in the Kubernetes cluster. In the embodiment of the present invention, one model container can call multiple POD units, and each POD unit shares the computing space resources of the same server, which can achieve the effect of efficiently exchanging information.
[0095] In detail, the label configuration module 102 is specifically used for:
[0096] Run the model container to obtain a quantity set of the POD units required to run the model container under multiple preset situations; set a quantity interval of the POD units in the model container according to the quantity set, randomly call any number of POD units within the quantity interval, and obtain a POD unit set of the model container; set an elastic scaling monitoring object and an automatic scaling object, and generate a service tag according to the quantity interval of the POD units and the elastic scaling monitoring object and the automatic scaling object.
[0097] The embodiment of the present invention can utilize pre-built test cases to run each model container, record the number of POD units called in each model container, and form the number set.
[0098] In one application example of the present invention, the data set may be [3, 4, 5, 7, 8, 9, 6], and [3, 9] is set as the number interval of the POD units. When the model container is started, in order to speed up the processing, the number of POD units in the number interval may be randomly retrieved. For example, in the embodiment of the present invention, the value may be 3, and the POD unit set may be (POD1, POD2, POD3).
[0099] Furthermore, the embodiment of the present invention sets an elastic scaling monitoring object and an automatic scaling object, and constructs a service tag using the quantity interval. The automatic scaling object can delete a POD unit, or import a pre-built POD unit, and the elastic scaling monitoring object can monitor the quantity change of the POD units in the POD unit set in real time.
[0100] The request distribution module 103 is used to use the load balancing component to receive the request data set transmitted by the user end, match the request address in each request data in the request data set with the address information of the model container, and distribute the request data to the corresponding model container according to the matching result.
[0101] In the embodiment of the present invention, the request data set is a collection of request data, wherein the request data may be request information for obtaining resources sent by the user end to the server end.
[0102] In the embodiment of the present invention, the request data includes a request address and a request content. In detail, the request distribution module 103 is specifically used to: intercept the request data set sent by the user end using the HTTP protocol in the load balancing component; obtain the request address and request content included in each request data in the request data set; match the request address with the address information of the model container stored in the load balancing component to obtain a matching result.
[0103] Furthermore, the embodiment of the present invention sends the request content in the request data to the model container matched by the request address according to the matching result.
[0104] The embodiment of the present invention utilizes the load balancing component to distribute the request data to different model containers to improve the response capabilities of the multiple network models and eliminate single points of failure, thereby improving the availability of the network models.
[0105] The resource dynamic retrieval module 104 is used to split the request content in the request data to obtain a request block set, and according to the request block set, dynamically adjust the number of POD units in the corresponding POD unit set using the service label corresponding to the allocated model container, and use the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set.
[0106] In the embodiment of the present invention, each POD unit can call the computing resource space in the server. To ensure fast computing of the model container, the request content needs to be distributed to multiple POD units.
[0107] In detail, in an embodiment of the present invention, the resource dynamic call module 104 is specifically used to: monitor the number of POD units in the POD unit set according to the number of request blocks in the request block set, using the elastic scaling monitoring object in the service tag, and increase or delete the POD units in the POD unit set using the automatic scaling object in the service tag; when the number of POD units is equal to the number of request blocks in the request block set or reaches the upper limit of the number range, stop adding the POD units and allocate one POD unit to each request block.
[0108] Further, in an embodiment of the present invention, the step of using the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set includes:
[0109] Monitoring the remaining space in the memory computing space in the server, and when the remaining space is greater than the consumed space of the POD unit set, using the POD unit set to receive memory resources and perform data processing on the request block set;
[0110] When the remaining space is less than the consumed space of the POD unit set, the preset elimination strategy is used to clean up the memory computing space of the server until the remaining space is greater than the consumed space of the POD unit set, and the POD unit set is used to receive memory resources to perform data processing on the request block set.
[0111] In the embodiment of the present invention, the elimination strategy uses the remote dictionary service (Redis) to set the maximum memory instruction (maxmemory). When the memory usage in the server is greater than maxmemory, the POD units in other containers that are least recently used are preferentially deleted to achieve the effect of clearing memory.
[0112] In detail, in another embodiment of the present invention, the resource dynamic retrieval module 104 can also be used to:
[0113] Detect the number of connections to the model container on each server;
[0114] The allocated model container is connected to the server having the smallest number of connections to the model container.
[0115] The embodiment of the present invention uses a minimum connection number algorithm to query the number of connections of each server to the model container according to the monitoring address of the server, and uses the load balancing component to connect the allocated model container to the server with the smallest number of connections.
[0116] The embodiment of the present invention uses container encapsulation technology to convert the network model into a container, increasing the adaptability of the model in different servers. In addition, the embodiment of the present invention configures a load balancing component to transfer the request data to the container, and connects the container to an idle server to prevent resource competition. The dynamic scaling technology is further used to adjust the number of POD units of each container, which can achieve a reasonable allocation of memory resources. The embodiment of the present invention can dynamically allocate resources for multiple network models.
[0117] like Figure 5 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing a resource allocation method based on multiple models according to the present invention.
[0118] The electronic device 1 may include a processor 10 , a memory 11 , and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10 , such as a multi-model-based resource allocation program 12 .
[0119] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. The memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device 1, such as the code of the resource allocation program 12 based on multiple models, but also be used to temporarily store data that has been output or is to be output.
[0120] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing a resource allocation program based on multiple models, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
[0121] The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0122] Figure 5 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 5The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0123] For example, although not shown, the electronic device 1 may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, etc. The electronic device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0124] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices.
[0125] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0126] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0127] The multi-model based resource allocation program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple computer programs, and when running in the processor 10, it can achieve:
[0128] Acquire multiple network models, encapsulate the operating environment of each network model using a pre-built container encapsulation technology, obtain a model container of each network model, and store address information of each model container in a load balancing component;
[0129] In each of the model containers, a pre-built POD unit is called to obtain a POD unit set of the model container, and a service label of the POD unit set is generated;
[0130] Utilizing the load balancing component, receiving a request data set transmitted by a user end, matching a request address in each request data in the request data set with the address information of the model container, and distributing the request data to a corresponding model container according to the matching result;
[0131] The request content in the request data is split to obtain a request block set, and according to the request block set, the number of POD units in the corresponding POD unit set is dynamically adjusted using the service label corresponding to the allocated model container, and the POD unit set is used to obtain computing space resources from a pre-built server to perform data processing on the request block set.
[0132] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0133] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0134] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:
[0135] Acquire multiple network models, encapsulate the operating environment of each network model using a pre-built container encapsulation technology, obtain a model container of each network model, and store address information of each model container in a load balancing component;
[0136] In each of the model containers, a pre-built POD unit is called to obtain a POD unit set of the model container, and a service label of the POD unit set is generated;
[0137] Utilizing the load balancing component, receiving a request data set transmitted by a user end, matching a request address in each request data in the request data set with the address information of the model container, and distributing the request data to a corresponding model container according to the matching result;
[0138] The request content in the request data is split to obtain a request block set, and according to the request block set, the number of POD units in the corresponding POD unit set is dynamically adjusted using the service label corresponding to the allocated model container, and the POD unit set is used to obtain computing space resources from a pre-built server to perform data processing on the request block set.
[0139] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0140] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0141] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0142] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0143] Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any associated diagram mark in the claims should not be regarded as limiting the claims involved.
[0144] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0145] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A resource allocation method based on multiple models, characterized in that: The method comprises: Acquire multiple network models, encapsulate the operating environment of each network model using a pre-built container encapsulation technology, obtain a model container of each network model, and store address information of each model container in a load balancing component; Run the model container to obtain a quantity set of POD units required to run the model container under multiple preset situations, set a quantity interval of POD units in the model container according to the quantity set, randomly call any number of POD units in the quantity interval to obtain a POD unit set of the model container, set an elastic scaling monitoring object and an automatic scaling object, and generate a service tag according to the quantity interval of the POD units and the elastic scaling monitoring object and the automatic scaling object; Utilizing the load balancing component, receiving a request data set transmitted by a user end, matching a request address in each request data in the request data set with the address information of the model container, and distributing the request data to a corresponding model container according to the matching result; Performing request splitting on the request content in the request data to obtain a request block set, and dynamically adjusting the number of POD units in the corresponding POD unit set using the service label corresponding to the allocated model container according to the request block set, and obtaining computing space resources from a pre-built server using the POD unit set to perform data processing on the request block set; The dynamically adjusting the number of POD units in the corresponding POD unit set according to the request block set and using the service tag corresponding to the allocated model container includes: monitoring the number of POD units in the POD unit set according to the number of request blocks in the request block set and using the elastic scaling monitoring object in the service tag, and increasing or deleting the POD units in the POD unit set by using the automatic scaling object in the service tag; when the number of POD units is equal to the number of request blocks in the request block set or reaches the upper limit of the number interval, stopping increasing the POD units and allocating one POD unit to each request block; Before using the POD unit set to obtain computing space resources from the pre-built server to perform data processing on the request block set, the method further includes: detecting the number of connections of the model container of each server; connecting the allocated model container to the server with the smallest number of model container connections; The method of using the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set includes: monitoring the remaining space in the memory computing space of the server, and when the remaining space is less than the consumed space of the POD unit set, using a preset elimination strategy to clean up the memory computing space of the server until the remaining space is greater than the consumed space of the POD unit set, and using the POD unit set to receive memory resources to perform data processing on the request block set; The method utilizes the load balancing component to receive a request data set transmitted by a user end, and matches the request address in each request data in the request data set with the address information of the model container, including: utilizing the HTTP protocol in the load balancing component to intercept the request data set sent by the user end; obtaining the request address and request content included in each request data in the request data set; matching the request address with the address information of the model container stored in the load balancing component to obtain a matching result.
2. The multi-model based resource allocation method according to claim 1, characterized in that: The method of using the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set includes: When the remaining space is greater than the consumed space of the POD unit set, the POD unit set is used to receive memory resources and perform data processing on the request block set.
3. The multi-model based resource allocation method according to any one of claims 1 to 2, characterized in that: The method of encapsulating the operating environment of each network model by using the pre-built container encapsulation technology to obtain the model container of each network model includes: Obtaining the dependency packages of the network model to obtain the operating environment of the network model; The operating environment is encapsulated using a pre-built container encapsulation technology to obtain a model container for each of the network models.
4. A resource allocation device based on multiple models, used to implement the resource allocation method based on multiple models as described in any one of claims 1 to 3, characterized in that: The device comprises: A container construction module, used to obtain multiple network models, encapsulate the operating environment of each network model using a pre-built container encapsulation technology, obtain a model container of each network model, and store the address information of each model container in a load balancing component; A label configuration module, used to call a pre-built POD unit in each of the model containers, obtain a POD unit set of the model container, and generate a service label of the POD unit set; A request distribution module, used to use the load balancing component to receive a request data set transmitted by a user end, match the request address in each request data in the request data set with the address information of the model container, and distribute the request data to the corresponding model container according to the matching result; A resource dynamic retrieval module is used to split the request content in the request data to obtain a request block set, and according to the request block set, dynamically adjust the number of POD units in the corresponding POD unit set using the service label corresponding to the allocated model container, and use the POD unit set to obtain computing space resources from a pre-built server to perform data processing on the request block set.
5. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor to enable the at least one processor to perform the resource allocation method based on multiple models as claimed in any one of claims 1 to 3.
6. A computer-readable storage medium, comprising a data storage area and a program storage area, wherein the data storage area stores created data and the program storage area stores a computer program; characterized in that: When the computer program is executed by a processor, the multi-model-based resource allocation method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Container scheduling method associated with time based on Kubernetes container cluster
CN109783218A
Container resource allocation method and device, computer equipment and storage medium
CN110597623A
