Operation execution method and device
By identifying the threads corresponding to resource specifications in the thread pool of the serverless computing platform and assigning operation requests to the corresponding threads, the problem that thread-level performance isolation is difficult to ensure execution stability is solved, and efficient resource isolation and stable operation execution are achieved.
Patent Information
- Application Number
- CN202411756172.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-04-25
AI Technical Summary
In serverless computing platforms, thread-level performance isolation is difficult to ensure the execution stability of user operations, and resource competition leads to resource allocation being unable to be guaranteed.
By identifying the thread corresponding to the resource specification in the thread pool, the operation request is assigned to the corresponding thread, so that it calls the matching resource to perform operations, ensuring that the thread resource allocation matches the resource specification and avoiding resource competition.
It realizes that while reducing performance isolation resource overhead and improving efficiency, ensures the stability of operation execution, avoids resource competition, and improves resource utilization.
Smart Images

Figure CN119883595A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an operation execution method and device. Background Art
[0002] Serverless computing enables the execution of business logic-related codes uploaded by users without the users being aware of the server. With serverless computing, users do not need to worry about the management of the underlying servers and can focus on writing code. This greatly reduces the burden on users to run their business. Therefore, serverless computing is becoming more and more popular among users.
[0003] The serverless computing platform may execute multiple user-requested operations at the same time, and it is necessary to ensure the performance isolation between the execution of the operations requested by the multiple users. Performance isolation means that the resources used by the operation execution are not affected by the resource occupation of other operations.
[0004] Performance isolation can be divided into process-level performance isolation and thread-level performance isolation. Among them, process-level performance isolation has large resource overhead and low management efficiency. Thread-level performance isolation is lightweight performance isolation with low resource overhead and high management efficiency. However, there is resource competition between different threads, resulting in the inability to guarantee resource allocation for a single thread, making it difficult to guarantee the execution stability of user operations. Summary of the invention
[0005] The present application provides an operation execution method and device, which can ensure the execution stability of the operation while reducing the resource overhead of performance isolation and improving the efficiency of performance isolation.
[0006] In a first aspect, an operation execution method is provided, which is applied to an operation execution device, the device is connected to an infrastructure, the infrastructure includes at least one data center, each of the at least one data center is provided with at least one server, and each of the at least one server has resources that can be used for thread execution operations; the method includes: receiving a first operation request issued by a first user; wherein the first operation request corresponds to a first resource specification; identifying a first thread corresponding to the first resource specification in a thread pool; wherein the thread pool includes multiple threads, and different threads in the multiple threads correspond to different resource specifications; assigning the first operation request to the first thread; the first thread is used to call a first resource in the infrastructure that matches the first resource specification to perform the operation requested by the first operation request; wherein the first resource is a resource in one or more servers in the infrastructure. wherein the resources that can be called by the thread do not exceed the resource specification corresponding to the thread.
[0007] In this method, threads correspond to resource specifications, and threads call resources according to their corresponding resource qualifications to execute the operations performed by the operation request, thereby ensuring the resource allocation of a single thread, avoiding resource competition between different threads, and ensuring the stability of the operation execution. In addition, this method can achieve lightweight performance isolation by executing the operations requested by the thread operation request, reducing the resource overhead of performance isolation and improving the efficiency of performance isolation. In short, this method reduces the resource overhead of performance isolation and improves the efficiency of performance isolation while ensuring the stability of the operation execution.
[0008] In a possible implementation, after allocating the first operation request to the first thread, the method further includes: allocating a first resource to the first thread, so that the first thread can call the first resource to perform the operation requested by the first operation request.
[0009] In one possible implementation, the method also includes: providing a resource selection interface to the first user, the resource selection interface including indication information of the first resource specification; receiving a resource selection operation issued by the first user for the indication information; and based on the resource selection operation, confirming that the first operation request corresponds to the first resource specification.
[0010] In this implementation method, users can select resource specifications, thereby enabling on-demand purchase or rental, thereby improving user experience.
[0011] In a possible implementation, the method further includes: recording available resources in the infrastructure; allocating the first operation request to the first thread, including: when the available resources meet the first resource specification, allocating the first operation request to the first thread.
[0012] In this implementation, after the operation request is assigned to the thread, resources are assigned to the thread so that the thread can call the resources to perform the operation requested by the operation request. That is, before the thread is assigned to the operation request, the thread does not occupy resources. After the thread is assigned to the operation request, the thread occupies resources. In this way, the utilization rate of resources can be improved.
[0013] In a possible implementation, the first thread uses the first resource to execute the operation requested by the first operation request in the sandbox. Different threads execute the operations requested by different operation requests in different sandboxes. In this way, the performance isolation between different operation requests can be further guaranteed.
[0014] In one possible implementation, the method also includes: receiving a second operation request issued by a second user; wherein the second operation request corresponds to a second resource specification; wherein the second resource specification is different from the first resource specification; identifying a second thread corresponding to the second resource specification in the thread pool; assigning the second operation request to the second thread; the second thread is used to call a second resource in the infrastructure that matches the second resource specification to perform the operation requested by the second operation request; wherein the second resource is a resource in one or more servers in the infrastructure, and the second resource is different from the first resource.
[0015] This method can process different operation requests and implement performance isolation between different operation requests.
[0016] In a second aspect, an operation execution device is provided, which is connected to an infrastructure, wherein the infrastructure includes at least one data center, each of the at least one data center is provided with at least one server, and each of the at least one server has resources that can be used for thread execution operations; the device includes: a receiving module, for receiving a first operation request issued by a first user; wherein the first operation request corresponds to a first resource specification; an identification module, for identifying a first thread corresponding to the first resource specification in a thread pool; wherein the thread pool includes multiple threads, and different threads in the multiple threads correspond to different resource specifications; an allocation module, for allocating the first operation request to the first thread; the first thread is used to call a first resource in the infrastructure that matches the first resource specification to execute the operation requested by the first operation request; wherein the first resource is a resource in one or more servers in the infrastructure.
[0017] In a possible implementation, after allocating the first operation request to the first thread, the allocation module is further configured to: allocate the first resource to the first thread, so that the first thread can call the first resource to perform the operation requested by the first operation request.
[0018] In one possible implementation, the receiving module is also used to: provide a resource selection interface to the first user, the resource selection interface including indication information of the first resource specification; receive a resource selection operation issued by the first user for the indication information; and based on the resource selection operation, confirm that the first operation request corresponds to the first resource specification.
[0019] In a possible implementation, the allocation module is further used to: record available resources in the infrastructure; and when the available resources meet the first resource specification, allocate the first operation request to the first thread.
[0020] In a possible implementation manner, the first thread uses the first resource to execute the operation requested by the first operation request in the sandbox.
[0021] In one possible implementation, the receiving module is also used to: receive a second operation request issued by a second user; wherein the second operation request corresponds to a second resource specification; wherein the second resource specification is different from the first resource specification; the identification module is also used to: identify a second thread corresponding to the second resource specification in the thread pool; the allocation module is also used to: allocate the second operation request to the second thread; the second thread is used to call a second resource in the infrastructure that matches the second resource specification, and execute the operation requested by the second operation request; wherein the second resource is a resource in one or more servers in the infrastructure, and the second resource is different from the first resource.
[0022] In a third aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the method provided in the first aspect.
[0023] In a fourth aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the method provided in the second aspect.
[0024] In a fifth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method provided in the first aspect.
[0025] The beneficial effects of the second to fifth aspects can be referred to the above introduction to the beneficial effects of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a schematic diagram of a system architecture provided by an embodiment of the present application;
[0027] Figure 2 It is a schematic diagram of a system architecture provided by an embodiment of the present application;
[0028] Figure 3 is a structural diagram of an operation execution device provided in an embodiment of the present application;
[0029] Figure 4 is a schematic diagram of an operation execution method provided in an embodiment of the present application;
[0030] Figure 5 is a flowchart of an operation execution method provided by an embodiment of the present application;
[0031] Figure 6is a schematic diagram of a resource selection interface provided in an embodiment of the present application;
[0032] Figure 7 is a structural diagram of an operation execution device provided in an embodiment of the present application;
[0033] Figure 8 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0034] Fig. 9 is a schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;
[0035] Fig.10 It is a structural diagram of a computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The scheme provided by the embodiment of the present application will be described below in conjunction with the accompanying drawings. In the embodiment of the present application, "multiple" means two or more, and "multiple" means two or more. "First", "second", etc. are only used to distinguish similar objects and are not necessarily used to describe a specific order or number of objects.
[0037] To facilitate understanding of the solutions provided by the embodiments of the present application, the technical terms that may be involved in the embodiments of the present application are first introduced.
[0038] Serverless computing: also known as server-aware computing, is a new paradigm of cloud computing. This model only requires cloud platform users to upload code related to business logic, and the cloud platform or serverless computing platform schedules, deploys, and executes the code, thereby greatly reducing the burden on users. Among them, related operations can be implemented by running the code.
[0039] Serverless computing code: A small code snippet uploaded by a user, which is the basic computing logic unit running on a cloud platform or serverless computing platform.
[0040] Multi-tenancy: refers to an application or service instance that can serve multiple tenants at the same time, with each tenant's data and configuration isolated. This architecture enables cloud service providers to achieve efficient resource utilization, low cost, and service flexibility.
[0041] Tenant: refers to the user who rents resources.
[0042] Sandbox: Also known as sandbox or sand table, it is a mechanism that provides isolated operation of target objects (such as programs). It is a virtual system program that can provide a lightweight isolation environment for the running target objects, so that the creation, modification, deletion, reading and other file operations of the target objects are performed in this isolation environment, and will not affect the target objects in the non-sandbox environment (such as the local environment). The sandbox can be a sandbox created by the webassembly (WASM) runtime.
[0043] Functional isolation: refers to the situation where the execution of an operation is logically as if it is monopolizing the entire language runtime, and the execution result of the operation is not affected by the execution results of other operations. Functional isolation can be used as an indicator to describe the isolation between computing instances (such as sandboxes). Taking the sandbox as an example, when an operation is executed in a sandbox, it will not be affected by the results of operations executed in other sandboxes.
[0044] Performance isolation: refers to the resources used by the execution of an operation (such as computing resources, storage resources, communication resources, etc.), which are not affected by the resource usage of other operations. Performance isolation can be used as an indicator to describe the isolation between computing instances (such as sandboxes). Taking the sandbox as an example, when an operation is executed in a sandbox, its execution performance will not be affected by operations executed in other sandboxes, for example, there will be no phenomenon of processor resource preemption.
[0045] Resources: refers to the hardware, software and data that support the execution of operations. For example, resources may include processor resources, storage resources, network resources, etc. Processor resources may include central processing unit (CPU), graphics processing unit (GPU), etc. Storage resources may include memory, video memory, hard disk, etc. Network resources may include network interface controller (NIC), bandwidth, etc. In addition, CPU, GPU, memory, hard disk, network card, etc. may be physical hardware or virtualized physical hardware.
[0046] Resource specifications: refers to the type and quantity of resources. Same resource specifications means the type and quantity of resources are the same. Different resource specifications means the type and / or quantity of resources are different.
[0047] Resource pool: refers to a collection or container of multiple resources. In fields such as cloud computing, a resource pool can refer to infrastructure.
[0048] Available resources: refers to unoccupied resources, that is, idle resources.
[0049] Infrastructure: refers to the facilities that provide computing resources, storage resources and / or network resources for computing services. The infrastructure may include at least one data center, each of which includes multiple servers, where each server may provide one or more resources.
[0050] Container: It is a virtualization technology in computer operating systems. This technology allows processes to run in a relatively independent and isolated environment (including independent file systems, namespaces, resource views, etc.), thereby simplifying the software deployment process, enhancing software portability and security, and improving system resource utilization. Container technology is widely used in service scenarios in the field of cloud computing.
[0051] WebAssembly (WASM) is a new format that is portable, small, fast-loading, and compatible with the World Wide Web. It is a bytecode standard proposed to improve the performance of performance-sensitive templates in web pages. The WebAssembly System Interface (WASI) is a new application programming interface (API) system that aims to design a set of engine-independent, non-web system-oriented API standards for WASM.
[0052] WASM module (webassembly module): is the basic deployment, loading and compilation unit of WASM.
[0053] Process: An instance of a program running in a computer. Each process has its own independent memory space and system resources.
[0054] Thread: Also known as lightweight process (LWP), it is the smallest unit of computer operation scheduling. Compared with a process, a thread is a lighter execution unit. The overhead of creating and destroying a thread is small, and a large number of threads can be created in a short time.
[0055] In a multi-tenant scenario, it is necessary to ensure performance isolation between different tenants. Among them, performance isolation can be divided into process-level performance isolation and thread-level performance isolation. In serverless computing, containers or WASM sandboxes are used to achieve performance isolation between codes. Since containers belong to the process level, there are problems such as extended cold start, high resource usage, and slow elastic expansion and contraction. WASM has the advantages of high performance, security, and light weight. Its efficient binary format makes its execution speed close to that of native code. WASM sandbox is a safe operating environment provided by WASM, which can ensure the isolation and memory safety of operations. In one solution, running the sandbox in process mode can control the resource allocation of the sandbox and avoid resource competition between different sandboxes. However, similar to containers, there are problems such as extended cold start, high resource usage, and slow elastic expansion and contraction. In another solution, running the sandbox in thread mode to achieve thread-level performance isolation. This solution can achieve lightweight deployment of sandboxes, but it cannot control the instantaneous resource allocation of a single sandbox. There is resource competition between different sandboxes running concurrently, which makes it impossible to guarantee the resource allocation of a single sandbox and it is difficult to guarantee the execution stability of user operations.
[0056] The embodiment of the present application provides an operation execution method. The method can configure threads with different resource specifications, and when receiving an operation request, the operation request can be assigned to a thread whose resource specification matches the resource specification of the operation request. The thread calls the resource matching the resource specification to execute the operation requested by the operation request. The thread can execute related operations in a sandbox.
[0057] This method can achieve lightweight deployment by executing the operation requested by the thread, which can reduce the resource overhead of performance isolation and improve the efficiency of performance isolation. The resources called by the thread match the resource specifications, thereby controlling the resource allocation of the thread, avoiding resource competition between different threads, and ensuring the execution stability of the operation.
[0058] Next, the operation execution method provided in the embodiment of the present application is introduced by examples.
[0059] Figure 1 A system architecture that can be used to implement the method is shown. The system architecture includes an operation execution device 110, an infrastructure 120, a thread pool 130, and users 141 and 142. The infrastructure 120 and the thread pool 130 are both connected to the operation execution device 110.
[0060] The infrastructure 120 may include at least one data center, each of which is provided with at least one server. Each server has resources that can be used for thread execution operations. Among them, the servers in the data center of the infrastructure 120 may be referred to as servers in the infrastructure 120, and the resources of the servers in the infrastructure 120 may be referred to as resources in the infrastructure 120. The operation executed by the thread may be running code, such as business code deployed by a user. Exemplarily, the resource may be a CPU resource. Exemplarily, the resource may be a memory resource. Exemplarily, the resource may be a GPU resource. Exemplarily, the resource may be a hard disk resource. Exemplarily, the resource may be a network resource.
[0061] The thread pool 130 includes multiple threads, wherein different threads in the multiple threads correspond to different resource specifications. Wherein, the resources that can be called by a thread do not exceed the resource specifications corresponding to the thread. In some embodiments, different threads specifically refer to different types of threads. The thread pool 130 may include multiple types of threads, wherein threads of the same type correspond to the same resource specifications, and threads of different types correspond to different resource specifications.
[0062] The operation execution device 110 can receive an operation request sent by any user such as user 141, user 142, etc., and select a thread in the thread pool 130 based on the resource specification corresponding to the operation request. The selected thread corresponds to the resource specification corresponding to the resource specification corresponding to the operation request. Then, the operation execution device 110 assigns the operation request to the selected thread. The selected thread calls the resource of the resource specification to perform the operation requested by the operation request.
[0063] In some embodiments, the operation request may be a request for serverless computing, see Figure 2 , the operation execution device 110 can be connected to or integrated into the serverless platform. The operation execution device 110 can obtain the operation request issued by the user from the serverless platform, and the operation request is sent by the user to the serverless platform. Exemplarily, after receiving the operation request sent by the user, the serverless platform can call the operation execution device 110 to process the operation request, so that the operation request can be processed according to the operation execution method provided in the embodiment of the present application. Exemplarily, the user can submit code or compiled WASM module on the serverless platform. The serverless platform schedules the operation execution device 110 to execute the code or WASM module. By calling the operation execution device 110, the serverless platform allows users to flexibly configure the required resource usage upper limit when creating tasks, realize on-demand billing, and improve resource utilization.
[0064] In some embodiments, Figure 3As shown, the operation execution device 110 may include a resource management module 111 , a thread management module 112 and an operation management module 113 .
[0065] The resource management module 111 may create threads according to the resources in the infrastructure 120 , so that the sum of resource specifications corresponding to all created threads is not greater than the resources in the infrastructure 120 .
[0066] In one example, taking CPU resources as an example, the CPU may be set to have 8 cores, each core having 1000 computing units, and the resource specification of the thread may be 250 computing units. Then 8×1000 / 250=32 may be created.
[0067] In one example, taking CPU resources as an example, the CPU may be set to have 8 cores, each core having 1000 computing units, and the resource specification of the thread may be 500 computing units. Then 8×1000 / 500=16 may be created.
[0068] In one example, taking CPU resources as an example, the CPU may be set to have 8 cores, each core having 1000 computing units, and the resource specification of the thread may be 1000 computing units. Then 8×1000 / 1000=8 may be created.
[0069] Multiple types of threads can be created using resources in infrastructure 120, where each type of thread has multiple threads. Figure 4 As shown, thread type 131, thread type 132, thread type 133, etc. can be created. Among them, each thread type has one or more threads. For example, thread type 131 has threads 131-1, thread 131-2, etc. Thread type 132 has threads 132-1, thread 132-2, etc. Thread type 133 has threads 133-1, thread 133-2, etc. Thread types and resource specifications are one-to-one corresponding, and threads under the same thread type correspond to the same resource specifications.
[0070] Exemplarily, a thread uses the resources of a server and does not cross servers. In this case, a thread corresponding to the server can be created based on the resources of the server. The sum of the resource specifications corresponding to the threads corresponding to the server is not greater than the resources of the server. Exemplarily, a server can be used as a host to deploy one or more virtual machines. The threads are specifically deployed in the virtual machines, and a thread uses the resources of a virtual machine and does not cross virtual machines. Exemplarily, a thread uses the resources of two or more servers, that is, the thread can cross servers. The resources used by the thread are specifically obtained by virtualizing the resources of the two or more servers.
[0071] The thread management module 112 can allocate resources to threads. When a thread is allocated to an operation request, resources can be allocated to the thread. The thread management module 112 can allocate resources to threads based on the resource specifications corresponding to the thread. The resource specifications allocated to the thread are the resources of the resource specifications corresponding to the thread. Exemplarily, the operating system of the server in the infrastructure 120 can be Linux, and the thread management module 112 can specifically be control group version 2 (controlgroup version 2, Cgroup V2). The thread management module 112 can use the Cgroup application programming interface (application programming interface, API) or the Cgroup V2 API to create a resource allocation object for each thread type. For example, a resource allocation object 1 is created for thread type 131, a resource allocation object 2 is created for thread type 132, and a resource allocation object 3 is created for thread type 133. The resource allocation object of each thread type is used to allocate resources to threads under the thread type. Exemplarily, the resource allocation object can be a Cgroup object.
[0072] The operation management module 113 can select a thread in the thread pool 130 for the operation request, and assign the operation request to the selected thread. Among them, the thread can call the resource of the resource specification corresponding to the operation request to perform the operation requested by the operation request. Exemplarily, the operation management module 113 can create a sandbox and instruct the thread to perform the operation requested by the operation request in the sandbox. Exemplarily, the operation management module 113 can be implemented as a runtime. In one example, the operation management module 113 can be implemented as a WASM runtime. The WASM runtime can create a WASM sandbox and instruct the thread to perform the operation requested by the operation request in the WASM sandbox.
[0073] In some embodiments, the operation execution device 110 also includes a request control module 114. The request control module 114 can record the available resources in the infrastructure 120. Among them, the request control module 114 can determine the available resources in the infrastructure 120 based on the resource specifications of the currently running threads. Among them, the sum of the resource specifications of the currently running threads can be calculated, and then the total resources of the infrastructure 120 are subtracted from the sum to obtain the available resources in the infrastructure 120. Exemplarily, the request control module 114 can be implemented as a global permit controller (global permit controller, GPC). The global permit controller is essentially a resource lock, which is used to globally control the maximum allocated resources. The maximum number of resources is determined by the resources of the server of the infrastructure 120 (for example, if the CPU of the server is an 8-core CPU, the maximum number of resources of the server is 8000 computing units). When executing the operation requested by the operation request, the resources are first obtained from the resource lock.
[0074] When the available resources of the infrastructure 120 meet the resource specifications corresponding to the operation request to be allocated, the operation management module 113 allocates the operation request to be allocated to the corresponding thread.
[0075] The above example introduces the system architecture provided by the embodiment of the present application. Next, taking the implementation in the system architecture as an example, the process of the operation execution method provided by the embodiment of the present application is introduced. The method can be executed by the operation execution device 110. Figure 5 As shown, the method includes the following steps.
[0076] Step 501 , the operation execution device 110 receives an operation request A1 sent by a user 141 ; wherein the operation request A1 corresponds to a resource specification B1 .
[0077] In some embodiments, the operation request A1 may refer to a request to run a business code. The business code may be developed by user 141. The operation request A1 carries the business code. In some embodiments, the operation request A1 may be to modify a business code or business data. The operation request A1 carries a modification instruction, which is used to indicate the modification to be made to the business code or business data. In some embodiments, the operation request A1 may be a request to query a business code or business data.
[0078] In some embodiments, the resource may specifically be a CPU resource, and the resource specification B1 may be any one of 250 computing power units, 500 computing power units, and 1000 computing power units.
[0079] In some embodiments, resource specification B1 indicates the resource that the user desires to use to perform the operation requested by operation request A1. For example, the operation execution device 110 may provide a resource selection interface to the user 141, and the resource selection interface displays indication information of multiple resource specifications. Figure 6 As shown, the indication information of the multiple resource specifications may include indication information of resource specification B1, indication information of resource specification B2, indication information of resource specification B3, etc. User 141 may issue a resource selection operation for the indication information of resource specification B1. The operation execution device 110 may receive the resource selection operation for the indication information of resource specification B1 issued by the user 141, and based on the resource selection operation, confirm that the operation request A1 issued by the user corresponds to resource specification B1.
[0080] In some embodiments, the resource specification B1 may represent the resources required to perform the operation requested by the operation request A1. The operation execution device 110 may analyze the resources required to perform the operation requested by the operation request A1 to obtain the resource specification B1.
[0081] Step 502 , the operation execution device 110 identifies the thread C1 corresponding to the resource specification B1 in the thread pool 130 .
[0082] As described above, the thread pool 130 includes a plurality of threads, and different threads in the plurality of threads correspond to different resource specifications. In some embodiments, different threads specifically refer to threads of different thread types. The thread pool 130 may include a plurality of thread types, and the thread types and resource specifications correspond one to one, and each thread line has one or more threads. In step 502, the thread type corresponding to the resource specification B1 may be first identified, and then at least one thread under the identified thread type may be used as thread C1. Exemplarily, at least one idle thread under the identified thread type may be specifically used as thread C1. For example, the identifiable resource specification B1 corresponds to thread type 131, wherein thread 131-1 under thread type 131, and then thread 131-1 under thread type 131 may be used as thread C1.
[0083] Step 503 , the operation execution device 110 assigns the operation request A1 to the thread C1 ; the thread C1 is used to call the resource D1 in the infrastructure 120 that matches the resource specification B1 to execute the operation requested by the operation request A1 ; wherein the resource D1 is a resource in one or more servers in the infrastructure 120 .
[0084] In some embodiments, resource specification B1 consists of resource type and resource amount. Resource D1 matches resource specification B1, which means that the resource type of resource D1 is the same as the resource type of resource specification B1, and the resource amount of resource D1 is greater than or equal to the resource amount of resource specification B1.
[0085] In some embodiments, after the operation request A1 is assigned to the thread C1, the operation execution device 110 assigns the resource D1 to the thread C1, so that the thread C1 can call the resource D1 to execute the operation requested by the operation request A1. That is, before the thread is assigned to the operation request, the thread does not occupy the resources in the infrastructure 120. After the thread is assigned to the operation request, the thread occupies the resources in the infrastructure 120. In this way, the utilization rate of the resources in the infrastructure 120 can be improved.
[0086] In some embodiments, when a thread is created, resources that match the resource specifications corresponding to the thread can be allocated to the thread. In this way, whenever the thread is allocated an operation request, it does not need to wait for resource allocation, and can immediately execute the operation requested by the operation request, thereby improving the execution efficiency of the operation.
[0087] In some embodiments, the operation execution device 110 records the available resources in the infrastructure 120. Exemplarily, the operation execution device 110 may determine the available resources in the infrastructure 120 based on the resource specifications of the currently running threads. The sum of the resource specifications of the currently running threads may be calculated, and then the sum may be subtracted from the total amount of resources of the infrastructure 120 to obtain and record the available resources in the infrastructure 120. Before the operation request A1 is assigned to the thread C1, it may be determined whether the available resources in the infrastructure 120 meet the resource specification B1. The resource specification B1 consists of a resource type and a resource amount. If the resource amount of the resource of the resource type in the available resources is greater than or equal to the resource amount in the resource specification B1, it is confirmed that the available resources in the infrastructure 120 meet the resource specification B1. If the resource amount of the resource of the resource type in the available resources is less than the resource amount in the resource specification B1, it is confirmed that the available resources in the infrastructure 120 do not meet the resource specification B1. When the available resources in the infrastructure 120 meet the resource specification B1, the operation request A1 is assigned to the thread C1. When the available resources in the infrastructure 120 do not meet the resource specification B1, the operation execution device 110 may reject the operation request A1, or wait until the available resources in the infrastructure 120 meet the resource specification B1 before allocating the operation request A1 to the thread C1.
[0088] In some embodiments, thread C1 uses resource D1 to perform the operation requested by operation request A1 in the sandbox. After identifying thread C1, the operation execution device 110 can create a sandbox and instruct thread C1 to perform the operation requested by operation request A1 in the sandbox. In this way, performance isolation of different operation requests can be achieved. Exemplarily, the sandbox can be a WASM sandbox, and the operation execution device 110 can call the WASM runtime to create a WASM sandbox.
[0089] The above takes the processing of the operation request issued by user 141 as an example to introduce the operation execution method provided by the embodiment of the present application. The method can process the operation requests issued by different users, and the resource specifications corresponding to the operation requests issued by the users can be the same or different. Figure 5 As shown, in step 504, the operation execution device 110 can also receive an operation request A2 issued by the user 142; wherein the operation request A2 corresponds to the resource specification B1; wherein the resource specification B2 is different from the resource specification B1; in step 505, the operation execution device 110 identifies the thread C2 corresponding to the resource specification B2 in the thread pool 130; in step 506, the operation execution device 110 assigns the operation request B2 to the thread C2; the thread C2 is used to call the resource D2 in the infrastructure 120 that matches the resource specification B2, and execute the operation requested by the operation request A2; wherein the resource D2 is a resource in one or more servers in the infrastructure 120, and the resource D1 is different from the resource D2. Exemplarily, the difference between the resource specification B2 and the resource specification B1 is specifically the resource type, and the resource type of the resource D1 is different from the resource type of the resource D2. Exemplarily, the difference between the resource specification B2 and the resource specification B1 is specifically the resource quantity, and the resource quantity of the resource D1 is different from the resource quantity of the resource D2.
[0090] In summary, the operation execution method provided in the embodiment of the present application can realize lightweight deployment by executing the operation requested by the operation request through the thread, which can reduce the resource overhead of performance isolation and improve the efficiency of performance isolation. The resources called by the thread match the resource specifications, thereby controlling the resource allocation of the thread, avoiding resource competition between different threads, and ensuring the execution stability of the operation.
[0091] Based on the above description, an embodiment of the present application provides an operation execution device 700. The device 700 is connected to an infrastructure, and the infrastructure includes at least one data center, each of the at least one data center is provided with at least one server, and each of the at least one server has resources that can be used for thread execution operations. Figure 7 As shown, the apparatus 700 includes:
[0092] The receiving module 710 is configured to receive a first operation request sent by a first user; wherein the first operation request corresponds to a first resource specification;
[0093] An identification module 720 is used to identify a first thread corresponding to the first resource specification in a thread pool; wherein the thread pool includes a plurality of threads, and different threads in the plurality of threads correspond to different resource specifications;
[0094] The allocation module 730 is used to allocate the first operation request to the first thread; the first thread is used to call the first resource in the infrastructure that matches the first resource specification to perform the operation requested by the first operation request; wherein the first resource is a resource in one or more servers in the infrastructure.
[0095] Among them, the receiving module 710, the identification module 720 and the allocation module 730 can all be implemented by software, or can be implemented by hardware. Exemplarily, the implementation of the receiving module 710 is introduced below by taking the receiving module 710 as an example. Similarly, the implementation of the identification module 720 and the allocation module 730 can refer to the implementation of the receiving module 710.
[0096] As an example of a software functional unit, the receiving module 710 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the receiving module 710 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code can be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code can be distributed in the same availability zone AZ or in different AZs, and each AZ includes a data center or multiple data centers with close geographical locations. Among them, usually a region can include multiple AZs.
[0097] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same VPC or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0098] As an example of a hardware functional unit, the receiving module 710 may include at least one computing device, such as a server, etc. Alternatively, the receiving module 710 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0099] The multiple computing devices included in the receiving module 710 can be distributed in the same region or in different regions. The multiple computing devices included in the receiving module 710 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the receiving module 710 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0100] It should be noted that, in other embodiments, the receiving module 710 may be used to execute Figure 5 In any step of the method shown, the identification module 720 can be used to perform Figure 5 In any step of the method shown, the allocation module 730 can be used to perform Figure 5 The steps implemented by the receiving module 710, the identifying module 720 and the allocating module 730 can be specified as needed, and the steps implemented by the receiving module 710, the identifying module 720 and the allocating module 730 can be specified as needed. Figure 5 The different steps in the method shown are used to implement the overall functions of the apparatus 700 .
[0101] The present application also provides a computing device 800. Figure 8 As shown, the computing device 800 includes: a bus 802, a processor 804, a memory 806, and a communication interface 808. The processor 804, the memory 806, and the communication interface 808 communicate through the bus 802. The computing device 800 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 800.
[0102] The bus 802 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus 802 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 802 may include a path for transmitting information between various components of the computing device 800 (eg, the memory 806, the processor 804, and the communication interface 808).
[0103] The processor 804 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0104] The memory 806 may include a volatile memory, such as a random access memory (RAM). The memory 806 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0105] The memory 806 stores executable program codes, and the processor 804 executes the executable program codes to respectively implement the functions of the aforementioned receiving module 710, the identification module 720, and the allocation module 730, thereby implementing Figure 5 That is, the memory 806 stores the method for executing Figure 5 Instructions for the method shown.
[0106] The communication interface 808 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or communication networks.
[0107] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0108] like Fig. 9 As shown, the computing device cluster includes at least one computing device 800. The memory 806 in one or more computing devices 800 in the computing device cluster may store the same Figure 5 Instructions for the method shown.
[0109] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store a program for executing Figure 5 In other words, the combination of one or more computing devices 800 can jointly execute instructions for executing Figure 5 Instructions for the method shown.
[0110] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster may store different instructions, which are respectively used to execute part of the functions of the apparatus 700. That is, the instructions stored in the memory 806 in different computing devices 800 may implement the functions of one or more modules of the receiving module 710, the identifying module 720 and the allocating module 730.
[0111] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.10 A possible implementation is shown. Fig.10 As shown, two computing devices 800A and 800B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 806 in the computing device 800A stores instructions for executing the functions of the receiving module 710. At the same time, the memory 806 in the computing device 800B stores instructions for executing the functions of the identification module 720 and the allocation module 730.
[0112] It should be understood that Fig.10 The functions of the computing device 800A shown in FIG. 8 may also be completed by multiple computing devices 800. Similarly, the functions of the computing device 800B may also be completed by multiple computing devices 800.
[0113] The present application embodiment also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Fig. 9 and Fig.10 The difference is that the memory 806 in one or more computing devices 800 in the computing device cluster may store the same memory for executing Figure 5 Instructions for the method shown.
[0114] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store a program for executing Figure 5 In other words, the combination of one or more computing devices 800 can jointly execute instructions for executing Figure 5 Instructions for the method shown.
[0115] The present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes Figure 5 The method shown.
[0116] The present application also provides a computer-readable storage medium. The computer-readable storage medium may be any available medium that can be stored by a computing device or a host migration device such as a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute Figure 5 The method shown.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present application.
Claims
1. An operation execution method, characterized in that: Applied to an operation execution device, the device is connected to an infrastructure, the infrastructure includes at least one data center, each of the at least one data center is provided with at least one server, each of the at least one server has resources that can be used for thread execution operations; the method includes: Receiving a first operation request sent by a first user; wherein the first operation request corresponds to a first resource specification; Identifying a first thread corresponding to the first resource specification in a thread pool; wherein the thread pool includes a plurality of threads, and different threads in the plurality of threads correspond to different resource specifications; The first operation request is assigned to the first thread; the first thread is used to call a first resource in the infrastructure that matches the first resource specification to perform the operation requested by the first operation request; wherein the first resource is a resource in one or more servers in the infrastructure.
2. The method according to claim 1, characterized in that: After assigning the first operation request to the first thread, the method further includes: The first resource is allocated to the first thread, so that the first thread can call the first resource to perform the operation requested by the first operation request.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: a resource selection interface provided to the first user, the resource selection interface including indication information of the first resource specification; receiving a resource selection operation for the indication information issued by the first user; Based on the resource selection operation, it is confirmed that the first operation request corresponds to the first resource specification.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: recording available resources in the infrastructure; The allocating the first operation request to the first thread includes: when the available resources meet the first resource specification, allocating the first operation request to the first thread.
5. The method according to any one of claims 1 to 4, characterized in that The first thread uses the first resource to execute the operation requested by the first operation request in the sandbox.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Receiving a second operation request sent by a second user; wherein the second operation request corresponds to a second resource specification; wherein the second resource specification is different from the first resource specification; identifying, in the thread pool, a second thread corresponding to the second resource specification; The second operation request is assigned to the second thread; the second thread is used to call a second resource in the infrastructure that matches the second resource specification to perform the operation requested by the second operation request; wherein the second resource is a resource in one or more servers in the infrastructure, and the second resource is different from the first resource.
7. An operation execution device, characterized in that: The device is connected to an infrastructure, the infrastructure includes at least one data center, each of the at least one data center is provided with at least one server, each of the at least one server has resources that can be used for thread execution operations; the device includes: A receiving module, configured to receive a first operation request sent by a first user; wherein the first operation request corresponds to a first resource specification; an identification module, configured to identify a first thread corresponding to the first resource specification in a thread pool; wherein the thread pool includes a plurality of threads, and different threads in the plurality of threads correspond to different resource specifications; An allocation module is used to allocate the first operation request to the first thread; the first thread is used to call a first resource in the infrastructure that matches the first resource specification to perform the operation requested by the first operation request; wherein the first resource is a resource in one or more servers in the infrastructure.
8. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 6.
10. A computer program product comprising instructions, characterized in that When the instructions are executed by a computer device cluster, the computer device cluster executes the method according to any one of claims 1 to 6.