A service orchestration method and system based on distributed runtime and edge agent

By using a distributed runtime and edge proxy service orchestration approach, business processes are abstracted into JavaScript files and executed on an Nginx server. This solves the performance and complexity issues of traditional systems in high-performance scenarios, and enables a high-performance, low-latency, and easily scalable service orchestration system.

CN119071357BActive Publication Date: 2026-01-20CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410934101.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2026-01-20
Estimated Expiration
2044-07-12

AI Technical Summary

Technical Problem

Traditional service orchestration systems suffer from performance disadvantages in high-concurrency, low-latency, high-performance business scenarios. They cannot perform compile-time optimizations, rely on middleware management systems, and heavily depend on microservice gateways, which increases the complexity of the system architecture.

Method used

We adopt a service orchestration approach based on distributed runtime and edge proxy. The distributed runtime provides middleware services, abstracts business processes into business documents and converts them into JavaScript files, deploys them using an Nginx server and executes them through the NJS execution engine, and combines code compiler for pre-optimization to achieve compile-time optimization and dynamic configuration.

Benefits of technology

It reduces system complexity, improves performance, achieves high-performance visual service orchestration, simplifies the development process, reduces integration difficulty, and provides a highly secure, high-concurrency, and low-latency service orchestration system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071357B_ABST
    Figure CN119071357B_ABST
Patent Text Reader

Abstract

This invention provides a service orchestration method and system based on a distributed runtime and edge proxy. The method includes: providing middleware services based on a distributed runtime; receiving business processes orchestrated by business parties through the middleware services and abstracting the business processes into business documents; converting nodes in the business documents into JavaScript functions to obtain the corresponding JavaScript file; deploying the JavaScript file through an Nginx server; and executing the deployed business processes based on the NJS execution engine. This invention improves the concurrent processing capability of the service orchestration system, reduces latency, and enhances security and scalability.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of cloud computing, and particularly relates to a service orchestration method and system based on a distributed runtime and an edge agent. BACKGROUND

[0002] Service orchestration is a new type of cloud computing application system for developing backend microservices through visual drag-and-drop and parameter configuration, supporting the aggregation and recombination of existing microservices to generate new services, and supporting the development of new services through the orchestration and writing of custom code for logic nodes and middleware nodes.

[0003] The traditional service orchestration system has a series of obvious defects in developing microservices, which limits its reliable application in high-concurrency, low-latency high-performance business scenarios. First, DSL is used as an information carrier to act on the complete life cycle of service definition, service publishing and service running. The running of the service is the process of interpretation and execution of the DSL. Because the compiler cannot be used for compile-time performance optimization, the interpretation and execution have performance disadvantages compared with the compilation and execution, and the performance loss is more obvious in the processing of complex giant DSL scenarios. Second, the system depends on a middleware management system, which is usually difficult to develop, maintain, upgrade and expand. In addition, because the microservice route configuration needs to be dynamically managed, the system heavily relies on the microservice gateway, which increases the complexity of the system architecture and restricts the performance of the microservice gateway. SUMMARY

[0004] In view of the above deficiencies of the prior art, the purpose of the application is to provide a service orchestration method and system based on a distributed runtime and an edge agent.

[0005] The first aspect of the application provides a service orchestration method based on a distributed runtime and an edge agent, comprising:

[0006] S1: providing a middleware service based on a distributed runtime;

[0007] S2: receiving a business process orchestrated by a business party through the middleware service, and abstracting the business process into a business document;

[0008] S3: converting a node in the business document into a JavaScript function to obtain a JavaScript file corresponding to the business document;

[0009] S4: deploying the JavaScript file through an Nginx server;

[0010] S5: executing the deployed business process based on an NJS execution engine.

[0011] The middleware service in step S1 includes a database, a cache, a message queue, and object storage.

[0012] The middleware service in step S1 is exposed through HTTP for calling by a business party.

[0013] The business document in step S2 is a directed acyclic graph represented by a DSL data structure.

[0014] The execution order of the JavaScript file in step S3 is a topological structure order of the directed acyclic graph.

[0015] The JavaScript file in step S3 is obtained through a code compiler.

[0016] The method further includes the following steps in step S3.

[0017] S31: The code compiler is pre-optimized, and the pre-optimization includes inline function expansion, useless code elimination, and conversion of serial code without dependency into parallel code.

[0018] The method further includes the following steps in step S4.

[0019] S41: The JavaScript file is published to a configuration path of an Nginx server to obtain an Nginx sub-configuration file.

[0020] S42: A reload instruction is executed, and a configuration file is hot updated according to the Nginx sub-configuration file to obtain an activated NJS module.

[0021] The method further includes the following steps in step S5.

[0022] S51: A to-be-executed JavaScript function in the activated NJS module is matched according to an HTTP request path and a request method.

[0023] S52: The to-be-executed JavaScript function is executed through an NJS execution engine.

[0024] The second aspect of the present application provides a service orchestration system based on a distributed runtime and an edge agent, configured to perform the service orchestration method based on a distributed runtime and an edge agent according to any one of the preceding aspects, comprising:

[0025] a service module configured to provide middleware services based on the distributed runtime;

[0026] a receiving module configured to receive a business process orchestrated by a business party through the middleware services, and abstract the business process into a business document;

[0027] a conversion module configured to convert nodes in the business document into JavaScript functions, and obtain a JavaScript file corresponding to the business document;

[0028] a deployment module configured to deploy the JavaScript file through an Nginx server;

[0029] an execution module configured to execute the deployed business process based on an NJS execution engine.

[0030] The present application has the following advantages:

[0031] The service orchestration method and system based on a distributed runtime and an edge agent provided by the present application can uniformly manage and provide middleware services based on a general standard distributed runtime, and can compile service orchestration DSL products into standard JavaScript code that can be directly run, directly run on an edge agent server NJS engine based on Nginx, replace micro-service gateway components through dynamic generation of proxy configurations based on code analysis, reduce system complexity, and improve the system to near-optimal performance of Nginx.

[0032] The present application can realize a high-performance visual service orchestration system, which can compile service orchestration products into optimized JavaScript code and finally run in an edge agent server, thanks to the introduction of a distributed runtime and the micro-service gateway-free architecture design. Based on the system, developers only need to drag, connect and configure visually to realize any micro-service interface development with complete functions. BRIEF DESCRIPTION OF DRAWINGS

[0033] The accompanying drawings are included to provide a further understanding of embodiments of the application, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the application and, together with the description, serve to explain the principles of the application. In the drawings:

[0034] Fig. 1 A service orchestration method based on distributed runtime and edge agent provided by the present application is shown in the flowchart;

[0035] Fig. 2 A service orchestration system structure based on distributed runtime and edge agent provided by the present application is shown in the schematic diagram.

[0036] Reference signs:

[0037] 100, service module; 200, receiving module; 300, conversion module; 400, deployment module; 500, execution module. DETAILED DESCRIPTION

[0038] In order for those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions of the present application will be described clearly and completely in conjunction with the drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.

[0039] In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concepts disclosed in the present application.

[0040] In the description of the present application, it should be noted that, unless otherwise explicitly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like is based on the orientation or position relationship shown in the drawings, and is only for the convenience of describing the present application and simplifying the description, and therefore cannot be understood as indicating or implying that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", "third" are only for the purpose of description, and cannot be understood as indicating or implying relative importance. The terms "mounting", "connecting", "connecting" should be understood broadly, for example, it can be fixedly connected, or it can be detachably connected, or integrally connected; it can be mechanically connected, or it can be electrically connected; it can be directly connected, or it can be indirectly connected through an intermediate medium, or it can be the communication between two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.

[0041] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The following description is presented in the context of the drawings, where like numbers represent like or similar elements for ease of understanding. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.

[0042] To better understand the embodiments of the present application, the following first describes the conventional implementation of the service orchestration system.

[0043] In the common implementation of the current service orchestration system, the following basic function modules are usually provided: a service orchestration canvas, a visual editor for process design and logic orchestration, a DSL generator; service management, management of service DSL, triggers, and service publishing; microservice middleware management, middleware configuration management, driver management, authentication management, link management, etc. of database, message queue, object storage, etc.; microservice gateway, dynamically registering service access entry according to trigger configuration, implementing service governance and traffic control, etc.

[0044] The following describes the embodiments of the present application according to Figs. 1-2 The embodiments of the present application are described.

[0045] As shown in Fig. 1 The first aspect of the present application provides a service orchestration method based on distributed runtime and edge agent, comprising:

[0046] S1: providing middleware services based on distributed runtime;

[0047] Further, the distributed runtime of step S1 is an extensible microservice capability platform, which provides a unified standard HTTP access method for various middleware such as database, message queue, and object storage by abstracting basic capabilities such as state, storage, message, and cache.

[0048] Among them, the middleware services in step S1 include: database, cache, message queue, and object storage.

[0049] Among them, the middleware services in step S1 are exposed through HTTP for business side to call.

[0050] Further, the distributed runtime provides a unified HTTP interface for various middleware services (such as database, message queue, and object storage), which has the advantage that no matter what type of middleware is used at the bottom, the business side can interact with it through HTTP request, thereby simplifying the development process and reducing the integration difficulty.

[0051] S2: receiving a service flow orchestrated by a service party through the middleware service, and abstracting the service flow into a service document;

[0052] Further, the service flow orchestrated by the service party is imported through a service orchestration editor, which is a visual drag canvas. The service orchestration editor can operate two basic units, logic nodes and middleware nodes. Through the visual drag orchestration canvas, the middleware nodes and logic nodes are dragged, placed, parameter set, wired, and other operations according to the logical relationship of the service flow, and the service flow and logic are abstracted into a directed acyclic graph represented by a DSL data structure.

[0053] In step S2, the service document is a directed acyclic graph represented by a DSL data structure.

[0054] Further, DSL is usually more concise and easier to understand than general programming languages because it focuses on solving problems in specific fields. In this scenario, DSL is used to define and describe the structure and logic of the service flow, and DAG is commonly used to represent a sequence of tasks or events with dependencies but no circular dependencies.

[0055] S3: converting the nodes in the service document into JavaScript functions to obtain a JavaScript file corresponding to the service document;

[0056] In step S3, the DSL document generated in step S2 is compiled into a JavaScript file by a code generator, where each node is translated into a corresponding JavaScript function.

[0057] In step S3, the JavaScript file is obtained through a code compiler.

[0058] In the DSL document, each node represents a specific step or logical unit in the service flow. In the processing process of the code generator, these nodes will be converted into functions in JavaScript. Each function encapsulates the logic or operation corresponding to the original DSL node, so that these operations can be performed in the JavaScript environment. For example, if there is a node in the DSL document that represents calling a database service to obtain data, the code generator may generate a JavaScript function that encapsulates the specific logic of calling the database service, including parameter passing, error handling, etc.

[0059] In step S3, the execution order of the JavaScript file is the topological structure order of the directed acyclic graph.

[0060] The above-mentioned directed acyclic graph is a graph structure in which the edges are all directional, and there is no loop in the graph, which means that starting from any vertex in the graph, following the directional edges, eventually the starting point will not be returned. DAG is often used to represent the sequence of tasks or events with dependency but no circular dependency, so the directed acyclic graph obtained in step S2 can represent the execution order in the business process, so the execution order of the JavaScript file in step S3 is the topological order of the directed acyclic graph.

[0061] In the step S3, further comprising:

[0062] S31: Pre-optimizing the code compiler, the pre-optimization including inline function expansion, useless code elimination, and changing serial code without dependency into parallel code.

[0063] Further, inline function expansion is a compiler optimization technique that inserts the function body directly into each place where the function is called, rather than making a function call in the usual way. The benefits include reducing the overhead of function calls (such as saving and restoring registers, stack operations, etc.), and possibly enabling the compiler to perform further optimizations such as dead code elimination and constant propagation.

[0064] And useless code elimination is another compiler optimization technique, which is used to remove code that will never be executed, which may be caused by the branch of conditional statements never being true, functions never being called, variables never being used after assignment, etc. By eliminating these useless codes, the size of the program can be reduced, the execution efficiency of the program can be improved, and other optimization techniques can be more effective.

[0065] In modern multi-core processors and distributed computing environments, parallelization is an important means to improve program performance. The compiler can analyze the dependency relationship in the code and try to convert serial code segments that have no mutual dependency into parallel code, that is, these code segments can be executed simultaneously on different processor cores, thereby significantly reducing the total execution time of the program.

[0066] S4: Deploying the JavaScript file through the Nginx server;

[0067] In the step S4, further comprising:

[0068] S41: Publishing the JavaScript file to the configuration path of the Nginx server to obtain an Nginx sub-configuration file;

[0069] In step S41, after the JavaScript file is published to the configuration path of the Nginx server, that is, after the file is placed, an Nginx sub-configuration file (.conf file) needs to be written or modified, which specifies how the NJS module loads and executes the JavaScript file. The sub-configuration file can include, for example, a js_import instruction for importing the JavaScript file, and other related Nginx configuration instructions for defining how to handle the business logic defined by the JavaScript file.

[0070] S42: Execute the reload instruction to hot update the configuration file according to the Nginx sub-configuration file, and obtain the activated NJS module.

[0071] Further, after the Nginx sub-configuration file is written and placed properly, the Nginx server needs to be notified to reload its configuration to recognize and use the settings in the new sub-configuration file. This step is completed by executing the reload instruction of Nginx, which will notify Nginx to reload its configuration file, including the newly placed sub-configuration file, without stopping the service.

[0072] When Nginx reloads the configuration, it recognizes the new NJS module-related configuration, including the JavaScript file that needs to be loaded. Subsequently, Nginx activates the NJS module and executes the functions and logic defined in the JavaScript file. In this way, the business process arranged by the service arrangement editor is dynamically integrated into the Nginx server, and can be executed and provided as a service through the powerful functions of Nginx (such as reverse proxy, load balancing, etc.).

[0073] S5: Execute the deployed business process based on the NJS execution engine.

[0074] Further, step S5 further includes:

[0075] S51: According to the HTTP request path and request method, match the to-be-executed JavaScript function in the activated NJS module.

[0076] When Nginx receives an HTTP request, it determines the operation the client wants to perform according to the request URL path (request path) and HTTP method. The NJS module configuration of Nginx allows specific URL paths or patterns to be mapped to specific JavaScript functions.

[0077] In step S51, Nginx searches its activated NJS module for a JavaScript function that matches the current HTTP request path and request method. This matching is achieved through regular expressions, URL pattern matching, or other configuration mechanisms. Once a matching function is found, Nginx knows which JavaScript function to execute to handle the HTTP request.

[0078] S52: Execute the JavaScript function to be executed through the NJS execution engine.

[0079] Furthermore, once the JavaScript function to be executed is determined, Nginx will use its built-in NJS execution engine to execute the function. During execution, the JavaScript function can access the HTTP request and response objects, thereby being able to read request data (such as query parameters, request body, etc.) and generate response data (such as setting response headers, sending response body, etc.).

[0080] JavaScript functions can also execute more complex logic, such as calling external services, querying databases, and performing authentication. These operations are usually accomplished through asynchronous I / O operations. The NJS module supports these operations, allowing JavaScript code to execute in a non-blocking manner.

[0081] like Fig. 2 As shown, a second aspect of the present invention provides a service orchestration system based on a distributed runtime and edge proxy for executing a service orchestration method based on a distributed runtime and edge proxy as described in any of the preceding claims, comprising:

[0082] Service Module 100: Used to provide middleware services based on a distributed runtime;

[0083] Receiving module 200: Used to receive the business process orchestrated by the business party through the middleware service, and abstract the business process into a business document;

[0084] Conversion module 300: used to convert the nodes in the business document into JavaScript functions to obtain the JavaScript file corresponding to the business document;

[0085] Deployment module 400: Used to deploy the JavaScript file via an Nginx server;

[0086] Execution Module 500: Used to execute deployed business processes based on the NJS execution engine.

[0087] The application provides a service orchestration method and system based on a distributed runtime and an edge agent.

[0088] First, deploy the Nginx edge agent server, load the NJS extension, expose the POST / deploy route, receive the generated function information processing, and hot load the configuration, and start the service.

[0089] Second, deploy the distributed runtime, add the MySQL middleware, create the orders table, add the Redis middleware, and insert product order and inventory example data. The distributed runtime deployment address in this example is http: / / 10.0.0.80.

[0090] Third, create a new orchestration service of the HTTP request type, set the request method to POST and the request path to / orders.

[0091] Fourth, click Edit to enter the orchestration service drag-and-drop canvas, drag in the function node, Redis node, and MySQL node, and sequentially link the three nodes. Configure the function node to verify the input parameters, the Redis node to check and decrement product inventory, and the MySQL node to generate orders. If the operation is successful, the result is returned to the NJS engine, and the client is finally responded to. The authentication and order generation failure logic are omitted here. The production system can access multiple retries, transaction rollback, or generate work orders for manual intervention.

[0092] Fifth, generate the DSL. According to the node DSL template and node configuration, as well as the connection information, generate the DSL service orchestration diagram.

[0093] Sixth, code generation. According to the node JS code template combined with the configuration parameters, compile each node into a single JavaScript function. For example, compile the Redis node and MySQL node into a standard fetch network request. After processing the parameters with the Handlebars template tool, call the distributed runtime interface to execute the Redis and MySQL commands. According to the DSL topology order, encapsulate the complete process into a Promise call chain, and finally compile the service orchestration DSL compilation code.

[0094] Seventh, service deployment. Use the function generated in the fourth step as the carrier, and request POST / deploy.

[0095] Eighth, the controller will parse the DSL configuration to obtain the location and method information of the HTTP entry type service, generate the proxy rules in the Nginx configuration file according to the information, save the function body as a file in the configuration path, and trigger the Nginx configuration hot update.

[0096] The ninth step requests POST / orders, and the route configured in step 7 is accepted, and the function in step 6 is executed by the NJS engine for processing, and finally the result is returned to the client.

[0097] The application provides a service orchestration method and system based on a distributed runtime and an edge agent. The method separates concerns by introducing a distributed runtime module, and uses code generation technology and a code deployment scheme on an edge agent gateway. Compared with a traditional service orchestration system, the method has the following advantages: easy expansion, the introduction of a distributed runtime abstracts all middleware operations into standard HTTP operations, and a declarative configuration hot update method is used to support the dynamic addition of new services; high performance, the introduction of a code generation stage compiles DSL into executable code before deployment, and combines inline function expansion, serial-to-parallel conversion and other compilation optimization methods to optimize the product of service orchestration to the highest performance; high security, the NJS engine is a JavaScript interpreter developed by Nginx for high-performance server optimization. Because of its single-request single-virtual machine memory sharing model design and limitation of all system resource access permissions except network requests, the NJS engine provides high security protection and can be used to execute untrusted arbitrary JavaScript code; high concurrency and low latency, the method is directly run on an Nginx edge agent server to provide near-native extreme concurrency capability of the Nginx server.

[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present application, and not to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered within the protection scope of the present application.

Claims

1. A service orchestration method based on distributed runtime and edge proxy, characterized in that, include: S1: Provides middleware services based on a distributed runtime; S2: Receive the business process orchestrated by the business party through the middleware service, and abstract the business process into a business document; In step S2, the business document is a directed acyclic graph represented by a DSL data structure. S3: Convert the nodes in the business document into JavaScript functions to obtain the JavaScript file corresponding to the business document; In step S3, the execution order of the JavaScript files is the topological order of the directed acyclic graph, and the JavaScript files are obtained through a code compiler. Based on the directed acyclic graph represented by the DSL data structure, where each node represents a specific step or logical unit in the business process; during the processing of the code compiler, each node in the business document is converted into a JavaScript function, where each function encapsulates the logic or operation corresponding to the converted node; S4: Deploy the JavaScript file using an Nginx server; S5: Executes deployed business processes based on the NJS execution engine.

2. The service orchestration method based on distributed runtime and edge proxy according to claim 1, characterized in that, The middleware services mentioned in step S1 include: database, cache, message queue and object storage.

3. The service orchestration method based on distributed runtime and edge proxy according to claim 1, characterized in that, The middleware service mentioned in step S1 is exposed via HTTP for business users to call.

4. The service orchestration method based on distributed runtime and edge proxy according to claim 1, characterized in that, Step S3 also includes: S31: The code compiler is pre-optimized, including inline function expansion, useless code elimination, and converting undependent serial code into parallel code.

5. A service orchestration method based on distributed runtime and edge proxy according to claim 1, characterized in that, Step S4 further includes: S41: Publish the JavaScript file to the configuration path of the Nginx server to obtain the Nginx sub-configuration file; S42: Execute the reload command to hot-update the configuration file according to the Nginx sub-configuration file and obtain the activated NJS module.

6. A service orchestration method based on distributed runtime and edge proxy according to claim 5, characterized in that, Step S5 further includes: S51: Match the JavaScript function to be executed in the active NJS module based on the HTTP request path and request method; S52: Execute the JavaScript function to be executed through the NJS execution engine.

7. A service orchestration system based on distributed runtime and edge proxy, used to execute the service orchestration method based on distributed runtime and edge proxy as described in any one of claims 1-6, characterized in that, include: Service module: Used to provide middleware services based on a distributed runtime; Receiving module: Used to receive business processes orchestrated by the business party through the middleware service, and abstract the business processes into business documents; The business document is a directed acyclic graph represented by a DSL data structure; Conversion module: Used to convert the nodes in the business document into JavaScript functions to obtain the JavaScript file corresponding to the business document; The JavaScript files are executed in the order of the topological structure of the directed acyclic graph, and the JavaScript files are obtained through a code compiler. Based on the directed acyclic graph represented by the DSL data structure, where each node represents a specific step or logical unit in the business process; during the processing of the code compiler, each node in the business document is converted into a JavaScript function, where each function encapsulates the logic or operation corresponding to the converted node; Deployment module: used to deploy the JavaScript file via the Nginx server; Execution module: used to execute the deployment business process based on the NJS execution engine.

Citation Information

Patent Citations

  • Service processing method and device

    CN109783562A

  • Method for improving processing of sensor stream data in distributed network

    CN111367187A