Edge computing method, device and edge server
By generating and pre-compiling the user's running code in advance in the FaaS platform, the problem of long compilation time during user cold start is solved, the request processing efficiency is improved, and faster cold start and request response are achieved.
Patent Information
- Application Number
- CN202210754236.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-28
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-06-28
AI Technical Summary
The FaaS platform has a large request processing delay when users cold start. The existing technology requires compiling and running code when computing resources are started, resulting in long compilation time and affecting request processing efficiency.
When the computing resource startup command is detected, the user's running code is generated and pre-compiled in advance to ensure that the compilation result meets the running conditions and is executed directly, reducing compilation time during the cold start process.
Through pre-compilation technology, the user's cold start time is significantly shortened, the efficiency of request processing is improved, and the user's request can be processed faster.
Smart Images

Figure CN115080059B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet technology, and in particular to an edge computing method, device and edge server. Background Art
[0002] With the development of science and technology, Function as a Service (FaaS) is an event-driven computing execution model that implements serverless computing methods. It has fully automatic, elastic, and horizontal expansion capabilities managed by service providers, which can help developers reduce operating costs and development costs. Developers only need to write simple event processing functions to build their own services, and leave everything else to the platform. FaaS users do not need to consider scaling at all. How to improve the agility of scaling has become one of the biggest technical challenges of the FaaS platform.
[0003] FaaS products are popular with many developers because of their low threshold, high scalability, and pay-as-you-go features. Most common FaaS technical solutions include a central server and many edge servers. Therefore, many requests for tenants are actually edge computing completed in the edge servers; that is, the tenant's operating environment is run through the edge server, so that the tenant's request can be made in the edge server. Summary of the invention
[0004] This disclosure section is provided to introduce concepts in a brief form, which will be described in detail in the detailed description section below. This disclosure section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] The embodiments of the present disclosure provide an edge computing method, device, and edge server, which can efficiently obtain the computing resources of the user according to the pre-compiled results, and because the computing resources can be used to process the user's request, the user's request can be efficiently processed. That is, the present disclosure can speed up the request reply time during the user's cold start process.
[0006] In a first aspect, an embodiment of the present disclosure provides an edge computing method, applied to an edge server, comprising: in response to detecting a computing resource startup instruction for a user, obtaining a pre-compilation result of an operating code of the user, wherein the pre-compilation result is generated before the computing resource startup instruction; in response to the pre-compilation result meeting an operating condition, executing the pre-compilation result to the computing resource of the user, wherein the computing resource is used to process the request of the user.
[0007] In a second aspect, an embodiment of the present disclosure provides an edge computing device, which is applied to an edge server, and includes: an acquisition unit, which is used to obtain a pre-compilation result of the running code of the user in response to detecting a computing resource startup instruction for the user, wherein the pre-compilation result is generated before the computing resource startup instruction; an execution unit, which is used to execute the pre-compilation result in response to the pre-compilation result meeting the running conditions, and obtain the computing resources of the user, wherein the computing resources are used to process the request of the user.
[0008] In a third aspect, an embodiment of the present disclosure provides an edge server, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the edge computing method as described above in the first aspect.
[0009] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the edge computing method as described above in the first aspect.
[0010] The edge computing method, device, and edge server provided by the embodiments of the present disclosure can obtain the pre-compiled results of the user's running code when a computing resource startup instruction for the user is detected, and can execute the pre-compiled results when the pre-compiled results meet the running conditions to obtain the user's computing resources; at this time, the computing resources can be used to process the request. That is, in the present disclosure, when the user's computing resources have not yet been started, since the running code for the user has been pre-compiled, when the user's computing resources are needed, the user's computing resources can be efficiently obtained according to the pre-compiled results, and since the computing resources can be used to process the user's request, the user's request can be efficiently processed. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0012] Figure 1 is a flow chart of an embodiment of an edge computing method according to the present disclosure;
[0013] Figure 2 is a time-consuming schematic diagram of another embodiment of the edge computing method according to the present disclosure;
[0014] Figure 3is a time-consuming schematic diagram of another embodiment of the edge computing method according to the present disclosure;
[0015] Figure 4 is a schematic structural diagram of an embodiment of an edge computing device according to the present disclosure;
[0016] Figure 5 is an exemplary system architecture in which the edge computing method of an embodiment of the present disclosure can be applied;
[0017] Figure 6 It is a schematic diagram of the basic structure of an edge server provided according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0019] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0020] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0021] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0022] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0023] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0024] Before introducing the edge computing method of the present application, the application scenario of the present application is introduced first. The application of the present application is an edge server in a cloud computing system, and the cloud computing system may include a central server and multiple edge servers, so that it is convenient for users to open new business needs. For example, when a user needs to add a new business demand, it is only necessary to expand the business on the edge server, and when the computing power of the edge server is insufficient, the edge server can continue to be deployed, which greatly improves the scalability of the cloud computing system. On the edge server, many tenants may be running. When some tenants do not run for a long time, or a new tenant is deployed, at this time, the tenant is in an unstarted state on the edge server, and the edge server receives a request for the tenant, then it is necessary to start the tenant and use the tenant to process the request. When a tenant is in a cold start state, the user corresponding to the tenant is obviously also in a cold start state. In other cases, although the tenant is not in a cold start state, a certain function of the tenant has not been used for a long time, or a new function has been added for the tenant. At this time, when an instruction to use this function for the tenant is received, the computing resources corresponding to the function also need to be started. Obviously, the process of starting this function for the tenant can also be understood as the user's cold start process.
[0025] Please refer to Figure 1 , which shows the process of an embodiment of the edge computing method according to the present disclosure. The edge computing method can be applied to edge servers. Figure 1 The edge computing method shown includes the following steps:
[0026] Step 101, in response to detecting a computing resource startup instruction for a user, obtaining a pre-compiled result of a running code of the user.
[0027] Here, the pre-compiled results can be generated before the computing resource starts the instruction.
[0028] As an example, in the scenario of the present disclosure, when a user is in an unstarted state, a request for the user is received, or the edge server needs to start the user, then a computing resource start instruction may be generated. In other words, it can be understood that when the computing resources of the user are utilized, a computing resource start instruction may be generated.
[0029] That is, the computing resource activation instruction can be used to instruct obtaining the computing resources of the user.
[0030] In some implementations, a tenant may also correspond to a user. In this case, the user can also be understood as a tenant; and the scenario of the present disclosure in this case can also be understood as a cold start scenario of the tenant.
[0031] As an example, the user's running code can be understood as the code that the user needs to run and process the request. The running code can usually be packaged and uploaded by a user with corresponding permissions.
[0032] It should be noted that the user's running code is usually uploaded by the customer, and the running code needs to adapt to the current running environment, so it is usually necessary to compile the running code. And because the running code is usually dynamic, such as the user's functions may change (update certain functions, delete certain functions, etc.), at this time, it may be necessary to re-upload the running code. Therefore, when the user is in a cold start state, in order to ensure the user's normal processing capabilities, the user's running code needs to be compiled before the user can process the request. Moreover, the environment when the user is running may also be dynamic. Therefore, in order to ensure the user's normal processing capabilities, the user's running code will be compiled during each cold start process of the user.
[0033] As an example, the pre-compilation result can be understood as the compilation result obtained after compiling the user's running code.
[0034] Step 102, in response to the pre-compilation result meeting the running condition, executing the pre-compilation result to obtain the user's computing resources.
[0035] Here, computing resources can be used to process user requests.
[0036] As an example, after executing the pre-compiled result, the user's computing resources can be obtained, and the user's request can be processed at this time.
[0037] As an example, the pre-compilation result meeting the running condition can be understood as: the pre-compilation result matches the current running environment. In other words, it can also be understood that the pre-compilation result can be executed in the current running environment.
[0038] As an example, the user's running code has been pre-compiled before the computing resource startup request is detected, and the pre-compilation result also meets the conditions. At this time, the pre-compilation result can be directly executed to obtain the computing resources. In this way, the computing resources can be obtained efficiently, and the computing resources can be used to process the request, so that the request for the user can be processed efficiently.
[0039] In the related art, when a computing resource startup instruction for a user is detected, the user's running code is first compiled, and then the compilation result is obtained, and then the computing resources are obtained by using the compilation result, and the computing resources are used to process the request. In this way, when there are many running codes, the compilation time for the user's running code may be longer, thereby extending the time to obtain the user's computing resources. Correspondingly, if the computing resource startup instruction is generated based on the request for the user, at this time, the request for the user cannot be processed in time.
[0040] It can be seen that the edge computing method provided in the present disclosure can obtain the pre-compiled result of the user's running code when the computing resource startup instruction for the user is detected, and can execute the pre-compiled result when the pre-compiled result meets the running conditions to obtain the user's computing resources; at this time, the computing resources can be used to process the request. That is, in the present disclosure, when the user's computing resources have not yet been started, since the running code for the user has been pre-compiled, when the user's computing resources are needed, the user's computing resources can be efficiently obtained according to the pre-compiled results, and since the computing resources can be used to process the user's request, the user's request can be efficiently processed.
[0041] In order to facilitate understanding of the effects of the present application, an example is given. For example, a request for user A is received. At this time, the computing resources of user A have not been started. At this time, a computing resource startup instruction can be generated. If it takes 1 second to compile the running code of user A, at this time, since the running code of user A has been pre-compiled, it only takes 1-5 milliseconds to obtain the computing resources of user A according to the pre-compiled results. It can be seen that by pre-compiling the running code of the user, the cold start time of the user can be greatly shortened, so that the request for the user can also be processed faster.
[0042] In order to better understand the idea of the present disclosure, the cold start process of the user is described here by way of example. For example, when a computing resource startup instruction is detected, the user's context environment can be initialized first (here, it can include obtaining the user's code and configuration, and then initializing the context environment at runtime), and then the user's running code can be compiled in real time. However, for initializing the user's context environment, the overall time consumption is usually less. For example, the time consumption of initializing the context environment can be optimized by using a language sandbox, so that the time consumption of initializing the context environment can be very small. However, it may take a long time to compile the user's running code in real time. For example, if the running code uses the JavaScript language, the running code needs to be compiled by the runtime environment before it is executed. Due to the characteristics of the dynamic language JavaScript, most third-party libraries have a large amount of code, ranging from tens to hundreds of KB to several MB. In the JavaScript ecosystem, the dependencies of third-party libraries are often packaged in a simple copying manner. For example, if a running code depends on 10 third-party libraries, then these 10 third-party libraries will be packaged and pasted together by the tool, and finally a file containing all JS code is uploaded. When a cold start is triggered by a user's HTTP request, the FaaS runtime engine on the edge server needs to compile the JS code. This compilation process can take hundreds of milliseconds to several seconds for the JS code. Generally speaking, when the customer's code size reaches 1MB, this compilation process may take nearly 1 second. It can be seen that by pre-compiling the running code, the time spent on cold start can be saved.
[0043] In order to further understand the difference between the related art and the present application, Figure 2-3 To explain, Figure 2 It can be understood as a schematic diagram of the time consumption of the cold start process in the related technology. Figure 3 It can be understood as a time-consuming schematic diagram of the cold start process disclosed in the present invention. Figure 2 It can be seen that in the cold start process of the related technology, step a (initializing the context environment) will be performed first, and then step b (running the code in real time compilation), and then the user can perform edge computing. Figure 2 It can be seen that the time consumed in step b is much longer than that consumed in step a. Figure 3 It can be seen that during the user's cold start process, step a (initializing the context environment) will also be performed. However, at this time, the time consumption of step a can be optimized using the language sandbox, and step c can be understood as obtaining the pre-compiled results. Figure 3 It can be seen that the time consumption of step c may be lower than that of step a, thus saving the overall time consumption of the user's cold start process.
[0044] In some embodiments, the pre-compilation result may be generated by a central server compiling the user's running code, and the central server may be communicatively connected with the edge server.
[0045] In some embodiments, using a central server to compile the user's running code can alleviate the processing pressure of the edge server; in this way, the edge server only needs to obtain the pre-compilation result from the central server, and can use the pre-compilation result to obtain the user's computing resources. In this way, not only the processing pressure of the edge server is alleviated, but also the edge server can efficiently obtain the user's computing resources, and can use the obtained computing resources to process requests for the user, so that the requests can also be processed in a timely manner.
[0046] At the same time, since the central server has a strong processing capability, the running code can be compiled faster, thereby speeding up the pre-compilation efficiency of the running code for the user.
[0047] As an example, the central server is usually used to receive the running code of the user, while the edge server is usually used to deploy the user and process requests using the deployed user.
[0048] In some embodiments, the central server compiling the user's running code may include: configuring a compilation environment matching the running environment according to the user's running environment; and compiling the user's running code in the configured compilation environment.
[0049] As an example, the compilation environment may match the user's runtime environment, for example, the compilation environment may be the same as the tenant's runtime environment.
[0050] In this way, the compilation result of the running code in the compilation environment can be used by the edge server. At the same time, this can make the compilation result more accurate.
[0051] As an example, the central server can also obtain the operating environment of the user when running on the edge server, and can create a compilation environment that matches the operating environment. In this way, the running code can be compiled in a separate environment without affecting the normal operation of other services of the central server.
[0052] As an example, the running code can be compiled in the compilation ServiceHub of the central server. Specifically, the central server can load a V8 environment that is the same as the running environment of the user in the edge server, and can use the CodeCache function of V8 to compile the running code and store it in a binary blob. Of course, it should be noted that the specific compiler selected by the central server can be set according to actual needs, and the specific compiler is not limited here.
[0053] In some embodiments, in response to receiving a user's request, it is determined whether the user's runtime environment is complete; in response to determining that the user's runtime environment is incomplete, a computing resource startup instruction for the user is generated.
[0054] As an example, the runtime environment of a user may be understood as the environment in which the user needs to process a request.
[0055] As an example, the runtime environment is associated with the user's computing resources. The user's running code needs to be compiled in the runtime environment to obtain the user's computing resources, and the user's computing resources are used to process requests. Therefore, whether the user's runtime environment is complete can be understood as whether the edge server has obtained the user's computing resources. If the user's computing resources have not been obtained, it can be understood that the user's runtime environment is not yet complete. At this time, a computing resource startup instruction for the user can be generated to start the user's computing resources so that the user can process the request.
[0056] In some embodiments, in response to detecting a computing resource startup instruction for a user, a compilation result acquisition request is sent to a central server; and a pre-compilation result returned by the central server is received.
[0057] Here, the compilation results and the user's running code can be stored in the central server, which can save the storage resources of the edge server.
[0058] As an example, when the edge server needs to obtain the pre-compilation result, it can directly obtain it from the central server.
[0059] In some embodiments, in response to detecting a computing resource startup instruction for a user, the pre-compiled result may be obtained locally.
[0060] Here, in response to generating the pre-compilation result, the central server may push the generated pre-compilation result to the edge server.
[0061] Here, the central server sends the obtained pre-compiled results to the edge server, which can further speed up the efficiency of the edge server in obtaining the user's computing resources, that is, can further speed up the user's cold start efficiency.
[0062] As an example, the pre-compilation result may be pushed to all edge servers connected to the central server, so that any edge server can efficiently obtain the user's computing resources when receiving a computing resource startup instruction for the user.
[0063] Generally speaking, the central server does not know in advance which edge server will process the user's request. Therefore, the pre-compiled results are pushed to all edge servers connected to the central server. In this way, when any edge server receives a computing resource startup instruction for the user, it can use the pre-compiled results to efficiently obtain the user's computing resources.
[0064] As an example, in order to provide a safety net, the central server can also push the pre-compiled results and the running code to all edge servers. In this way, when any edge server receives a computing resource startup instruction, if it cannot directly use the pre-compiled results to obtain computing resources, it can also use the running code to compile and obtain computing resources, which greatly improves the applicability of the present disclosure.
[0065] In some embodiments, in response to receiving the user's running code, the central server determines whether to compile the user's running code according to a preset compilation judgment condition.
[0066] As an example, the compilation process of the running code of some users is faster, and the running code of such users does not need to be pre-compiled. In this way, not only computing resources can be saved, but also storage resources can be saved. In other words, setting a preset compilation judgment condition can avoid the waste of computing resources. In this way, the central server can reasonably judge whether to compile the running code according to the judgment condition.
[0067] In some embodiments, the compilation judgment condition includes at least one of the following: whether the running code is associated with a pre-compilation identifier, and whether the code amount of the running code is greater than a preset threshold.
[0068] Here, whether to associate the pre-compilation flag with the running code is selected by the uploader of the running code, and the pre-compilation flag can be used to indicate to compile the running code of the user.
[0069] As an example, some running codes have a small amount of code, so the compilation amount of these running codes is small, and the compilation time is correspondingly short; in this case, there is no need to pre-select and compile these running codes. That is, in some scenarios, the amount of running codes that the central server needs to compile may be greater than a preset threshold.
[0070] As an example, the specific value of the preset threshold can be set according to the actual situation. The specific value of the preset threshold is not limited here, and it only needs to be reasonably set according to the actual situation. For example, the preset threshold can be 40KB; that is, when the code size of the running code is greater than 40KB, it can be determined to precompile the running code.
[0071] For example, although some users have less running codes, the requests processed by such users are usually more urgent (for example, payment requests, resource submission requests, etc.). At this time, in order to further speed up the feedback time of the request, a pre-translation mark can be associated with such running codes. At this time, the central server can also pre-translate the running codes corresponding to such users so that the requests for such users can be processed faster.
[0072] It can be seen that in the present disclosure, not only can the running code be indicated to be pre-compiled by associating the running code with the pre-compilation identifier, but the central server can also determine whether to pre-compile the running code according to the code amount of the running code. In this way, not only can the running code with a long compilation time be pre-compiled, but also the running code with a short compilation time can be selected according to actual use needs. In this way, the applicability of the present application is greatly improved.
[0073] In some embodiments, in response to the pre-compilation result not meeting the running condition, obtaining the user's running code; compiling the running code to obtain a first compilation result, and executing the first compilation result.
[0074] Here, the compilation result not meeting the running conditions can be understood as the compilation environment and the running environment are out of sync. For example, the running environment of the user on the edge server is being updated, and the compilation environment on the central server has not been updated. At this time, the pre-compilation result may not meet the running conditions.
[0075] As an example, when the pre-compilation result does not meet the preset conditions, the user's running code can be obtained and compiled in the current running environment, and the first compilation result can be obtained, and the first compilation result can be executed to obtain the user's computing resources.
[0076] It can be seen that in this way, when the pre-compiled result does not meet the running conditions, the user's running code can also be obtained, and at this time, the user's running code can be used for recompilation. In this way, the user's computing resources can be obtained by obtaining the first compilation result; and by adopting this method, the applicability of the disclosed edge computing method is greatly improved.
[0077] In some embodiments, the central server translates various types of running codes of users into the same category of codes to obtain translation results; the central server compiles the translation results to generate pre-compiled results.
[0078] As an example, the central server first translates various types of running codes for users into the same category of codes, so that only one compiler can be used to compile the running codes, thus saving computing resources consumed in the compilation process.
[0079] Furthermore, the compilation process of the running code can be made more efficient. For example, the running code corresponding to the tenant can be translated into a common code, and the compilation process of the common code is usually faster, so the time spent on the compilation process can be saved.
[0080] In some embodiments, the central server can translate various types of operating codes of the user into the same type of code. At this time, the edge server can also obtain the translation result in response to the pre-compiled result not meeting the operating condition; compile the translation result to obtain a first compiled result, and execute the first compiled result.
[0081] In this way, only one compiler is needed to compile the running codes of each category corresponding to the tenant, thereby saving compilation time and computing resources required in the compilation process.
[0082] As an example, when the pre-compilation result does not meet the running conditions, the edge server can also directly obtain the target category code that has been pre-translated from the central server. Then, the edge server only needs to compile the target category code to obtain computing resources. In this way, when the pre-compilation result does not meet the running conditions, the compilation process can be accelerated by obtaining the target category code. Accordingly, the cold start time of the user is shortened, and the user's request can be processed faster.
[0083] As an example, the target category can be set according to actual conditions, and the specific target category is not limited here. For example, it can be C language.
[0084] Further references Figure 4 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an edge computing device, which is similar to Figure 1 Corresponding to the edge computing method embodiment shown, the device can be specifically applied to various edge servers.
[0085] like Figure 4As shown, the edge computing device of this embodiment includes: an acquisition unit 401, which is used to obtain the pre-compilation result of the running code of the above-mentioned user in response to detecting a computing resource startup instruction for the user, wherein the above-mentioned pre-compilation result is generated before the above-mentioned computing resource startup instruction; an execution unit 402, which is used to execute the above-mentioned pre-compilation result in response to the above-mentioned pre-compilation result meeting the running conditions, and obtain the computing resources of the above-mentioned user, wherein the above-mentioned computing resources are used to process the request of the above-mentioned user.
[0086] In some embodiments, the pre-compiled result is generated by a central server compiling the user's running code, and the central server is communicatively connected with an edge server.
[0087] In some embodiments, the central server compiles the running code of the user, including: configuring a compilation environment matching the running environment according to the running environment of the user; and compiling the running code of the user in the configured compilation environment.
[0088] In some embodiments, the apparatus is further configured to: in response to receiving a request from the user, determine whether the runtime environment of the user is complete; in response to determining that the runtime environment of the user is incomplete, generate a computing resource startup instruction for the user.
[0089] In some embodiments, the apparatus is further configured to: in response to detecting a computing resource startup instruction for a user, send a compilation result acquisition request to the central server; and receive the pre-compilation result returned by the central server.
[0090] In some embodiments, the above-mentioned device is also used to: in response to detecting a computing resource startup instruction for a user, obtain the above-mentioned pre-compilation result from the local; wherein the above-mentioned central server pushes the generated pre-compilation result to the edge server in response to generating the above-mentioned pre-compilation result.
[0091] In some embodiments, in response to receiving the user's running code, the central server determines whether to compile the user's running code according to a preset compilation judgment condition.
[0092] In some embodiments, the above-mentioned compilation judgment conditions include at least one of the following: whether the running code is associated with a pre-compilation flag, whether the amount of the running code is greater than a preset threshold; wherein, the choice of whether to associate the pre-compilation flag with the running code is selected by the uploader of the running code, and the pre-compilation flag is used to indicate the compilation of the user's running code.
[0093] In some embodiments, the apparatus is further used to: in response to the pre-compilation result not meeting the running conditions, obtain the running code of the user; compile the running code to obtain a first compilation result, and execute the first compilation result.
[0094] In some embodiments, the central server translates various types of running codes of the user into the same category of codes to obtain translation results; the central server compiles the translation results to generate the pre-compiled results.
[0095] Please refer to Figure 5 , Figure 5 An exemplary system architecture is shown in which the edge computing method of one embodiment of the present disclosure can be applied.
[0096] like Figure 5 As shown, the system architecture may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 may be used to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0097] The terminal devices 501, 502, and 503 can interact with the server 505 through the network 504 to receive or send messages, etc. Various client applications, such as web browser applications, search applications, and news information applications, can be installed on the terminal devices 501, 502, and 503. The client applications in the terminal devices 501, 502, and 503 can receive user instructions and perform corresponding functions according to the user instructions, such as adding corresponding information to the information according to the user instructions.
[0098] Terminal devices 501, 502, 503 can be hardware or software. When terminal devices 501, 502, 503 are hardware, they can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Compression Standard Audio Layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4) players, laptop computers and desktop computers, etc. When terminal devices 501, 502, 503 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0099] The server 505 may be a server that provides various services, such as receiving information acquisition requests sent by the terminal devices 501, 502, and 503, acquiring display information corresponding to the information acquisition requests in various ways according to the information acquisition requests, and sending relevant data of the display information to the terminal devices 501, 502, and 503.
[0100] It should be noted that the edge computing method provided in the embodiment of the present disclosure can be executed by a terminal device, and accordingly, the edge computing device can be set in the terminal devices 501, 502, and 503. In addition, the edge computing method provided in the embodiment of the present disclosure can also be executed by a server 505, and accordingly, the edge computing device can be set in the server 505.
[0101] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0102] Reference below Figure 6 , which shows an electronic device (eg, Figure 5 The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0103] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 508 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0104] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0105] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0106] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0107] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0108] The computer-readable medium may be included in the edge server; or may exist independently without being installed in the edge server.
[0109] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the edge server: in response to detecting a computing resource startup instruction for a user, obtains a pre-compiled result of the user's running code, wherein the pre-compiled result is generated before the computing resource startup instruction; in response to the pre-compiled result meeting the running conditions, executes the pre-compiled result to obtain the computing resources of the user, wherein the computing resources are used to process the user's request.
[0110] In some embodiments, the pre-compiled result is generated by a central server compiling the user's running code, and the central server is communicatively connected with an edge server.
[0111] In some embodiments, the central server compiles the running code of the user, including: configuring a compilation environment matching the running environment according to the running environment of the user; and compiling the running code of the user in the configured compilation environment.
[0112] In some embodiments, the method further includes: in response to receiving the user's request, determining whether the user's runtime environment is complete; in response to determining that the user's runtime environment is incomplete, generating a computing resource startup instruction for the user.
[0113] In some embodiments, in response to detecting a computing resource startup instruction for a user, obtaining the pre-compilation result of the user's running code includes: in response to detecting a computing resource startup instruction for the user, sending a compilation result acquisition request to the central server; and receiving the pre-compilation result returned by the central server.
[0114] In some embodiments, in response to detecting a computing resource startup instruction for a user, obtaining the pre-compilation result of the running code of the user includes: in response to detecting a computing resource startup instruction for the user, obtaining the pre-compilation result from the local; wherein, in response to generating the pre-compilation result, the central server pushes the generated pre-compilation result to the edge server.
[0115] In some embodiments, in response to receiving the user's running code, the central server determines whether to compile the user's running code according to a preset compilation judgment condition.
[0116] In some embodiments, the above-mentioned compilation judgment conditions include at least one of the following: whether the running code is associated with a pre-compilation flag, and whether the code amount of the running code is greater than a preset threshold; wherein, whether the pre-compilation flag is associated with the running code is selected by the uploader of the running code, and the pre-compilation flag is used to indicate the compilation of the user's running code.
[0117] In some embodiments, in response to the pre-compilation result not meeting the running condition, obtaining the running code of the user; compiling the running code to obtain a first compilation result; and executing the first compilation result.
[0118] In some embodiments, the central server translates various types of running codes of the user into the same category of codes to obtain translation results; the central server compiles the translation results to generate the pre-compiled results.
[0119] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving 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 may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0120] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0121] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the acquisition unit 401 may also be described as a "unit for acquiring the pre-compiled result of the user's running code."
[0122] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0123] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0124] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0125] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0126] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. An edge computing method, characterized in that: Applied to edge servers, including: In response to detecting a computing resource startup instruction for a user, obtaining a pre-compilation result of the user's running code, wherein the pre-compilation result is generated before the computing resource startup instruction; In response to the pre-compilation result meeting the running condition, executing the pre-compilation result to obtain the computing resources of the user, wherein the computing resources are used to process the request of the user; The method further comprises: In response to the pre-compilation result not meeting the running condition, obtaining the running code of the user; Compiling the running code to obtain a first compilation result, and executing the first compilation result; The central server, in response to receiving the user's running code, determines whether to pre-compile the user's running code according to a preset compilation judgment condition; the central server is in communication connection with the edge server; The compilation judgment condition includes at least one of the following: whether the running code is associated with a pre-compilation flag, and whether the code amount of the running code is greater than a preset threshold; wherein, whether the pre-compilation flag is associated with the running code is selected by the uploader of the running code, and the pre-compilation flag is used to indicate that the user's running code is compiled.
2. The method according to claim 1, characterized in that The pre-compiled result is generated by the central server compiling the user's running code.
3. The method according to claim 2, characterized in that The central server compiles the user's running code, including: According to the user's operating environment, configure the compilation environment that matches the operating environment; In the configured compilation environment, the user's running code is compiled.
4. The method according to claim 2, characterized in that: The method further comprises: In response to receiving the user's request, determining whether the user's runtime environment is complete; In response to determining that the runtime environment of the user is incomplete, a computing resource activation instruction for the user is generated.
5. The method according to claim 4, characterized in that The step of obtaining the pre-compiled result of the running code of the user in response to detecting the computing resource startup instruction for the user includes: In response to detecting a computing resource startup instruction for a user, sending a compilation result acquisition request to the central server; Receive the pre-compilation result returned by the central server.
6. The method according to claim 4, characterized in that The step of obtaining the pre-compiled result of the running code of the user in response to detecting the computing resource startup instruction for the user includes: In response to detecting a computing resource startup instruction for a user, obtaining the pre-compiled result locally; In response to generating the pre-compilation result, the central server pushes the generated pre-compilation result to the edge server.
7. The method according to claim 2, characterized in that The central server translates various types of operating codes of the user into the same type of code to obtain a translation result; the central server compiles the translation result to generate the pre-compiled result.
8. An edge computing device, characterized in that: Applied to edge servers, edge computing devices include: an acquisition unit, configured to acquire, in response to detecting a computing resource startup instruction for a user, a pre-compilation result of a running code of the user, wherein the pre-compilation result is generated before the computing resource startup instruction; an execution unit, configured to execute the pre-compilation result in response to the pre-compilation result meeting the running condition, and obtain the computing resources of the user, wherein the computing resources are used to process the request of the user; The device is further configured to obtain the user's running code in response to the pre-compilation result not meeting the running condition; and compile the running code to obtain a first compilation result, and execute the first compilation result; The central server, in response to receiving the user's running code, determines whether to pre-compile the user's running code according to a preset compilation judgment condition; the central server is in communication connection with the edge server; The compilation judgment condition includes at least one of the following: whether the running code is associated with a pre-compilation flag, and whether the code amount of the running code is greater than a preset threshold; wherein, whether the pre-compilation flag is associated with the running code is selected by the uploader of the running code, and the pre-compilation flag is used to indicate that the user's running code is compiled.
9. An edge server, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
