CN113905083A - User code operation method and device, electronic equipment and storage medium - Google Patents

User code operation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113905083A
CN113905083A CN202111205652.5A CN202111205652A CN113905083A CN 113905083 A CN113905083 A CN 113905083A CN 202111205652 A CN202111205652 A CN 202111205652A CN 113905083 A CN113905083 A CN 113905083A
Authority
CN
China
Prior art keywords
user terminal
computing
computing node
user
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN202111205652.5A
Other languages
Chinese (zh)
Inventor
张宁
杨子骁
邹雨竹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Sensetime Lingang Intelligent Technology Co Ltd
Original Assignee
Shanghai Sensetime Lingang Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Sensetime Lingang Intelligent Technology Co Ltd filed Critical Shanghai Sensetime Lingang Intelligent Technology Co Ltd
Priority to CN202111205652.5A priority Critical patent/CN113905083A/en
Publication of CN113905083A publication Critical patent/CN113905083A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1023Server selection for load balancing based on a hash applied to IP addresses or costs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The disclosure relates to a user code running method and device, an electronic device and a storage medium, wherein the method comprises the following steps: the gateway responds to a connection request received from a user terminal, determines a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant, establishes connection between a target computing node in the computing cluster and the user terminal, sends a user code sent by the user terminal to the target computing node, and feeds back an operation result of the target computing node on the user code to the user terminal. According to the embodiment of the disclosure, the isolation of computing resources with tenants as the granularity can be supported, each tenant can correspond to one computing cluster, and according to a connection request sent by each user terminal, a gateway can flexibly match a suitable target computing node for each user terminal, so that the user terminal is directly connected with the target computing node in the corresponding computing cluster, thereby saving hardware resources required by user code operation and improving the user code operation efficiency.

Description

User code operation method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a user code operation method and apparatus, an electronic device, and a storage medium.
Background
With the rapid development of artificial intelligence, various systems relying on code operation are also developed. Not only is the code more and more diverse, but it also places higher and higher demands on the functionality that the system can provide.
In the related art, an online programming platform generally used for user code running creates and maintains an independent code running environment, such as Kernel (i.e., an environment capable of indirectly running code on a browser), for each user, where the running environment has its own independent running space, including memory, disk, processor, and the like. However, in the face of increasingly complex codes, the cost of servers required by an online programming education platform is increased sharply, the resource utilization rate is not high enough, the popularization and the promotion are difficult, and the adaptation to the future public cloud architecture is difficult.
Disclosure of Invention
The present disclosure proposes a user code execution scheme.
According to an aspect of the present disclosure, there is provided a user code execution method, which is applied to a gateway, the method including: responding to a connection request received from a user terminal, and determining a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant according to the connection request, wherein the computing cluster comprises at least one computing node; establishing connection between a target computing node in the computing cluster and the user terminal; sending the user code sent by the user terminal to the target computing node; and feeding back the operation result of the target computing node to the user code to the user terminal.
In one possible implementation, establishing a connection between a target computing node in the computing cluster and the user terminal includes: selecting the target computing node from a computing cluster corresponding to the tenant to which the user terminal belongs according to a load balancing strategy; and establishing the connection between the target computing node and the user terminal.
In one possible implementation manner, the at least one computing node is deployed in servers with different configurations, and establishing a connection between a target computing node in the computing cluster and the user terminal includes: determining computational resources required by the user code according to the connection request of the user terminal; according to the computing resources, determining a target server supporting the computing resources from the servers with different configurations; and establishing the connection between the target computing node corresponding to the target server and the user terminal.
In one possible implementation, the method further includes: and after the running result of the target computing node to the user code is fed back to the user terminal, disconnecting the target computing node in the computing cluster from the user terminal.
According to an aspect of the present disclosure, there is provided a user code running method, the method being applied to a server, the server being deployed with at least one computing cluster, one computing cluster including at least one computing node, the method including: establishing connection with a user terminal through a gateway, wherein the computing node is a target computing node in at least one computing node in a computing cluster corresponding to a tenant to which the user terminal belongs; receiving a user code sent by the user terminal through the gateway; operating the user code to obtain an operating result; and feeding back the operation result to the user terminal through the gateway.
In a possible implementation manner, executing the user code to obtain an execution result includes: placing the user code as a running task in a task queue; acquiring the running task from the task queue; and executing the running task to obtain the running result.
In one possible implementation manner, the computing node includes a service execution environment and a code execution environment, and executes the user code to obtain an execution result, including: in the service execution environment, placing the user code as a running task in the task queue, and acquiring the running task from the task queue; and executing the running task in the code execution environment to obtain the running result.
In one possible implementation, the method further includes: and after the operation result is fed back to the user terminal through the gateway and the connection with the user terminal is disconnected through the gateway, the computing node releases the computing resources corresponding to the operation task.
In one possible implementation, the method further includes: monitoring the queuing congestion degree of the task queue of each computing node in each computing cluster deployed on a server; and adjusting the number of the computing nodes of each computing cluster according to the queuing congestion degree.
According to an aspect of the present disclosure, there is provided a user code execution apparatus, which is applied to a gateway, the apparatus including: the system comprises a determining module, a processing module and a sending module, wherein the determining module is used for responding to a connection request of a user terminal, determining a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant according to the connection request, and the computing cluster comprises at least one computing node; the connection module is used for establishing the connection between a target computing node in the computing cluster and the user terminal; a sending module, configured to send a user code sent by the user terminal to the target computing node; and the first feedback module is used for feeding back the operation result of the target computing node to the user code to the user terminal.
In one possible implementation, the connection module is configured to: selecting the target computing node from a computing cluster corresponding to the tenant to which the user terminal belongs according to a load balancing strategy; and establishing the connection between the target computing node and the user terminal.
In one possible implementation, the at least one computing node is deployed in servers of different configurations, and the connection module is configured to: determining computational resources required by the user code according to the connection request of the user terminal; according to the computing resources, determining a target server supporting the computing resources from the servers with different configurations; and establishing the connection between the target computing node corresponding to the target server and the user terminal.
In one possible implementation, the apparatus further includes a first disconnection module configured to: and after the running result of the target computing node to the user code is fed back to the user terminal, disconnecting the target computing node in the computing cluster from the user terminal.
According to an aspect of the present disclosure, there is provided a user code running apparatus, the apparatus being applied to a server, the server being deployed with at least one computing cluster, one computing cluster including at least one computing node, the apparatus including: the system comprises an establishing module, a processing module and a processing module, wherein the establishing module is used for establishing connection with a user terminal through a gateway, and the computing node is a target computing node in at least one computing node in a computing cluster corresponding to a tenant to which the user terminal belongs; a receiving module, configured to receive, through the gateway, a user code sent by the user terminal; the operation module is used for operating the user code to obtain an operation result; and the second feedback module is used for feeding back the operation result to the user terminal through the gateway.
In one possible implementation, the execution module is configured to: placing the user code as a running task in a task queue; acquiring the running task from the task queue; and executing the running task to obtain the running result.
In one possible implementation, the computing node includes a service execution environment and a code execution environment, and the execution module is configured to: in the service execution environment, placing the user code as a running task in the task queue, and acquiring the running task from the task queue; and executing the running task in the code execution environment to obtain the running result.
In one possible implementation, the apparatus further includes a second disconnection module configured to: and after the operation result is fed back to the user terminal through the gateway and the connection with the user terminal is disconnected through the gateway, the computing node releases the computing resources corresponding to the operation task.
In one possible implementation manner, the apparatus further includes an adjusting module configured to: monitoring the queuing congestion degree of the task queue of each computing node in each computing cluster deployed on a server; and adjusting the number of the computing nodes of each computing cluster according to the queuing congestion degree.
According to an aspect of the present disclosure, there is provided an electronic device including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the memory-stored instructions to perform the above-described method.
According to an aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the above-described method.
In the embodiment of the disclosure, in response to receiving a connection request of a user terminal, a gateway determines a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant, establishes connection between a target computing node in the computing cluster and the user terminal, sends a user code sent by the user terminal to the target computing node, and feeds back an operation result of the target computing node on the user code to the user terminal. By the method, the isolation of computing resources with tenants (including a plurality of users) as granularity can be supported, each tenant can correspond to one computing cluster, and according to the connection request sent by each user terminal, the gateway can flexibly match a proper target computing node for each user terminal, so that the user terminal is directly connected with the target computing node in the corresponding computing cluster, hardware resources required by user code operation are saved, and the user code operation efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
Fig. 1 shows a flowchart of a user code execution method according to an embodiment of the present disclosure.
Fig. 2 shows a flow chart of a user code execution method according to an embodiment of the present disclosure.
Fig. 3 shows a schematic diagram of a user node according to an embodiment of the present disclosure.
Fig. 4 shows a schematic diagram of a user code execution method according to an embodiment of the present disclosure.
Fig. 5 shows a block diagram of a user code execution apparatus according to an embodiment of the present disclosure.
Fig. 6 shows a block diagram of a user code execution apparatus according to an embodiment of the present disclosure.
Fig. 7 shows a block diagram of an electronic device according to an embodiment of the disclosure.
Fig. 8 illustrates a block diagram of an electronic device in accordance with an embodiment of the disclosure.
Detailed Description
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the present disclosure.
Fig. 1 is a flowchart illustrating a user code execution method according to an embodiment of the present disclosure, which is applied to a gateway, and as shown in fig. 1, the user code execution method includes:
in step S11, in response to receiving a connection request of a user terminal, determining, according to the connection request, a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant, where the computing cluster includes at least one computing node;
in step S12, establishing a connection between a target computing node in the computing cluster and the user terminal;
in step S13, sending the user code sent by the user terminal to the target computing node;
in step S14, the operation result of the target computing node on the user code is fed back to the user terminal.
In one possible implementation, a Gateway (Gateway), also called an internetwork connector, a protocol converter, i.e. a Gateway from one network to another. A gateway may act as a computer system or device that acts as a switch between two systems using different communication protocols, data formats or languages, or even completely different architectures. The gateway may be a transport gateway, an application gateway, a relay gateway, an access gateway, a protocol gateway, a security gateway, etc., and the specific type of gateway is not limited by this disclosure.
In one possible implementation, the User terminal may be a User Equipment (UE), a mobile device, a terminal, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, or the like, and the disclosure does not limit the specific form of the User terminal.
In a possible implementation manner, before step S11, a plurality of computing clusters may be pre-constructed in the server, and each computing cluster may be configured to execute processing on the respective received user code, so as to obtain an execution result.
For example, the user equipment, the gateway and the server can jointly form a programming platform, and N computing clusters can be constructed in the server in advance according to a default value N (N is larger than or equal to 1) of the programming platform; alternatively, at least one computing cluster matched with each tenant may be created according to information of each tenant (for example, the number of user terminals included in the tenant, code feature information of the tenant, and the like), and the manner of creating the computing cluster is not limited in the present disclosure.
Wherein each computing cluster may include at least one computing node. In the process of building each computing cluster, at least one computing node included in each computing cluster may be created through a containerization method. Specifically, the containerization method is a lightweight virtualization technology, and can package various applications (including applications for running user code, for example) and various components (including libraries, frameworks, other dependent items, and the like, for example) together, and move the packaged containers to a server, so that the creation of at least one computing node included in each computing cluster can be completed.
A plurality of groups of computing nodes (a group of computing nodes is also referred to as a computing cluster) may be constructed by a containerization method, where each group of computing nodes may be deployed in a Central Processing Unit (CPU) server or a Graphics Processing Unit (GPU) server, where the computing nodes on the CPU server may execute conventional codes that do not depend on GPU resources, and the computing nodes on the GPU server may execute codes that use GPU resources, such as neural network model training, image Processing, and the like. The present disclosure does not limit the type of server used to deploy the compute nodes, and the number of compute nodes deployed in the server.
It should be understood that containers are used as virtualization technology at the operating system level, each container can contain an exclusive complete user environment space, the operating environment of other containers cannot be affected by changes in one container, multiple sets of isolation environments can be delivered in the same server system, and deployed containers can share the operating system kernel. In this way, the computing clusters formed by containerization are isolated from each other.
After the computing cluster is created, in step S11, a user may input a user code to be executed through a user terminal, the user terminal may send a connection request to a gateway, the gateway receives the connection request sent by the user terminal, and a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant may be determined according to information of the request.
A tenant may contain a plurality of user terminals, for example, the tenant includes a school (e.g., a training facility), and the user terminals include terminals used by students. Assuming that there are two tenants, i.e., school X1 and school X2, schools X1 and X2 may be respectively equipped with a plurality of user terminals for students to use, the present disclosure does not limit the number of user terminals included in the tenants.
In one possible implementation, student a at school X1 may use any user terminal at that school to submit a written code using the user terminal's browser window, thereby triggering student a's user terminal to send a connection request to the gateway. The gateway receives the connection request sent by the user terminal of the student A, and can determine the school X1 to which the user terminal of the student A belongs and the computing cluster corresponding to the school X1 according to the information of the request. In the case that at least one computing cluster matching school X1 exists in the server, school X1 and its corresponding computing cluster can be directly determined according to the connection request information; in the absence of at least one computing cluster in the server that matches school X1, one or more computing clusters may be selected from the N pre-built computing clusters as the computing cluster corresponding to school X1.
The user code sent by the user terminal may be a code edited by the user obtained through a code editing window of the user terminal, or a user code transmitted by a code editing device connected with the user terminal, which is received by the user terminal.
It should be understood that the gateway receiving the connection request of the user terminal of student B (student of school X2) may also determine the school X2 to which the user terminal of student B belongs and the computing cluster corresponding to school X2 in the above manner, and will not be described in detail herein.
In step S12, a computing node may be selected from the computing nodes included in the computing cluster corresponding to the tenant as a target computing node, and a connection between the target computing node and the user terminal is established; for example, a connection between any idle computing node and the user terminal may be established from among the computing nodes included in the corresponding computing cluster, with the idle computing node being a target computing node.
The connection between the target computing node and the user terminal can be established based on technologies such as a full duplex communication Protocol (WebSocket) communication technology, a hypertext Transfer Protocol (HTTP) communication technology, and an event-based real-time two-way communication Protocol (socket. io) communication technology.
Compared with the related art, a resident Kernel (namely, an environment in which codes can be indirectly run on a browser) needs to be maintained for each user, occupied resources are large, the resource utilization rate is low, and the number of users capable of conducting online programming learning at the same time is limited by the number of kernels capable of being supported by a server because each user and the Kernel are in one-to-one correspondence.
In the embodiment of the disclosure, each tenant may include a plurality of user terminals, a computing cluster corresponding to a plurality of tenants may exist in a server, and each tenant may correspond to at least one computing cluster in the server, for example, a tenant including M user terminals may correspond to a computing cluster formed by less than M computing nodes in the server, and for any user of each tenant, when a code of the user needs to run, a suitable computing node may be matched from the computing cluster corresponding to the tenant to which the user belongs, and each user terminal does not need to correspond to a computing node one to one, so that the same system can support the running of a plurality of tenant users, thereby multiplexing computing and memory resources of the system to the maximum extent, saving cost, and laying a foundation for public cloud services.
Moreover, the computing nodes in the server can support isolation by taking the tenants as granularity, users of each tenant can only correspond to the computing nodes in the computing cluster to which the tenant belongs and cannot communicate with the computing nodes in the computing clusters corresponding to other tenants, computing resources among the tenants are isolated, and the reliability and the safety of tenant code operation can be improved.
In one possible implementation, step S12 includes: selecting the target computing node from a computing cluster corresponding to the tenant to which the user terminal belongs according to a load balancing strategy; and establishing the connection between the target computing node and the user terminal.
For example, according to a load balancing policy, such as minimum connection numbers (Least Connections), load balancing is performed according to the current connection condition of each computing node in the computing cluster corresponding to the tenant to which the user terminal belongs, and the gateway may select a computing node (target computing node) with the minimum current connection number from the computing nodes included in the computing cluster corresponding to the tenant to which the user terminal belongs according to the received connection request, and establish connection between the computing node and the user terminal.
The selection of the computing nodes can be performed according to the current connection condition of each computing node in the computing cluster corresponding to the tenant to which the user terminal belongs, the resource occupation condition of each computing node, or the code running efficiency in unit time. The minimum connection number method is only one method for dynamically allocating the computing nodes, and a more balanced method for dynamically allocating the computing nodes suitable for different scenes can be determined by synthesizing parameter calculation of various dimensions, which is not limited by the disclosure.
Therefore, compared with the related art, in the framework of the programming platform, a special service needs to be set to keep communication with the user terminal to receive and distribute tasks, which results in a complex platform framework and low processing efficiency. In the embodiment of the disclosure, the gateway can directly establish direct connection between the target computing node and the user terminal by using a load balancing strategy, and route the received task to the service with smaller load, thereby being beneficial to maximally multiplexing computing and memory resources, effectively multiplexing limited hardware resources, saving cost and improving the operating efficiency of user codes.
In one possible implementation manner, the at least one computing node is deployed in servers with different configurations, and step S12 includes: determining computational resources required by the user code according to the connection request of the user terminal; according to the computing resources, determining a target server supporting the computing resources from the servers with different configurations; and establishing the connection between the target computing node corresponding to the target server and the user terminal.
For example, the computing clusters corresponding to the tenants may include a computing cluster deployed on a CPU server and a computing cluster deployed on a GPU server. The gateway receives a connection request sent by the user terminal, and may include code characteristic information (e.g. code amount, called interface) of the user code, and may determine the computational resources required by the user code according to the code characteristic information in the connection request of the user terminal. For example, assume that the user code is a face recognition code, written based on OpenCV (computer vision and machine learning software library licensed by university of california, berkeley, university), which is 800MB in size. The gateway can acquire the code characteristic information of the user code by analyzing the received connection request of the user code, namely the user code needs to call an OpenCV interface, and the code amount is 800 MB. Because the code amount of the user is large and an OpenCV interface needs to be called, the user code can be determined to support OpenCV and computing resources of large-scale operation.
Alternatively, the corresponding relationship between the computational power resource and the target server or the target server type may be preset, and after the required computational power resource is determined, the corresponding target server or the target server type (e.g., CPU server/GPU server) may be determined according to the corresponding relationship. If the required computational resources are less, for example, for conventional codes, a target computing node can be selected from a computing cluster deployed in a CPU (central processing unit) server, and the connection between the target computing node and a user terminal is established; if the required computational resources are large, for example, codes such as neural network model training, image processing, video processing and the like are targeted, a target computing node can be selected from a computing cluster deployed in a GPU server, and connection between the target computing node and a user terminal is established.
Therefore, compared with the related art, each user needs to bind one Kernel (that is, an environment capable of indirectly running a code on a browser), the runtime environment of the Kernel process of each user is fixed, and the Kernel process cannot be flexibly scheduled to different machines to be executed according to the resource occupation condition of the user code (that is, the resource of the CPU/GPU cannot be flexibly utilized), and the irrational allocation of each resource is easily caused under the condition of multi-machine deployment. In the embodiment of the disclosure, the gateway can automatically route to different computing type node clusters according to the connection request information, and can distribute the execution task to servers with different configurations (such as a CPU server or a GPU server) to operate according to the actual requirement of the user code, so that reasonable resource configuration is achieved, and the operation efficiency of the user code is improved.
After the connection is established at step S12, the gateway transmits the user code of the user terminal to the target computing node at step S13.
In step S14, the target computing node may execute the received user code to obtain an operation result, and the gateway feeds back the operation result of the target computing node to the user terminal through the connection established in step S12.
Through steps S11 to S14, in response to receiving a connection request of a user terminal, a gateway determines a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant, establishes a connection between a target computing node in the computing cluster and the user terminal, sends a user code sent by the user terminal to the target computing node, and feeds back an operation result of the target computing node on the user code to the user terminal. By the method, the isolation of computing resources with tenants as the granularity can be supported, the running safety of the user codes is improved, the direct connection between the user and the computing node is supported, the hardware resources required by the running of the user codes are saved, and the running efficiency of the user codes is improved.
In one possible implementation, the method further includes: after the operation result of the target computing node on the user code is fed back to the user terminal (i.e., after step S14), disconnecting the target computing node in the computing cluster from the user terminal.
For example, after the gateway feeds back the operation result of the target computing node to the user terminal through the connection established in step S12, the gateway may disconnect the connection established in step S12 and release the corresponding resource. The gateway may continue to wait for a connection request of a next user terminal, and in response to a newly received connection request, establish a connection between the user terminal and a target compute node in the compute cluster based on a load balancing policy.
In this way, it is beneficial to save computing resources and continue to respond efficiently to connection requests of the user terminal.
Fig. 2 is a flowchart illustrating a user code running method according to an embodiment of the present disclosure, where the method is applied to a server, where at least one computing cluster is deployed, and one computing cluster includes at least one computing node, as shown in fig. 2, the method includes:
in step S21, a connection is established with a user terminal through a gateway, where the computing node is a target computing node in at least one computing node in a computing cluster corresponding to a tenant to which the user terminal belongs;
receiving, by the gateway, a user code issued by the user terminal in step S22;
in step S23, the user code is executed to obtain an execution result;
in step S24, the operation result is fed back to the user terminal through the gateway.
In a possible implementation manner, the computing nodes included in the computing clusters corresponding to different tenants may be deployed in the same server, or may be deployed in servers with different configurations, for example, including a CPU server, a GPU server, and the like. The present disclosure does not limit the number of compute clusters or nodes deployed by each server, and the type of servers used to deploy the compute nodes.
In one possible implementation manner, the tenant comprises a school, the user terminal comprises a terminal used by a student, and the method is used for supporting simultaneous online programming of a plurality of students.
For example, in step S21, the tenant includes a school, and the user terminal includes a terminal used by a student. Assuming that there are two tenants, school X1 and school X2, school X1 and X2 may be respectively equipped with a plurality of user terminals for students to use, at least one computing cluster corresponding to school X1 and school X2, respectively, has been deployed in the server, each computing cluster including at least one computing node, respectively.
Through the gateway, a target computing node (idle computing node) in the computing cluster corresponding to school X1 can be established to be connected with the user terminal submitting the written code in school X1. A plurality of target computing nodes may exist in the computing cluster corresponding to school X1, and may be connected to a plurality of user terminals in school X1 that have submitted written codes.
Meanwhile, a target computing node (idle computing node) in a computing cluster corresponding to school X2 can be established through the gateway, and the target computing node is connected with a user terminal submitted with written codes in school X2. A plurality of target computing nodes may exist in the computing cluster corresponding to school X2, and are connected to a plurality of user terminals submitting written codes in school X2, respectively.
Because the school X1 and the school X2 correspond to different computing clusters, the computing nodes can support isolation with the school (tenant) as granularity, and the same system can support the operation of multiple tenant users. The user terminals used by the students in school X1 can only correspond to the computing nodes in the computing cluster to which school X1 belongs, and cannot communicate with the computing nodes in the computing cluster corresponding to school X2, computing resources among different schools are isolated, and reliability and safety of user code operation can be improved.
Moreover, a computing cluster corresponding to a plurality of schools can exist in the server, each computing cluster can comprise a plurality of computing nodes, each user terminal does not need to correspond to the computing node one by one, when a code submitted by a certain student using the user terminal needs to run, a proper target computing node can be provided from the computing cluster corresponding to the school to which the student belongs, direct connection between the user and the computing node is established, the user code to be run is routed to the proper (for example, the minimum connection) computing node, the computing and memory resources of the server can be fully reused, the cost is saved, the running efficiency of the user code is improved, and the public cloud service is facilitated.
After the connection of the target computing node with the user terminal is established in step S21, the user code issued by the user terminal may be loaded to the target computing node to which the user terminal is connected through the gateway, and the target computing node receives the user code loaded through the gateway in step S22.
There may be multiple target computing nodes that asynchronously receive user codes from multiple user terminals. For example, target computing node 1 may receive a user code issued by user terminal 1 of tenant 1, target computing node 2 may receive a user code issued by user terminal 2 of tenant 1, target computing node 3 may receive a user code issued by user terminal 1 of tenant 2, target computing node 3 may receive a user code issued by user terminal 2 of tenant 2, and target computing node 4 may receive a user code issued by user terminal 3 of tenant 2. The target computing node 1 and the target computing node 2 are subordinate to the computing cluster of the tenant 1, and the target computing node 3 and the target computing node 4 are subordinate to the computing cluster of the tenant 2.
By the method, the user terminal is directly connected with the target computing node, and the target computing node can directly receive the user code sent by the user terminal, so that the transmission efficiency of the user code can be improved. And different target computing nodes and different user terminals can communicate asynchronously, thereby improving the concurrency capability of the system.
In step S23, each target computing node may run the received user code using the available computing and memory resources on the server where it is located, and obtain a running result.
In one possible implementation, step S23 includes: placing the user code as a running task in a task queue; acquiring the running task from the task queue; and executing the running task to obtain the running result.
Each computing node can execute the user code as an operating task, and can directly execute the operating task to obtain an operating result under the condition that the computing node is completely idle; when the computing node finishes executing the current running task, the task is taken from the task queue to be executed until the task queue is empty, and the computing node stops working.
The task Queue in each computing node may be a storage system such as a Remote Dictionary service (Remote Dictionary Server) list, a Message Queue (Message Queue), or Message-oriented middleware, which is not limited in this disclosure.
Therefore, compared with the related art in which the number of simultaneous online programming users is limited by the number of kernels supported by the server, the embodiment of the disclosure promotes the concurrent response capability of the system through the queuing mechanism, and is helpful for supporting a larger-scale user number for online programming learning.
In addition, in the related art, a special service needs to be set in the server to ensure communication with the user terminal, and task receiving and distribution are performed, which may cause problems of high complexity of the system architecture, low processing efficiency, and the like. According to the embodiment of the disclosure, the computing node can be directly connected with the user terminal, a service node is omitted, queuing can be performed in the computing node, and the user code is executed, so that resources are saved and the efficiency is improved.
In one possible implementation, monitoring a queuing congestion degree of the task queue of each computing node in each computing cluster deployed on a server; and adjusting the number of the computing nodes of each computing cluster according to the queuing congestion degree.
For example, for a programming platform consisting of user devices, gateways, and servers, there may be a compute cluster P corresponding to school X1 (i.e., tenant) and a compute cluster Q corresponding to school X2 in the servers of the platform, where compute cluster P may include M compute nodes and compute cluster Q may include N compute nodes. The M computing nodes in the computing cluster P are used for serving students in school X1 and receiving and processing user codes submitted by the students in school X1; the N compute nodes in compute cluster Q, serving students at school X2, may receive and process user codes submitted by students at school X2.
However, when the business situation/resource demand of school X1 or school X2 changes, the cluster size of computing cluster P or computing cluster Q needs to be adjusted according to the change.
For example, when school X1 expands the enrollment size, the number of students in school X1 increases, the number of user codes submitted by students in school X1 also increases, and if the computing cluster P corresponding to school X1 continues to maintain the size of M computing nodes, queuing congestion may occur in each computing node task queue of computing cluster P, and the user codes submitted by students in school X1 cannot be processed in time, thereby reducing the user experience.
Or, for example, when the number of students in school X2 is small and the number of user codes submitted by students in school X2 is small when the number of students in school X2 is insufficient, if the computing cluster Q corresponding to school X2 continues to maintain the size of N computing nodes, a large number of idle computing nodes (i.e., task queues are empty) exist in the computing cluster Q, which results in waste of hardware resources.
In view of the above situation, in the related art, it is necessary to manually monitor the working conditions of the computing clusters, and manually adjust the scale of each computing cluster, multiple workers may be required to monitor the computing clusters, which causes problems of high labor cost, low working efficiency, and the like.
According to the embodiment of the disclosure, the queuing congestion degree of the task queue of each computing node in each computing cluster deployed on the server can be automatically monitored, and the number of the computing nodes of each computing cluster is adjusted according to the queuing congestion degree, so that the computing clusters are automatically expanded and contracted. For example, when the task queues of all computing nodes (or most computing nodes) in the computing cluster are in a queue congestion state, the number of computing nodes of the computing cluster can be increased appropriately; when the condition of queue congestion does not exist in the task queues of the computing nodes in the computing cluster, and the number of idle computing nodes in the computing cluster is less, the scale of the computing nodes in the computing cluster can be maintained; in the case where there are a large number of free computing nodes in a computing cluster, the number of computing nodes in the computing cluster may be reduced.
Each computing node of the computing cluster may be equivalent to a container, and in a specific implementation process, automatic scaling of the computing cluster may be implemented by using methods such as k8s (kubernets, which is used for managing containerized applications on multiple servers in a cloud platform), and the like.
It should be understood that the execution subject for monitoring the queuing congestion condition of the computing nodes in the computing cluster and adjusting the size of the computing cluster may be a gateway (a monitoring instruction may be sent to the server through the gateway or a computing cluster size adjustment instruction may be sent to the server), may be at least one monitoring node set in the server, or may be at least one computing node selected from the computing cluster as a monitoring node, which is not limited by the present disclosure.
By the method, automatic expansion and contraction of the computing cluster can be realized according to the queuing congestion degree of the computing nodes of the computing cluster, and reasonable configuration of resources is facilitated.
In one possible implementation, the computing node includes a service execution environment and a code execution environment,
step S23, including: in the service execution environment, placing the user code as a running task in the task queue, and acquiring the running task from the task queue; and executing the running task in the code execution environment to obtain the running result.
For example, fig. 3 shows a schematic diagram of computing nodes according to an embodiment of the present disclosure, as shown in fig. 3, each computing node may include a service execution environment and a code execution environment, and the service execution environment and the code execution environment are isolated from each other. For example, the service execution environment and the code execution environment may be mutually isolated Python (programming language designed by the institute of mathematics and computer science) environments, wherein the service execution environment includes standard library files and dependency packages required by the Python environment, and can provide an environment required by an engine service for queuing user code; the code execution environment comprises standard library files, dependency packages, course packages and files programmed for tenant codes, and can provide an execution environment (namely, a kernel environment in fig. 3) required by a kernel for executing user codes.
Each computing node receives a user code sent by a connected user terminal, and can place the user code in the task queue as a running task in a service execution environment. The compute node may listen to a task queue in the service execution environment and the code execution aspects of the code execution environment. After the last task is executed in the code execution environment, after resources are released, the current running task can be obtained from the task queue, the running task is transmitted to the code execution environment, and the running task is executed in the code execution environment to obtain a running result.
Wherein communications between the service execution environment and the code execution environment may be performed through ZMQ (i.e., a ZeroMQ transport layer, which is a transport protocol that may be flexibly scaled between multiple threads, cores, and host boxes), the present disclosure does not limit the manner in which communications between the service execution environment and the code execution environment may be performed.
Therefore, compared to the related art in which the execution environment and the service environment of the user code are the same environment (e.g., the same Python environment), the normal operation of the code task may be affected by the user code dependent package change. The embodiment of the disclosure realizes the isolation of the service execution environment and the user code execution environment of the computing node, and is beneficial to improving the safety and reliability of the user code operation.
In step S24, each target computing node may respectively feed back the operation result to the user terminal using the connection established in step S21, so that the user may obtain the operation result.
In one possible implementation, the method further includes: after the operation result is fed back to the user terminal through the gateway in step S24, the connection with the user terminal is disconnected through the gateway, and the computing node releases the computing resource corresponding to the operation task.
For example, after the computing node completes the computation of the running task of the user code submitted by the user a and feeds back the running result to the user terminal of the user a through the gateway, the computing node may disconnect the computing node from the user terminal through the gateway, and the computing node may release the corresponding computing resource. Then, the computing node can continue to monitor its own task queue, that is, resources can be immediately released after the computation of the current running task is completed in the code execution environment of the computing node, and the task queue in the service execution environment in the node continues to be monitored to obtain a new running task, so that the computing node can reuse computation and memory resources to the maximum extent. Therefore, as long as the computing and memory resources of the computing nodes conform to the operating environment resources of the user code, the user code can be executed in different computing nodes, so that the computing and memory resources of the computing nodes are repeatedly utilized, and the hardware resources of the server are fully and reasonably utilized.
By the method, the computing resources are saved, and the memory utilization rate of the server is improved.
Through steps S21 to S24, a connection between a target computing node in at least one computing node in a computing cluster corresponding to a tenant to which the user terminal belongs and the user terminal may be established through the gateway, and the target computing node may receive a user code sent by the user terminal, run the user code, obtain a running result, and feed the running result back to the user terminal through the gateway. By the method, the isolation of computing resources with tenants as the granularity can be supported, the running safety of the user codes is improved, the direct connection between the user terminal and the computing node is supported, the hardware resources required by the running of the user codes are saved, and the running efficiency of the user codes is improved.
The following describes a user code operation method according to the embodiment of the present disclosure, taking N tenants as an example.
FIG. 4 shows a schematic diagram of a user code execution method according to an embodiment of the present disclosure; as shown in fig. 4, there are tenants 1 to N, each tenant may include multiple user terminals, each tenant may correspond to one CPU computing cluster and one GPU computing cluster, and each computing cluster may include multiple computing nodes. It should be understood that the present disclosure does not limit the number of tenants N, the number of user terminals included by each tenant, the number of computing clusters corresponding to each tenant, the type of computing clusters, and the number of computing nodes included by each computing cluster.
As shown in FIG. 4, the method may include steps S41-S45:
step S41, the gateway can receive a connection request sent by a user terminal, and according to the connection request, determine a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant, wherein the computing cluster comprises at least one computing node;
for example, the gateway receives a connection request sent by any user terminal in the tenant 1, and can determine a CPU computing cluster and a GPU computing cluster corresponding to the tenant 1 according to the received connection request information; the gateway receives a connection request sent by any user terminal in the tenant 2, and can determine a CPU computing cluster and a GPU computing cluster corresponding to the tenant 2 according to the received connection request information; and by analogy, the gateway receives a connection request sent by any user terminal in the tenant N, and can determine a CPU computing cluster and a GPU computing cluster corresponding to the tenant N according to the received connection request information.
The gateway can asynchronously receive the connection requests of a plurality of user terminals of the same tenant, and can also asynchronously receive the connection requests of one or more user terminals of a plurality of tenants.
Step S42, establishing the connection between the target computing node in the computing cluster and the user terminal through a gateway;
for example, with the gateway, a target computing node may be determined from the plurality of computing nodes included in the computing cluster of the corresponding tenant determined in the previous step S41, and a connection of the target computing node with the user terminal may be established. The gateway may determine a target compute node from a plurality of compute nodes included in a compute cluster of a corresponding tenant based on a load balancing policy and computing resources required by the user code. For example, assuming that the user code is a task such as neural network model training, image processing, and the like that requires relatively large computational resources, an idle compute node may be selected as a target compute node from the GPU compute cluster of the corresponding tenant, and a connection with the idle compute node may be established. Assuming that the computing resources required by the user code are relatively small, an idle computing node can be selected from the corresponding CPU computing cluster as a target computing node, and a connection with the node is established.
As shown in fig. 4, the two-way arrow in the figure represents the connection between the user terminal and the target computing node in the computing cluster, where the solid arrow represents the connection between the user terminal established according to the CPU connection request and the computing node in the CPU computing cluster, and the dotted arrow represents the connection between the user terminal established according to the GPU connection request and the computing node in the GPU computing cluster.
Step S43, loading the user code sent by the user terminal to a target computing node through a gateway;
step S44, the target computing node operates the received user code to obtain an operation result; each target node can maintain a queue, queue user code execution tasks in the service execution environment, and send the tasks arranged in the front to the code execution environment for execution to obtain the running result of executing the tasks.
And step S45, feeding back the running result of the target computing node to the user code to the user terminal through the gateway, disconnecting the target computing node from the user terminal, and enabling the target computing node to continue monitoring a task queue in the self service execution environment to wait for the arrival of the next task.
By the mode, the distributed execution engine architecture shown in fig. 4 is used, when facing tenants such as schools or training institutions, the computing resources of the server can be fully utilized under limited cost, the requirement that more students perform online programming learning in a classroom simultaneously is met, the use scene of multiple tenants can be met, and isolation of computing resources among the tenants is performed.
Therefore, in the embodiment of the present disclosure, in response to receiving a connection request of a user terminal, a gateway determines a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant, establishes a connection between a target computing node in the computing cluster and the user terminal, sends a user code sent by the user terminal to the target computing node, and feeds back an operation result of the target computing node on the user code to the user terminal. By the method, isolation of computing resources with tenants (including a plurality of users) as granularity can be supported, each tenant can correspond to one computing cluster, a gateway can flexibly match a proper target computing node for each user terminal according to a connection request sent by each user terminal, the user terminal is directly connected with the target computing node in the corresponding computing cluster, and a queuing mechanism can be arranged in each computing node. Moreover, the isolation of the service execution environment and the user code execution environment of the computing node can further improve the safety and reliability of the user code operation.
It is understood that the above-mentioned method embodiments of the present disclosure can be combined with each other to form a combined embodiment without departing from the logic of the principle, which is limited by the space, and the detailed description of the present disclosure is omitted. Those skilled in the art will appreciate that in the above methods of the specific embodiments, the specific order of execution of the steps should be determined by their function and possibly their inherent logic.
In addition, the present disclosure also provides a user code running apparatus, an electronic device, a computer-readable storage medium, and a program, which can be used to implement any user code running method provided by the present disclosure, and the corresponding technical solutions and descriptions and corresponding descriptions in the methods section are not repeated.
Fig. 5 is a block diagram illustrating a user code execution apparatus according to an embodiment of the present disclosure, as shown in fig. 5, the apparatus being applied to a gateway, the apparatus including:
a determining module 51, configured to, in response to receiving a connection request of a user terminal, determine, according to the connection request, a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant, where the computing cluster includes at least one computing node;
a connection module 52, configured to establish a connection between a target computing node in the computing cluster and the user terminal;
a sending module 53, configured to send a user code sent by the user terminal to the target computing node;
a first feedback module 54, configured to feed back, to the user terminal, an operation result of the target computing node on the user code.
By the method, the isolation of computing resources with tenants (including a plurality of users) as granularity can be supported, each tenant can correspond to one computing cluster, and according to the connection request sent by each user terminal, the gateway can flexibly match a proper target computing node for each user terminal, so that the user terminal is directly connected with the target computing node in the corresponding computing cluster, hardware resources required by user code operation are saved, and the user code operation efficiency is improved.
In one possible implementation, the connection module 52 is configured to: selecting the target computing node from a computing cluster corresponding to the tenant to which the user terminal belongs according to a load balancing strategy; and establishing the connection between the target computing node and the user terminal.
By the method, the gateway can directly establish direct connection between the target computing node and the user terminal by using a load balancing strategy, and route the received task to the service with smaller load, so that computing and memory resources are reused to the maximum extent, limited hardware resources are effectively reused, the cost is saved, and the operating efficiency of user codes is improved.
In a possible implementation manner, the at least one computing node is deployed in servers with different configurations, and the connection module 52 is configured to: determining computational resources required by the user code according to the connection request of the user terminal; according to the computing resources, determining a target server supporting the computing resources from the servers with different configurations; and establishing the connection between the target computing node corresponding to the target server and the user terminal.
By the method, the gateway can automatically route to different computing type node clusters according to the connection request information, and can distribute the execution task to servers with different configurations (such as a CPU (central processing unit) server or a GPU (graphics processing unit) server) to operate according to the actual requirement of the user code, so that reasonable resource configuration is achieved, and the operation efficiency of the user code is improved.
In one possible implementation, the apparatus further includes a first disconnection module configured to: and after the running result of the target computing node to the user code is fed back to the user terminal, disconnecting the target computing node in the computing cluster from the user terminal.
In this way, it is beneficial to save computing resources and continue to respond efficiently to connection requests of the user terminal.
Fig. 6 is a block diagram of a user code running apparatus according to an embodiment of the present disclosure, and as shown in fig. 6, the apparatus is applied to a server, and the server is deployed with at least one computing cluster, and one computing cluster includes at least one computing node, and the apparatus includes:
an establishing module 61, configured to establish a connection with a user terminal through a gateway, where the computing node is a target computing node in at least one computing node in a computing cluster corresponding to a tenant to which the user terminal belongs;
a receiving module 62, configured to receive, through the gateway, a user code sent by the user terminal;
the operation module 63 is configured to operate the user code to obtain an operation result;
a second feedback module 64, configured to feed back the operation result to the user terminal through the gateway.
By the method, the isolation of computing resources with tenants as the granularity can be supported, the running safety of the user codes is improved, the direct connection between the user terminal and the computing node is supported, the hardware resources required by the running of the user codes are saved, and the running efficiency of the user codes is improved.
In one possible implementation, the execution module 63 is configured to: placing the user code as a running task in a task queue; acquiring the running task from the task queue; and executing the running task to obtain the running result.
By the method, the computing node can be directly connected with the user terminal, a service node is omitted, queuing can be performed in the computing node, and the execution of the user code is more efficient and more resource-saving.
In one possible implementation, the computing node includes a service execution environment and a code execution environment, and the execution module 63 is configured to: in the service execution environment, placing the user code as a running task in the task queue, and acquiring the running task from the task queue; and executing the running task in the code execution environment to obtain the running result.
By the method, the service execution environment and the user code execution environment of the computing node are isolated, and the safety and the reliability of user code operation are improved.
In one possible implementation, the apparatus further includes a second disconnection module configured to: and after the operation result is fed back to the user terminal through the gateway and the connection with the user terminal is disconnected through the gateway, the computing node releases the computing resources corresponding to the operation task.
By the method, the computing resources are saved, and the memory utilization rate of the server is improved.
In one possible implementation manner, the apparatus further includes an adjusting module configured to: monitoring the queuing congestion degree of the task queue of each computing node in each computing cluster deployed on a server; and adjusting the number of the computing nodes of each computing cluster according to the queuing congestion degree.
By the method, automatic expansion and contraction of the computing cluster can be realized according to the queuing congestion degree of the computing nodes of the computing cluster, and reasonable configuration of resources is facilitated.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, will not be described again here.
Embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the above-mentioned method. The computer readable storage medium may be a volatile or non-volatile computer readable storage medium.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the memory-stored instructions to perform the above-described method.
The disclosed embodiments also provide a computer program product comprising computer readable code or a non-transitory computer readable storage medium carrying computer readable code, which when run in a processor of an electronic device, the processor in the electronic device performs the above method.
The electronic device may be provided as a terminal, server, or other form of device.
Fig. 7 illustrates a block diagram of an electronic device 800 in accordance with an embodiment of the disclosure. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like terminal.
Referring to fig. 7, electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 800 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the electronic device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a Complementary Metal Oxide Semiconductor (CMOS) or Charge Coupled Device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as a wireless network (Wi-Fi), a second generation mobile communication technology (2G), a third generation mobile communication technology (3G), a fourth generation mobile communication technology (4G), a long term evolution of universal mobile communication technology (LTE), a fifth generation mobile communication technology (5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804, is also provided that includes computer program instructions executable by the processor 820 of the electronic device 800 to perform the above-described methods.
Fig. 8 illustrates a block diagram of an electronic device 1900 in accordance with an embodiment of the disclosure. For example, the electronic device 1900 may be provided as a server. Referring to fig. 8, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system, such as the Microsoft Server operating system (Windows Server), stored in the memory 1932TM) Apple Inc. of the present application based on the graphic user interface operating System (Mac OS X)TM) Multi-user, multi-process computer operating system (Unix)TM) Free and open native code Unix-like operating System (Linux)TM) Open native code Unix-like operating System (FreeBSD)TM) Or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932, is also provided that includes computer program instructions executable by the processing component 1922 of the electronic device 1900 to perform the above-described methods.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The computer program product may be embodied in hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (13)

1. A user code running method, wherein the method is applied to a gateway, and the method comprises:
responding to a connection request received from a user terminal, and determining a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant according to the connection request, wherein the computing cluster comprises at least one computing node;
establishing connection between a target computing node in the computing cluster and the user terminal;
sending the user code sent by the user terminal to the target computing node;
and feeding back the operation result of the target computing node to the user code to the user terminal.
2. The method of claim 1, wherein establishing a connection between a target computing node in the computing cluster and the user terminal comprises:
selecting the target computing node from a computing cluster corresponding to the tenant to which the user terminal belongs according to a load balancing strategy;
and establishing the connection between the target computing node and the user terminal.
3. The method of claim 1, wherein the at least one compute node is deployed to a server of a different configuration,
establishing a connection between a target compute node in the compute cluster and the user terminal, comprising:
determining computational resources required by the user code according to the connection request of the user terminal;
according to the computing resources, determining a target server supporting the computing resources from the servers with different configurations;
and establishing the connection between the target computing node corresponding to the target server and the user terminal.
4. The method of claim 1, further comprising:
and after the running result of the target computing node to the user code is fed back to the user terminal, disconnecting the target computing node in the computing cluster from the user terminal.
5. A method for operating user code, the method being applied to a server, the server being deployed with at least one computing cluster, one computing cluster comprising at least one computing node, the method comprising:
establishing connection with a user terminal through a gateway, wherein the computing node is a target computing node in at least one computing node in a computing cluster corresponding to a tenant to which the user terminal belongs;
receiving a user code sent by the user terminal through the gateway;
operating the user code to obtain an operating result;
and feeding back the operation result to the user terminal through the gateway.
6. The method of claim 5, wherein executing the user code to obtain an execution result comprises:
placing the user code as a running task in a task queue;
acquiring the running task from the task queue;
and executing the running task to obtain the running result.
7. The method of claim 6, wherein the compute node comprises a service execution environment and a code execution environment,
operating the user code to obtain an operation result, wherein the operation result comprises the following steps:
in the service execution environment, placing the user code as a running task in the task queue, and acquiring the running task from the task queue;
and executing the running task in the code execution environment to obtain the running result.
8. The method according to claim 6 or 7, characterized in that the method further comprises:
and after the operation result is fed back to the user terminal through the gateway and the connection with the user terminal is disconnected through the gateway, the computing node releases the computing resources corresponding to the operation task.
9. The method of claim 7, further comprising:
monitoring the queuing congestion degree of the task queue of each computing node in each computing cluster deployed on a server;
and adjusting the number of the computing nodes of each computing cluster according to the queuing congestion degree.
10. A user code execution apparatus, wherein the apparatus is applied to a gateway, and the apparatus comprises:
the system comprises a determining module, a processing module and a sending module, wherein the determining module is used for responding to a connection request of a user terminal, determining a tenant to which the user terminal belongs and a computing cluster corresponding to the tenant according to the connection request, and the computing cluster comprises at least one computing node;
the connection module is used for establishing the connection between a target computing node in the computing cluster and the user terminal;
a sending module, configured to send a user code sent by the user terminal to the target computing node;
and the first feedback module is used for feeding back the operation result of the target computing node to the user code to the user terminal.
11. A user code execution apparatus applied to a server, wherein the server is deployed with at least one computing cluster, and a computing cluster comprises at least one computing node, the apparatus comprising:
the system comprises an establishing module, a processing module and a processing module, wherein the establishing module is used for establishing connection with a user terminal through a gateway, and the computing node is a target computing node in at least one computing node in a computing cluster corresponding to a tenant to which the user terminal belongs;
a receiving module, configured to receive, through the gateway, a user code sent by the user terminal;
the operation module is used for operating the user code to obtain an operation result;
and the second feedback module is used for feeding back the operation result to the user terminal through the gateway.
12. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to invoke the memory-stored instructions to perform the method of any of claims 1 to 9.
13. A computer readable storage medium having computer program instructions stored thereon, which when executed by a processor implement the method of any one of claims 1 to 9.
CN202111205652.5A 2021-10-15 2021-10-15 User code operation method and device, electronic equipment and storage medium Withdrawn CN113905083A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111205652.5A CN113905083A (en) 2021-10-15 2021-10-15 User code operation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111205652.5A CN113905083A (en) 2021-10-15 2021-10-15 User code operation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113905083A true CN113905083A (en) 2022-01-07

Family

ID=79192421

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111205652.5A Withdrawn CN113905083A (en) 2021-10-15 2021-10-15 User code operation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113905083A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109196474A (en) * 2016-05-17 2019-01-11 微软技术许可有限责任公司 Distributed operation control in computing system
CN110138862A (en) * 2019-05-16 2019-08-16 北京字节跳动网络技术有限公司 Method for processing business, device, gateway and medium based on application service
CN111427551A (en) * 2020-02-14 2020-07-17 深圳市商汤科技有限公司 User code operation method of programming platform, equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109196474A (en) * 2016-05-17 2019-01-11 微软技术许可有限责任公司 Distributed operation control in computing system
CN110138862A (en) * 2019-05-16 2019-08-16 北京字节跳动网络技术有限公司 Method for processing business, device, gateway and medium based on application service
CN111427551A (en) * 2020-02-14 2020-07-17 深圳市商汤科技有限公司 User code operation method of programming platform, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN113259161B (en) Application management method and device, electronic equipment and storage medium
EP4181505A1 (en) Screen sharing method and apparatus, and electronic device
CN113032112A (en) Resource scheduling method and device, electronic equipment and storage medium
CN113377465A (en) Service-based SDK calling method and device, electronic equipment and storage medium
EP4164216A1 (en) Method and apparatus for establishing multimedia call, and electronic device
CN112269770B (en) Document sharing method, device and system and electronic equipment
CN115543535B (en) Android container system, android container construction method and device and electronic equipment
CN114138439A (en) Task scheduling method and device, electronic equipment and storage medium
CN114153582A (en) Resource scheduling method and device, electronic equipment and storage medium
CN114968594B (en) Task processing method, device, electronic equipment and storage medium
CN113521728A (en) Cloud application implementation method and device, electronic equipment and storage medium
CN113420338A (en) Data processing method and device and data processing device
CN114390360B (en) Live voting method and device, electronic equipment and storage medium
CN112925788A (en) Data set management method, system, device, electronic equipment and storage medium
CN113312103A (en) Software definition method and device for intelligent camera, electronic equipment and storage medium
WO2023241613A1 (en) Call establishment method, device and system, terminal, and readable storage medium
KR20120093599A (en) Kiosk system based on mobile and management method thereof
CN109976872B (en) Data processing method and device, electronic equipment and storage medium
CN113905083A (en) User code operation method and device, electronic equipment and storage medium
CN114090303B (en) Software module scheduling method and device, electronic equipment, storage medium and product
CN110489244A (en) Information processing method, system, device and computer readable storage medium
CN113885818B (en) Display method and device and electronic equipment
CN113691526A (en) Pushing method, device, system, equipment and medium based on WebRTC
CN113867914A (en) Task scheduling method and device, electronic equipment and storage medium
CN112597022A (en) Remote diagnosis method, device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20220107