Service orchestration method and system based on distributed runtime and edge proxy

By introducing distributed runtime and edge agents into the service orchestration system, converting business processes into JavaScript code and executing them on the Nginx server, the performance problems of traditional systems in high concurrency and low latency scenarios are solved, and high-performance services are achieved Orchestration and interface development.

CN119071357AActive Publication Date: 2024-12-03CHINA TELECOM CLOUD TECH CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

Traditional service orchestration systems have performance disadvantages in high-performance business scenarios with high concurrency and low latency, middleware management systems that are difficult to develop, maintain and expand, and system architecture complexity due to relying on microservice gateways.

Method used

Adopt a service orchestration method based on distributed runtime and edge agents, receive business processes through middleware services, abstract into business documents and convert them into JavaScript files, deployed on Nginx servers, execute using NJS execution engine, and optimize the compilation period to improve performance and reduce dependence on microservice gateways through code generation techniques.

Benefits of technology

A high-performance visual service orchestration system is realized, reducing system complexity and improving performance. Developers can realize fully functional microservice interface development through dragging, connecting and configuration, and the system performance is close to the ultimate performance of Nginx.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071357A_ABST
    Figure CN119071357A_ABST
Patent Text Reader

Abstract

The invention provides a service orchestration method and system based on distributed runtime and edge proxy. The method comprises the following steps: providing middleware service based on the distributed runtime; receiving a business process arranged by a business party through the middleware service, and abstracting the business process into a business document; nodes in the service document are converted into a JavaScript function, and a JavaScript file corresponding to the service document is obtained; the JavaScript file is deployed through an Nginx server, and the JavaScript file is stored in the Nginx server; and executing the deployed business process based on the NJS execution engine. According to the invention, the concurrent processing capability of the service orchestration system is improved, the time delay is reduced, and the security and expansibility can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of cloud computing, and in particular relates to a service orchestration method and system based on distributed runtime and edge proxy. Background Art

[0002] Service orchestration is a new type of cloud computing application system that develops backend microservices through visual drag-and-drop and parameter configuration. It supports the aggregation and reorganization of existing microservices to generate new services, and also supports the development of new services through the orchestration of logical nodes and middleware nodes and the writing of custom codes.

[0003] The traditional service orchestration system has a series of obvious defects in the way it develops microservices, which limits its reliable application in high-performance business scenarios with high concurrency and low latency. First, DSL is used as an information carrier, which acts on the entire life cycle of service definition, service release, and service operation. The operation of the service is the process of interpreting and executing DSL. Because the compiler cannot be used for compile-time performance optimization, interpreted execution has a performance disadvantage over compiled execution, and the performance loss is more obvious in giant DSL scenarios with complex processing logic. Secondly, it relies on the middleware management system, which is usually difficult to develop, maintain, upgrade and expand. In addition, due to the need to dynamically manage the microservice routing configuration, it relies heavily on the microservice gateway, which increases the complexity of the system architecture and restricts the performance of the microservice gateway. Summary of the invention

[0004] In view of the above deficiencies in the prior art, the object of the invention is to provide a service orchestration method and system based on distributed runtime and edge proxy.

[0005] A first aspect of the present invention provides a service orchestration method based on a distributed runtime and an edge agent, comprising: S1: Provides middleware services based on distributed runtime; S2: receiving the business process choreographed by the business party through the middleware service, and abstracting the business process into a business document; S3: Convert the nodes in the business document into JavaScript functions to obtain a JavaScript file corresponding to the business document; S4: deploy the JavaScript file through the Nginx server; S5: Business processes deployed based on NJS execution engine execution.

[0006] According to a service orchestration method based on distributed runtime and edge agent provided by the present invention, the middleware service in step S1 includes: database, cache, message queue and object storage.

[0007] According to a service orchestration method based on distributed runtime and edge agent provided by the present invention, the middleware service in step S1 is exposed via HTTP for invocation by the business party.

[0008] According to a service orchestration method based on distributed runtime and edge agent provided by the present invention, the business document in step S2 is a directed acyclic graph represented by a DSL data structure.

[0009] According to a service orchestration method based on distributed runtime and edge agent provided by the present invention, the execution order of the JavaScript files in step S3 is the topological structure order of the directed acyclic graph.

[0010] According to a service orchestration method based on distributed runtime and edge agent provided by the present invention, in step S3, the JavaScript file is obtained through a code compiler.

[0011] According to a service orchestration method based on distributed runtime and edge agent provided by the present invention, step S3 also includes: S31: Pre-optimizing the code compiler, wherein the pre-optimization includes expanding inline functions, eliminating useless codes, and converting serial codes without dependencies into parallel codes.

[0012] According to a service orchestration method based on distributed runtime and edge agent provided by the present invention, step S4 further includes: S41: Publishing the JavaScript file to the configuration path of the Nginx server to obtain an Nginx sub-configuration file; S42: Execute the reload instruction, and hot-update the configuration file according to the Nginx sub-configuration file to obtain the activated NJS module.

[0013] According to a service orchestration method based on distributed runtime and edge agent provided by the present invention, step S5 further includes: S51: Match the JavaScript function to be executed in the activated NJS module according to the HTTP request path and request method; S52: Execute the JavaScript function to be executed through the NJS execution engine.

[0014] A second aspect of the present invention provides a service orchestration system based on a distributed runtime and an edge agent, for executing a service orchestration method based on a distributed runtime and an edge agent as described in any one of the above items, comprising: Service module: used to provide middleware services based on distributed runtime; Receiving module: used to receive the business process arranged by the business party through the middleware service, and abstract the business process into a business document; Conversion module: used to convert the nodes in the business document into JavaScript functions, and obtain the JavaScript file corresponding to the business document; Deployment module: used to deploy the JavaScript file through the Nginx server; Execution module: used to execute deployed business processes based on the NJS execution engine.

[0015] The beneficial effects of the present invention are as follows: The present invention provides a service orchestration method and system based on distributed runtime and edge proxy. The universal standard distributed runtime uniformly manages and provides middleware services. The compile-time optimization and code generation technology compile the service orchestration DSL product into standard JavaScript code that can be directly run, and directly runs on the NJS engine of the edge proxy server based on Nginx. The proxy configuration is dynamically generated through code analysis to replace the microservice gateway component, reduce system complexity, and improve the system to an extreme performance close to Nginx.

[0016] The present invention can realize a high-performance visual service orchestration system. Thanks to the introduction of distributed runtime and the design of microservice gateway-free architecture, the service orchestration products can be compiled to generate optimized JavaScript code and finally run in the edge proxy server. Based on this system, developers only need to drag, connect and configure visually to realize the development of any fully functional microservice interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.

[0018] Figure 1 A schematic diagram of a service orchestration method based on distributed runtime and edge proxy provided by the present invention; Figure 2 A schematic diagram of the structure of a service orchestration system based on distributed runtime and edge agent provided by the present invention.

[0019] Reference numerals: 100, service module; 200, receiving module; 300, conversion module; 400, deployment module; 500, execution module. DETAILED DESCRIPTION

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

[0021] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.

[0022] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0023] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments 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.

[0024] In order to better understand the embodiments of the present invention, a conventional implementation scheme of a service orchestration system is first described below.

[0025] The common implementation schemes of current service orchestration systems usually have the following basic functional modules: service orchestration canvas, which provides a visual editor for process design and logic orchestration and generates DSL; service management, which manages service DSL, triggers and service release; microservice middleware management, which includes database, message queue, object storage and other middleware configuration management, driver management, authentication management, link management, etc.; microservice gateway, which dynamically registers service access portals according to trigger configuration to implement service governance and traffic control and other functions.

[0026] According to the following Figure 1 to Figure 2 Embodiments of the present invention are described.

[0027] like Figure 1 As shown, the first aspect of the present invention provides a service orchestration method based on distributed runtime and edge agent, comprising: S1: Provides middleware services based on distributed runtime; Furthermore, the distributed runtime described in step S1 is a scalable microservice capability platform, which provides a unified standard HTTP access method for various middleware such as databases, message queues, object storage, etc. by abstracting basic capabilities such as state, storage, messaging, and caching.

[0028] The middleware services in step S1 include: database, cache, message queue and object storage.

[0029] The middleware service in step S1 is exposed via HTTP for invocation by the business party.

[0030] Furthermore, the distributed runtime provides a unified HTTP interface for various middleware services (such as databases, message queues, object storage, etc.). The advantage is that no matter what type of middleware is used at the bottom layer, the business party can interact with it through HTTP requests, thereby simplifying the development process and reducing the difficulty of integration.

[0031] S2: receiving the business process choreographed by the business party through the middleware service, and abstracting the business process into a business document; Furthermore, the business process orchestrated by the business party is passed in through the service orchestration editor. The service orchestration editor is a visual drag canvas that can operate two basic units: logic nodes and middleware nodes. Through the visual drag-and-drop orchestration canvas, the middleware nodes and logic nodes are dragged, placed, parameterized, connected, and other operations are performed according to the logical relationship of the business process, abstracting the business process and logic into a directed acyclic graph represented by a DSL data structure.

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

[0033] Furthermore, DSL is usually more concise and easier to understand than general-purpose programming languages ​​because it focuses on solving problems in a specific field. In this scenario, DSL is used to define and describe the structure and logic of business processes, while DAG is often used to represent a sequence of tasks or events with dependencies but no circular dependencies.

[0034] S3: Convert the nodes in the business document into JavaScript functions to obtain a JavaScript file corresponding to the business document; In step S3, the DSL document generated in step S2 is compiled into a JavaScript file by a code generator, wherein each node is translated into a corresponding JavaScript function.

[0035] Wherein, in step S3, the JavaScript file is obtained through a code compiler.

[0036] In a DSL document, each node represents a specific step or logic unit in a business process. During the processing 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 a JavaScript environment. For example, if there is a node in a 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.

[0037] The execution order of the JavaScript files in step S3 is the topological structure order of the directed acyclic graph.

[0038] The directed acyclic graph mentioned above is a graph structure in which the edges are directed and there is no cycle in the graph, which means that starting from any vertex in the graph and moving along the directed edges will not return to the starting point. DAG is often used to represent a sequence of tasks or events with dependencies but no cyclic dependencies, 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 files in step S3 is the topological structure order of the directed acyclic graph.

[0039] Wherein, the step S3 also includes: S31: Pre-optimizing the code compiler, wherein the pre-optimization includes expanding inline functions, eliminating useless codes, and converting serial codes without dependencies into parallel codes.

[0040] Furthermore, 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 conventional way. The beneficial effects include reducing the overhead of function calls (such as saving and restoring registers, stack operations, etc.), and may enable the compiler to perform further optimizations such as dead code elimination and constant propagation.

[0041] Dead code elimination is another compiler optimization technique that is used to remove code that will never be executed. This code may be caused by branches of conditional statements that will never be true, functions that will never be called, variables that are never 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 may be made more effective.

[0042] In modern multi-core processors and distributed computing environments, parallelization is an important means to improve program performance. The compiler can analyze the dependencies in the code and try to convert serial code segments that have no mutual dependencies 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.

[0043] S4: deploy the JavaScript file through the Nginx server; Wherein, step S4 further comprises: S41: Publishing the JavaScript file to the configuration path of the Nginx server to obtain an Nginx sub-configuration file; In step S41, after publishing the JavaScript file to the configuration path of the Nginx server, that is, after placing the file, it is necessary to write or modify an Nginx sub-configuration file (.conf file). This configuration file specifies how the NJS module loads and executes the JavaScript file. The sub-configuration file may contain instructions such as js_import, which is used to import JavaScript files, and other related Nginx configuration instructions, which are used to define how to process the business logic defined by this JavaScript file.

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

[0045] Furthermore, after the Nginx sub-configuration file is written and placed properly, it is necessary to notify the Nginx server to reload its configuration so that it can recognize and use the settings in the new sub-configuration file. This step is completed by executing the Nginx reload instruction. The reload instruction will notify Nginx to reload its configuration files, including the newly placed sub-configuration file, without stopping the service.

[0046] When Nginx reloads the configuration, it will recognize the new NJS module-related configuration, including the JavaScript file that needs to be loaded. Then, Nginx will activate the NJS module and execute the functions and logic defined in the JavaScript file. In this way, the business process orchestrated by the business party through the service orchestration editor is dynamically integrated into the Nginx server and can be executed and provided through the powerful functions of Nginx (such as reverse proxy, load balancing, etc.).

[0047] S5: Business processes deployed based on NJS execution engine execution.

[0048] Wherein, step S5 further comprises: S51: Match the JavaScript function to be executed in the activated NJS module according to the HTTP request path and request method; When Nginx receives an HTTP request, it determines what the client wants to do based on the requested URL path (request path) and HTTP method. Nginx's NJS module configuration allows specific URL paths or patterns to be mapped to specific JavaScript functions.

[0049] In step S51, Nginx will search its activated NJS module to see if there is a JavaScript function that matches the current HTTP request path and request method. The matching is achieved through regular expressions, URL pattern matching or other configuration mechanisms. Once a matching function is found, Nginx knows which JavaScript function should be executed to process the HTTP request.

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

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

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

[0053] like Figure 2 As shown, the second aspect of the present invention provides a service orchestration system based on a distributed runtime and an edge agent, which is used to execute a service orchestration method based on a distributed runtime and an edge agent as described in any one of the above items, including: Service module 100: used to provide middleware services based on distributed runtime; Receiving module 200: used to receive the business process arranged by the business party through the middleware service, and abstract the business process into a business document; Conversion module 300: used to convert the nodes in the business document into JavaScript functions, and obtain the JavaScript file corresponding to the business document; Deployment module 400: used to deploy the JavaScript file through the Nginx server; Execution module 500: used to execute the deployed business process based on the NJS execution engine.

[0054] The following is an exemplary description of the specific implementation of a service orchestration method and system based on distributed runtime and edge proxy provided by the present invention.

[0055] First, deploy the Nginx edge proxy server, load the NJS extension, expose the POST / deploy route, receive the generated function information, process it, hot-load the configuration, and start the service.

[0056] The second step is to deploy the distributed runtime, add MySQL middleware, create a new order table orders, add Redis middleware, and insert product order and inventory sample data. The distributed runtime deployment address in this example is http: / / 10.0.0.80.

[0057] In the third step, create a new orchestration service of HTTP request type, set the request method to POST and the request path to / orders.

[0058] Step 4: Click Edit to enter the orchestration service drag canvas, drag in the function node, Redis node, and MySQL node, and link the three nodes in sequence. Configure the function node to verify the input parameters, the Redis node to check and decrement the product inventory, and the MySQL node to generate orders. If the operation is successful, the result will be returned to the NJS engine, and finally the client will be responded to. The logic of authentication and order generation failure is omitted here. The production system can be connected to multiple retries, transaction rollbacks, or manual intervention for generating work orders.

[0059] The fifth step is to generate DSL. According to the node DSL template, node configuration, and connection information, a DSL service orchestration diagram is generated.

[0060] The sixth step is code generation. According to the node's JS code template and configuration parameters, each node is compiled into a single JavaScript function. For example, the Redis node and MySQL node are compiled into a standard fetch network request. After the parameters are processed by the Handlebars template tool, the distributed runtime interface is called to execute the Redis and MySQL commands. According to the DSL topology sequence, the complete process is encapsulated into a Promise call chain, and finally compiled into the service orchestration DSL compiled code.

[0061] The seventh step is service deployment. Use the function generated in the fourth step as a carrier and request POST / deploy.

[0062] In the eighth step, 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 based on this information, save the function body as a file in the configuration path, and trigger the hot update of the Nginx configuration.

[0063] In the ninth step, requesting POST / orders will be accepted by the route configured in step 7, and the NJS engine will execute the function in step 6 for processing, and finally return the result to the client.

[0064] The present invention proposes a service orchestration method and system based on distributed runtime and edge proxy, which realizes separation of concerns by introducing distributed runtime module, adopts code generation technology and deploys code on edge proxy gateway solution, and has the following advantages compared with the traditional service orchestration system implementation: easy expansion, introducing distributed runtime, abstracting all middleware operations into standard HTTP operations, and supporting dynamic addition of new services by declarative configuration hot update; high performance, introducing code generation stage, compiling DSL into directly executable code before deployment, and combining multiple compilation period optimization means such as inline function expansion and serial to parallel conversion, so as to optimize the product of service orchestration to the highest performance; high security, NJS engine is a JavaScript language interpreter developed by Nginx specifically for high-performance server optimization, and provides high security guarantee due to its single-request single-virtual machine without memory sharing model design, and restricts all system resource access rights except network requests, and can be used to execute any untrusted JavaScript code; high concurrency and low latency, directly running on Nginx edge proxy server, providing extreme concurrency capability close to the native Nginx server.

[0065] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; 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 invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.

Claims

1. A service orchestration method based on distributed runtime and edge agent, characterized in that: include: S1: Provides middleware services based on distributed runtime; S2: receiving the business process choreographed by the business party through the middleware service, and abstracting the business process into a business document; S3: Convert the nodes in the business document into JavaScript functions to obtain a JavaScript file corresponding to the business document; S4: deploy the JavaScript file through the Nginx server; S5: Business processes deployed based on NJS execution engine execution.

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

3. A service orchestration method based on distributed runtime and edge agent according to claim 1, characterized in that: The middleware service in step S1 is exposed via HTTP for invocation by the business party.

4. A service orchestration method based on distributed runtime and edge agent according to claim 1, characterized in that: The business document in step S2 is a directed acyclic graph represented by a DSL data structure.

5. A service orchestration method based on distributed runtime and edge agent according to claim 4, characterized in that: The execution order of the JavaScript files in step S3 is the topological structure order of the directed acyclic graph.

6. A service orchestration method based on distributed runtime and edge agent according to claim 1, characterized in that: In step S3, the JavaScript file is obtained through a code compiler.

7. A service orchestration method based on distributed runtime and edge agent according to claim 6, characterized in that: The step S3 also includes: S31: Pre-optimizing the code compiler, wherein the pre-optimization includes expanding inline functions, eliminating useless codes, and converting serial codes without dependencies into parallel codes.

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

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

10. A service orchestration system based on distributed runtime and edge agent, used to execute a service orchestration method based on distributed runtime and edge agent as claimed in any one of claims 1 to 9, characterized in that: include: Service module: used to provide middleware services based on distributed runtime; Receiving module: used to receive the business process arranged by the business party through the middleware service, and abstract the business process into a business document; Conversion module: used to convert the nodes in the business document into JavaScript functions, and obtain the JavaScript file corresponding to the business document; Deployment module: used to deploy the JavaScript file through the Nginx server; Execution module: used to execute deployed business processes 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

  • Behavioral analysis detection and prevention of malicious script attacks using runtime script execution events

    CN114467282A

  • Management method, device and system for document application program loading items and medium

    CN114791825A

  • Method and device for realizing automatic DDOS (Distributed Denial of Service) security event handling based on DSL (Digital Subscriber Line) arrangement

    CN117349832A

Cited By

  • Multi-heterogeneous Web service series scheduling method based on Nginx custom module

    CN122437879A