CN117950628A - Plug-in building method and system based on GRPC - Google Patents

Plug-in building method and system based on GRPC Download PDF

Info

Publication number
CN117950628A
CN117950628A CN202311697734.5A CN202311697734A CN117950628A CN 117950628 A CN117950628 A CN 117950628A CN 202311697734 A CN202311697734 A CN 202311697734A CN 117950628 A CN117950628 A CN 117950628A
Authority
CN
China
Prior art keywords
plug
request
grpc
configuration
executor
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311697734.5A
Other languages
Chinese (zh)
Inventor
吴博诚
黄创光
张�杰
饶端
陈海权
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianyi Cloud Technology Co Ltd
Original Assignee
Tianyi Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianyi Cloud Technology Co Ltd filed Critical Tianyi Cloud Technology Co Ltd
Priority to CN202311697734.5A priority Critical patent/CN117950628A/en
Publication of CN117950628A publication Critical patent/CN117950628A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The invention belongs to the technical field of computers, and particularly relates to a plug-in building method and system based on GRPC (generic routing protection), which are used for improving communication performance based on GRPC technology, improving concurrency performance based on a thread scheduling model of cooperative programming, improving response speed based on parallelization synchronization technology, providing diversified coding and decoding mechanisms and improving safety and flexibility of transmission contents. Based on the protocol organization unit mode, a combined innovation plugin is constructed, and the expansibility and displaceability of the plugin are enriched. The method has the advantages that a light and flexible multi-task model which is scheduled by user states is realized through the cooperative process, the cooperative process is combined with IO multiplexing to realize a high concurrency solution, tcp connection is reduced, communication is carried out through GRPC, communication performance and network bandwidth occupation are optimized, binary message transmission is supported, lighter-weight transmission can be supported, and transmission performance is improved.

Description

Plug-in building method and system based on GRPC
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a GRPC-based plug-in building method and system.
Background
Most of the communication mechanisms of the existing plug-in system are based on the http1.1 protocol. The transmission efficiency is low, the traditional request response model is used, and request header compression, bidirectional stream mode and multiplexing are not supported. Under the circumstance of large concurrency, TCP connection is frequently established and destroyed, the load pressure of a server is large, the request head and the transmission content occupy network bandwidth resources seriously, network blockage is easy to cause, and normal use is influenced.
The content transmission format is single, and is basically in JSON or other similar text format messages, lighter weight transmission formats such as binary system and the like are not supported, the transmission efficiency is low, and the message security is low. The plug-in is embedded into the host application program, the operation isolation mechanism cannot be completely separated, and the observability, testability and maintainability of the plug-in are low. The plug-in function is not decomposable, the basic function is repeatedly developed, and the reusability of the component is low.
Disclosure of Invention
The invention aims to provide a GRPC-based plug-in building method and system, which are fast adapted to a cloud primary environment and have high concurrency of Internet application so as to solve the problems in the prior art in the background technology.
In order to achieve the above purpose, the invention adopts the following technical scheme: a GRPC-based plug-in construction method comprises the following steps: defining a new plug-in through a configuration and management platform, and setting basic information of the plug-in; associating the plug-in with the codec, and transmitting and processing a request response of the corresponding plug-in; constructing an executor version mirror image by configuring a source code management path; after the plug-in configuration is completed, the plug-in is issued; the external system requests plug-in service through a plug-in gateway, the plug-in gateway performs authority verification, request protocol verification and flow control, and the request is processed through a routing rule; generating a global request ID for each request by a request controller, and pressing the request into a request cooperative pool, wherein the request cooperative pool encodes the request content and invokes plug-in executor service in a GRPC (generic routing table) mode; matching is carried out through a plug-in version manager according to the available versions of the plug-ins, and if the versions do not exist or are offline, a rollback mechanism is started, and the latest version is used for processing; the plug-in executor is deployed in a containerized mode, and the plug-in performs calling and function testing through the configuration and management platform through GRPC load balancing.
Preferably, the plug-in includes a computation logic unit, an access control unit, and an aggregator unit; the computing logic unit is used for abstracting the service model capability and restricting the boundary range to provide a reusable logic basic unit service; the access control unit is used for defining an API interface, access control authorization and mapping management; the aggregator unit is used for assembling various computing logic unit capabilities, and carrying out data processing, protocol conversion and capability secondary packaging according to actual service requirements.
Preferably, the basic information of the plugin includes: plug-in type, label, plug-in name, plug-in identification, namespace, routing rules, and codec.
Preferably, the plug-in executor manages in a mirror image mode, and a mirror image construction mode is customized; the plug-in executor configures an elastic expansion strategy; the plug-in executor base supports JSON format requests.
Preferably, the managing the path by configuring the source code includes: and carrying out resource isolation on the plug-in by using a name space, and standardizing the plug-in by adopting a protocol version registration mode.
Preferably, the basic information of the setting plugin includes a configuration plugin; the configuration plug-in comprises basic information of the plug-in, a persistence strategy of plug-in data, configuration of a plug-in executor, environment configuration of the plug-in and a load balancing scheduling strategy.
Preferably, the persistence policy of the plug-in data includes: if the plug-in does not need to store information, configuration is not needed; if the plug-in has persistent service data, the plug-in is connected with a configuration database.
Preferably, the transmission process includes: the codec acquires the user-defined encoder to perform the codec processing of the content, and the content is transmitted through the GRPC after the processing is completed.
Preferably, the request includes a timeout control mechanism; the timeout control mechanism includes: the timeout time can be configured separately for the plug-in, outputting a unified error response hint if the plug-in has not responded to the timeout.
In another aspect, the present invention provides a GRPC-based plug-in building system, including:
The plug-in definition module is used for defining a new plug-in through the configuration and management platform and setting basic information of the plug-in;
the plug-in association module is used for associating the plug-ins with the codec and transmitting and processing the request response of the corresponding plug-ins;
The plug-in configuration module is used for constructing an executor version mirror image by configuring a source code management path;
the plug-in issuing module is used for issuing the plug-in after the plug-in configuration is completed;
The plug-in request module is used for requesting plug-in service by an external system through a plug-in gateway, wherein the plug-in gateway performs authority verification, request protocol verification and flow control, and processes the request through a routing rule;
The plug-in scheduling module is used for generating a global request ID for each request by the request controller, pressing the request into a request cooperative pool, and the request cooperative pool encodes the request content and invokes plug-in executor service in a GRPC mode;
The plug-in changing module is used for matching according to the available versions of the plug-ins through the plug-in version manager, and if the versions do not exist or are offline, a rollback mechanism is started, and the latest version is used for processing;
And the plug-in application module is used for being deployed in a containerized mode through a plug-in executor, and calling and function testing are carried out through the configuration and management platform through GRPC load balancing.
The invention has the technical effects and advantages that: compared with the prior art, the GRPC-based plug-in building method and system provided by the invention have the following advantages:
the invention realizes plug-in registration system and configurable processing, generates plug-in execution program by combining with configuration of service requirement, realizes light and flexible multi-task model by scheduling by user state by cooperative program, realizes high concurrency solution by cooperative program combining with IO multiplexing, reduces tcp connection, reduces pressure of a server and a client to memory, cpu and the like, can simultaneously execute multiple requests on one connection, has serious time consumption of a certain request task, does not influence normal execution of other connections, communicates by GRPC, optimizes communication performance and network bandwidth occupation, supports binary message transmission, can support lighter-weight transmission, and improves transmission performance.
Drawings
FIG. 1 is a block diagram of a plug-in system of the present invention;
FIG. 2 is a topology diagram of a coroutine implementation of the present invention;
FIG. 3 is a block diagram of an alternative mechanism for plug-in package elements of the present invention;
FIG. 4 is a schematic diagram of a plug-in registration mechanism of the present invention;
FIG. 5 is a flow chart of a plug-in processing of the present invention;
FIG. 6 is a topology diagram of GRPC load balancing of the present invention;
FIG. 7 is a flow chart of a GRPC-based plug-in construction method of the present invention;
FIG. 8 is a block diagram of a GRPC-based plug-in building system of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. The specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the embodiment of the invention, in order to quickly adapt to the cloud primary environment and realize high concurrency of Internet application, the invention provides a plug-in building method based on GRPC, which improves communication performance based on GRPC technology, improves concurrency performance based on a thread scheduling model of cooperative program, improves response speed based on parallelization synchronization technology, provides diversified coding and decoding mechanisms, and improves safety and flexibility of transmission content. Based on the protocol organization unit mode, a combined innovation plugin is constructed, and the expansibility and displaceability of the plugin are enriched, and the method is concretely as follows.
As shown in fig. 7, the method for constructing a plug-in based on GRPC in this embodiment includes the following steps:
The new plugin is defined through the configuration and management platform, and basic information of the plugin is set.
Specifically, the plug-in comprises a calculation logic unit, an access control unit and an aggregator unit; the computing logic unit is used for abstracting the service model capability and restricting the boundary range to provide a reusable logic basic unit service; the access control unit is used for defining an API interface, access control authorization and mapping management; the aggregator unit is used for assembling various computing logic unit capabilities, and carrying out data processing, protocol conversion and capability secondary packaging according to actual service requirements.
In addition, the basic information of the plug-in includes: plug-in type, label, plug-in name, plug-in identification, namespace, routing rules, and codec.
Further, the basic information of the setting plug-in includes configuration plug-in; the configuration plug-in comprises basic information of the plug-in, a persistence strategy of plug-in data, configuration of a plug-in executor, environment configuration of the plug-in and a load balancing scheduling strategy.
Associating the plug-in with the codec, and transmitting and processing a request response of the corresponding plug-in;
specifically, the transmission process includes: the codec acquires the user-defined encoder to perform the codec processing of the content, and the content is transmitted through the GRPC after the processing is completed.
Constructing an executor version mirror image by configuring a source code management path;
specifically, the managing the path by configuring the source code includes: and carrying out resource isolation on the plug-in by using a name space, and standardizing the plug-in by adopting a protocol version registration mode.
After the plug-in configuration is completed, the plug-in is issued;
The external system requests plug-in service through a plug-in gateway, the plug-in gateway performs authority verification, request protocol verification and flow control, and the request is processed through a routing rule; the persistence policy of the plug-in data comprises: if the plug-in does not need to store information, configuration is not needed; if the plug-in has persistent service data, the plug-in is connected with a configuration database.
Generating a global request ID for each request by a request controller, and pressing the request into a request cooperative pool, wherein the request cooperative pool encodes the request content and invokes plug-in executor service in a GRPC (generic routing table) mode;
specifically, the plug-in executor manages in a mirror image mode, and a mirror image construction mode is customized; the plug-in executor configures an elastic expansion strategy; the plug-in executor base supports JSON format requests.
Matching is carried out through a plug-in version manager according to the available versions of the plug-ins, and if the versions do not exist or are offline, a rollback mechanism is started, and the latest version is used for processing;
The request specifically comprises a timeout control mechanism; the timeout control mechanism includes: the timeout time can be configured separately for the plug-in, outputting a unified error response hint if the plug-in has not responded to the timeout.
The plug-in executor is deployed in a containerized mode, and the plug-in performs calling and function testing through the configuration and management platform through GRPC load balancing.
The invention realizes plug-in registration system and configurable processing, generates plug-in execution program by combining with configuration of service requirement, realizes light and flexible multi-task model by scheduling by user state by cooperative program, realizes high concurrency solution by cooperative program combining with IO multiplexing, reduces tcp connection, reduces pressure of a server and a client to memory, cpu and the like, can simultaneously execute multiple requests on one connection, has serious time consumption of a certain request task, does not influence normal execution of other connections, communicates by GRPC, optimizes communication performance and network bandwidth occupation, supports binary message transmission, can support lighter-weight transmission, and improves transmission performance.
In another aspect, the present invention proposes a GRPC-based plug-in building system, as shown in fig. 8, including: the system comprises a plug-in definition module, a plug-in association module, a plug-in configuration module, a plug-in publishing module, a plug-in request module, a plug-in scheduling module, a plug-in changing module and a plug-in application module.
Illustratively, the plug-in definition module is used for defining a new plug-in through the configuration and management platform and setting basic information of the plug-in;
Illustratively, the plug-in association module is used for associating the plug-ins with the codec, and the request response of the corresponding plug-ins is transmitted;
illustratively, the plug-in configuration module is configured to construct an executor version image by configuring a source code management path;
Illustratively, the plug-in publishing module is used for publishing the plug-in after the plug-in configuration is completed;
The plug-in request module is used for requesting plug-in service by an external system through a plug-in gateway, wherein the plug-in gateway performs authority verification, request protocol verification and flow control, and processes the request through a routing rule;
Illustratively, the plug-in scheduling module is used for generating a global request ID for each request by the request controller, and pushing the request into a request coroutine, wherein the request coroutine encodes the request content and invokes plug-in executor service in a GRPC (generic routing table) mode;
illustratively, the plug-in change module is used for matching by the plug-in version manager according to the available versions of the plug-ins, and if the versions do not exist or are offline, starting a rollback mechanism and using the latest version processing;
Illustratively, the plug-in application module is configured to be deployed in a containerized manner by a plug-in executor, and through GRPC load balancing, the plug-in performs call and functional test by the configuration and management platform.
In addition, the plug-in definition module, the plug-in association module, the plug-in configuration module, the plug-in issuing module, the plug-in request module, the plug-in scheduling module, the plug-in changing module and the plug-in application module provided by the invention can execute other functions of the plug-in construction method based on GRPC. Specifically, the following is described.
Specifically, a plug-in can abstract into several phases from definition to application: a plug-in definition phase, a plug-in development phase, a plug-in registration configuration phase, a plug-in loading phase, a plug-in application phase and a plug-in changing phase.
Illustratively, the plugin steps are as follows: 1. making a standard specification and a basic assembly of the plug-in unit; 2. developing new function plug-ins according to specifications and basic components; 3. customizing development plug-in units or public services; 4. releasing a plug-in version package; 5. registering plug-ins and configuring plug-in information; 6. the plug-in is published as a service to the container environment.
In the plug-in definition phase, plug-in packages and protocol definition specification plug-ins, thereby providing support for the displacable of subsequent plug-ins.
The plug-in is divided into three types of units, namely a calculation logic unit, an access control unit and an aggregator unit.
The computing logic unit is mainly used for abstracting the service model capability and restricting the boundary range and provides a reusable logic basic unit service.
The access control unit mainly defines an API interface, access control authority and mapping management.
The aggregator unit is mainly used for assembling the capabilities of various computing logic units, carrying out data processing, protocol conversion, capability secondary packaging and the like according to the actual requirements of the service, and expanding the adaptability of the service.
In the plug-in development stage, a standardized plug-in component library and a template example are provided, and the development workload of the plug-in is reduced based on secondary development of the component library.
The plug-in can be independently operated and accessed based on service mode development, and the testability is improved by calling through the GRPC. Public basic services can be developed and released into a service pool for common use by plug-ins in the business. The method can develop a calculation logic unit and an aggregator unit, and release the calculation logic unit and the aggregator unit into a unit pool for unit selection and replacement during plug-in configuration, and can meet plug-in compatibility.
In the plug-in registration configuration stage, the plug-in is subjected to resource isolation by using a name space, and is normalized in a protocol version registration mode, so that the compatibility detection capability of the plug-in protocol is provided, and the incompatible plug-in protocol cannot be replaced.
In the plug-in loading phase, no loading is required compared to the rest of the plug-in system. Because the plug-ins are running in a serviced mode, independent of the host application, there is no direct correlation.
In the plug-in application stage, the plug-in can access the externally exposed API, support the coexistence of multiple versions, balance the load among the versions and dynamically expand and reduce the capacity. And a pre-defined Protobuf protocol and a JSON protocol are adopted to carry out data transmission encoding and decoding, and custom encoding and decoding are supported, so that the expandability of data communication is supported, and the transmission safety is improved.
In the plug-in changing stage, the plug-in can be subjected to version iteration and also can be replaced by a plug-in compatible plug-in, and the plug-in can be selected from the unit pool for replacement, so that a new effect of module-to-module replacement is achieved rapidly. The compatibility of the plug-in is checked before the plug-in unit is replaced.
By the method, the configurability is met, customization is supported, the original defects are overcome, and a high concurrency implementation mechanism of the application is expanded.
The GRPC communication framework is a high-performance, open-source and general RPC framework, and is oriented to mobile and HTTP/2 design, and brings characteristics such as bidirectional flow, flow control, header compression, multiple multiplexing requests on a single TCP connection and the like. These characteristics make it better performing on mobile devices, more power efficient and space efficient. The GRPC reduces tcp connection and reduces the pressure of the server and the client on memories, cpus and the like. The connection of tcp is reduced, the tcp is not frequently triggered to be re-established, and the network congestion condition is improved. http/1.1 transmission is text used and http2.0 is binary framing transmission.
Processing concurrent requests for the co Cheng Xiancheng model: the coroutine is a user state thread execution body, the execution bodies created by the threads in the user state are called coroutines, each assigned an execution inlet, the application memory is used as an execution stack, and the threads schedule the execution bodies according to needs. The operating system user stack is unaware because switching to kernel mode for scheduling is not required.
User state scheduling mechanism: and the cooperative scheduling manager is responsible for switching the execution bodies, and the threads need to record the control information of the execution bodies. Including ID, stack location, execution entry address, execution site, etc.
The thread may select an execution volume to execute, where the instruction pointer in the CPU points to the entry for this execution volume, and the stack base and stack pointer registers point to the execution stack to which the thread is assigned.
Executing body switching: when switching execution bodies, the execution site of the current execution body needs to be saved first, and then the execution body is switched to another execution body. In the same way, the previous execution body can be restored, so that the execution can be continued from the place of last interruption.
Establishing a coroutine pool for multiplexing and concurrency control: the number of coroutine pools may be specified. The number of workers may be set to be the maximum concurrent number and the number of CPUs are equivalent. Task generalization. And providing a task interface, supporting multiple types of tasks, and submitting the task interface to a coroutine queue for a worker to call as long as the task interface is realized under different service scenes. A fixed coroutine (worker) is started to acquire tasks from the task queue for execution.
Synchronous request-to-concurrent request: and each request monitors a channel by utilizing the characteristics of the coroutine by generating a globally unique request ID, waits for a response result, thereby converting the synchronous request into a concurrent request and improving the program throughput. Define a global map, key is the unique ID of the request, and value is defined as the channel that needs to return the type. After the request returns, the ID of the request and the returned value are plugged into the defined map, and the read key circulated in the place of the request is taken as the channel of the request ID, the corresponding timeout time is set, and the processing ends to remove the key in the corresponding map, so that the circulation processing is prevented.
Version scheduler scheduling criteria and version control: and the plug-in version controller presses the plug-in version information into a version execution queue version execution manager subscription message by the dispatcher, checks whether the corresponding version exists, and does not process if the corresponding version exists. And if the configuration strategy does not exist, performing plug-in version creation action, and executing deployment according to the node configuration strategy.
Plug-in load balancing and node capacity expansion: and (5) intelligently regulating the scale according to the load of the plug-in package, and carrying out elastic contraction and expansion. The capacity expansion index comprises separation of management responsibilities based on CPU and program loads, request rate network loads and configuration resources, and separation of package storage, scheduling and execution.
Transmission codec expansion and development mode: using predefined function mirroring, the codec defaults to support both protobuf and JSON. And the custom mirror image is used for custom coding and decoding analysis processing, so that special data transmission requirements of users are met.
Data compression can reduce the volume of data in network transmission and reduce data storage space. Thereby improving the data transmission efficiency and accelerating the response speed of the system. The supported data compression algorithm is: gzip, zlib, deflater, lz4, using by default the Gzip algorithm.
Data compression requires matching use of client and server algorithms, and is divided into two types: the client compresses data and the data server decompresses the data; the server side decompresses the Response compression client side
The data security and the data security transmission channel are constructed, so that the data security and the integrity between two communication application programs are ensured, and the method plays a very important role. Different algorithms are supported for encrypted transmission of the data channel, such as TLS, ALTS, MTLS.
The codec is mainly loaded in the definable container environment, processes the request response, communicates between modules through the GRPC, returns the result and proceeds to the next step. And the interface configuration is supported, so that encryption and decryption can be tested and checked, and development complexity is reduced. And supporting the configuration of the custom mirror image through an interface, analyzing the encoding and decoding by a mirror image provider, and executing specified service logic.
Cross-language support: the plug-in is called based on GRPC, and the plug-in developed based on GRPC specification can be accessed into the system without being limited by language.
Plug-in protocol versioning: the validity of the call between the plug-ins is ensured by the plug-in to external access protocol, the protocol version number and the protocol compatibility detection. The previous plug-in is invalidated by increasing the version number, and the plug-in can be applied to the latest version by increasing the version number when the interface signature changes, protocol version changes, etc. When the protocol versions are not compatible, the user is prompted by an error message.
The plug-in checks the compatibility in two ways, namely, the plug-in checks the compatibility of the request entry by filling unnecessary constraints through the request parameter schema. One is returned by the example data schema for checking response result compatibility.
Frequent creation of threads in high concurrency applications causes unnecessary overhead, most of which are used in combination with thread pool mode, and excessive number of threads means that the operating system can continuously switch threads, and frequent context switch becomes a performance bottleneck. The scheduling mechanism is provided at present, scheduling can be realized in the threads, and context switching is lighter, so that the effects of less threads and not less concurrent numbers are achieved, and the cost brought by thread creation and destruction can be effectively reduced. The concurrency number can be controlled through the cooperative pool, the states of the workers and pool are perceived, and the number of the workers can be dynamically amplified or reduced according to the load.
Communication is carried out through the GRPC, communication performance and network bandwidth occupation are optimized, binary message transmission is supported, lighter-weight transmission can be supported, and transmission performance is improved. Multiplexing is supported, tcp connection is reduced, and the pressure of a server and a client to memories, cpus and the like is reduced. Multiple requests may be performed simultaneously in parallel on one connection. Certain request tasks are time-consuming and do not affect the normal execution of other connections.
The self-defined encoding and decoding are supported, and the transmission safety capability is improved: in the encoding process, the encoder is mainly acquired by calling, so that different encoding and decoding requirements are supported. The requirements of different industries on data transmission are met by supporting custom encoding and decoding. By supporting SSL transmission, transmission security is satisfied. By supporting data compression, the consumption of network bandwidth is reduced.
The plug-in unit supports replaceable and compatibility detection: the plug-in mainly comprises three parts, namely an access control unit, a calculation logic unit and an aggregator unit. The access control unit and the calculation logic unit can be developed into basic units and put into an aggregator unit pool and a calculation logic unit pool. When the plug-in is configured, a complete plug-in can be selected to construct a mirror image, and compatible units can be selected from a unit pool to form a new plug-in. The compatibility judgment of the plug-in is mainly carried out through input and output schema, and the condition is met when the protocol is consistent or downward compatible. The plug-in version can be quickly updated by replacing the unit.
The plug-in operates in a server-like manner independent of the host program: most plug-in systems, for example java, need to be loaded into the host program through classloader to be able to run. The plug-in runs in a service mode, does not depend on a host program, can test more conveniently, and reduces dependence.
The architecture of the plug-in system based on GRPC is shown in fig. 1, the whole plug-in registration process is shown in fig. 4, and the plug-in process flow is layered as shown in fig. 5.
The new plugin is defined through the configuration and management platform, and basic information of the plugin is set, including plugin types, labels, plugin names, plugin identifications, namespaces, routing rules and the like.
The plug-in needs an associated codec and the corresponding plug-in's request response transmission process. Plug-in executors are versioned and deployed in a containerized manner.
By configuring the source code management path, an executor version image is constructed.
After the plug-in configuration is completed, the plug-in needs to be issued, and the new configuration of the plug-in takes effect.
When an external system requests a plug-in service, the external system needs to pass through the plug-in gateway preferentially. The plug-in gateway has authority verification, request protocol verification and flow control, and processes the request through the routing rule.
Entering the plug-in request dispatch distribution phase, the request controller generates a global request ID for each request and pushes the request into the request coroutine. The request coroutine worker encodes the request content and invokes the plug-in executor service in the manner of GRPC. The request has a timeout control mechanism, the timeout time can be configured independently for the plug-in, and if the plug-in has not responded due to timeout, a unified error response prompt is output.
The plug-in version manager performs matching according to available versions of the plug-ins, and if the versions do not exist or are offline, a rollback mechanism is provided to use the latest version for processing.
The plug-in executor is deployed in a containerized mode, and the equalization of the request is ensured through GRPC load equalization. The plug-in can directly perform calling and function testing through the configuration platform.
The upgrading of the plug-in has two modes, one is the original mirror mode, and the mirror is reconstructed by modifying the source code. One is a plug-in built in a unit assembly mode, which can be upgraded by selecting different units from a unit pool to perform plug-in unit replacement, and maintain compatibility checking.
And the internal units of the plug-ins are deployed together in sidecar mode, so that the relevance of the whole plug-ins is maintained.
Specifically, the plug-in registration configuration is shown in fig. 4.
The plug-in can be operated through the configuration and management platform, including plug-in viewing, plug-in new building, plug-in modification, plug-in disabling, plug-in management in a namespace, and the like.
The plug-in is configured, and the plug-in mainly comprises basic information for setting the plug-in, a persistence strategy of plug-in data, configuration of a plug-in executor, environment configuration of the plug-in and a load balancing scheduling strategy.
Basic information of the plugin, including plugin and tag, plugin name, plugin identification, namespace, codec, etc.
The persistence policy of the plug-in data, if the plug-in does not need to store information, no configuration is needed. The plug-in has persistent service data, needs to configure database connection, MQ configuration information of related events, and the like.
The plug-in executor is mainly managed in a mirror image mode, and the executor needs to be configured with an elastic telescopic strategy in a self-defined mirror image construction mode, so that automatic capacity expansion and reduction of the nodes are supported. The executor base component supports JSON format request by default, and is convenient for function test.
The configuration of the plug-in internal units can be constructed by selecting the source codes, and can also be combined by selecting the unit pools.
Plug-in request manager and request coroutine pool configuration:
The plug-in request manager is mainly responsible for distributing plug-in requests, generating global request IDs, timeout control processing and content encoding and decoding.
The request distribution is realized by adopting a cooperative thread pooling technology, and the maximum concurrent cooperative thread number is required to be configured in a thread pool-like manner. The execution worker can be freely specified, and is decided according to the concurrency of the service and the system configuration. And monitoring the channel of the response result through the global unique ID to obtain the response result. And when the GRPC request is initiated, adding a timeout Timer control, and if the response time exceeds the request response time preset by the plugin, responding to the request to be invalidated, and returning a timeout response prompt.
The encoding and decoding of the transmission content are carried out by acquiring a user-defined encoder, encoding and decoding processing of the content is carried out, and the processing is carried out by GRPC. SSL transmission can be configured, so that the transmission safety is enhanced. For the situations of high concurrency and limited network bandwidth, a compressor of the GRPC can be opened to compress, for example, the Gzip is higher in compression rate of text content.
And the plug-in version manager matches the available plug-in version according to the requested plug-in version, and if the matching fails, the plug-in version manager processes according to a rollback policy and defaults to rollback to the latest plug-in version.
Plug-in executor version matching and GRPC load balancing policy configuration:
in the dispatcher, the plug-in requests need to bind the executor version of the plug-in, and in this way, erroneous consumption can be avoided.
In order to solve the independence of consumption and matching of the plugins, the plugin executor needs to specify a label, a version number and a plugin identifier, and requests to corresponding services through a container service discovery mechanism.
The GRPC load balancing strategy implementation mechanism aims at solving the problem of GRPC connection viscosity, and requests the same service each time. As shown in fig. 6, the client accesses the server through HEADLESS SERVICE of Kubernetes. The GRPC acquires a plurality of addresses of Service and establishes a sub-channel with the addresses. By default, a subsequent request will be sent to one of the sub-channels.
Plug-in executor expansion and development mode:
Most of plug-in executors are functions for executing service customization, and some basic functions in most of systems can form standard components for multiplexing.
A publicly available service, defined as a customer standard service unit, is exposed, allowing the remaining plug-ins to be used.
The cloud native environment is also provided with public services, also allowing plug-ins to make calls.
The plug-in realizes the combination, application, conversion and secondary data processing of public service and business service by means of an aggregator, thereby realizing the support of more complex business.
Two common bottom layer components are provided, namely a common service component which is used for developing common services and publishing the common services. The plug-in service component is used for developing plug-in executors, provides ready code examples, avoids the process from 0 to 1 and focuses on the realization of business logic.
The plug-in executor can perform construction and function test in plug-in configuration, and the plug-in executor is released into a specific version executor after the test is completed.
In addition, the embodiment of the invention also provides a terminal device, and the GRPC-based plug-in construction method related in the embodiment is mainly applied to the terminal device, and the terminal device can be a PC, a portable computer, a mobile terminal and other devices with display and processing functions.
In particular, the terminal device may include a processor (e.g., CPU), a communication bus, a user interface, a network interface, and a memory. Wherein the communication bus is used for realizing connection communication among the components; the user interface may include a Display screen (Display), an input unit such as a Keyboard (Keyboard); the network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface); the memory may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory, or alternatively may be a storage device independent of the aforementioned processor.
The processor can call the scheduling program stored in the memory and execute the GRPC-based plug-in construction method provided by the embodiment of the invention.
It will be appreciated that the readable storage medium may be a tangible device that can hold and store instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: portable computer disks, hard disks, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static Random Access Memory (SRAM), portable compact disk read-only memory (CD-ROM), digital Versatile Disks (DVD), memory sticks, floppy disks, mechanical coding devices, punch cards or in-groove structures such as punch cards or grooves having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media, as used herein, are not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., optical pulses through fiber optic cables), or electrical signals transmitted through wires.
The computer readable program instructions described herein may be downloaded from a computer readable storage medium to a respective computing/processing device or to an external computer or external storage device over a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmissions, wireless transmissions, routers, firewalls, switches, gateway computers and/or edge servers. The network interface card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium in the respective computing/processing device.
The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as SMALLTALK, C ++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions may be executed entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, aspects of the present disclosure are implemented by personalizing electronic circuitry, such as programmable logic circuitry, field Programmable Gate Arrays (FPGAs), or Programmable Logic Arrays (PLAs), with state information of computer readable program instructions, which can execute the computer readable program instructions.
Finally, it should be noted that: the foregoing description is only illustrative of the preferred embodiments of the present invention, and although the present invention has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that modifications may be made to the embodiments described, or equivalents may be substituted for elements thereof, and any modifications, equivalents, improvements or changes may be made without departing from the spirit and principles of the present invention.

Claims (10)

1. A method for constructing a GRPC-based plug-in, comprising:
Defining a new plug-in through a configuration and management platform, and setting basic information of the plug-in;
Associating the plug-in with the codec, and transmitting and processing a request response of the corresponding plug-in;
constructing an executor version mirror image by configuring a source code management path;
After the plug-in configuration is completed, the plug-in is issued;
The external system requests plug-in service through a plug-in gateway, the plug-in gateway performs authority verification, request protocol verification and flow control, and the request is processed through a routing rule;
Generating a global request ID for each request by a request controller, and pressing the request into a request cooperative pool, wherein the request cooperative pool encodes the request content and invokes plug-in executor service in a GRPC (generic routing table) mode;
Matching is carried out through a plug-in version manager according to the available versions of the plug-ins, and if the versions do not exist or are offline, a rollback mechanism is started, and the latest version is used for processing;
The plug-in executor is deployed in a containerized mode, and the plug-in performs calling and function testing through the configuration and management platform through GRPC load balancing.
2. The method for constructing a GRPC-based plug-in of claim 1, wherein the plug-in includes a computation logic unit, an access control unit, and an aggregator unit;
The computing logic unit is used for abstracting the service model capability and restricting the boundary range to provide a reusable logic basic unit service;
the access control unit is used for defining an API interface, access control authorization and mapping management;
the aggregator unit is used for assembling various computing logic unit capabilities, and carrying out data processing, protocol conversion and capability secondary packaging according to actual service requirements.
3. The method for constructing a plug-in based on GRPC according to claim 1, wherein the basic information of the plug-in includes: plug-in type, label, plug-in name, plug-in identification, namespace, routing rules, and codec.
4. The method for constructing a plug-in based on a GRPC of claim 1, wherein the plug-in executor manages in a mirror image manner by a custom mirror image construction manner; the plug-in executor configures an elastic expansion strategy; the plug-in executor base supports JSON format requests.
5. A method of building a GRPC based plug-in as claimed in claim 3, wherein said managing paths by configuring source code includes: and carrying out resource isolation on the plug-in by using a name space, and standardizing the plug-in by adopting a protocol version registration mode.
6. The method for constructing a GRPC-based plug-in according to claim 1, wherein the setting basic information of the plug-in includes configuring the plug-in; the configuration plug-in comprises basic information of the plug-in, a persistence strategy of plug-in data, configuration of a plug-in executor, environment configuration of the plug-in and a load balancing scheduling strategy.
7. The method for constructing a plug-in based on GRPC of claim 6, wherein the persistence policy of the plug-in data includes: if the plug-in does not need to store information, configuration is not needed; if the plug-in has persistent service data, the plug-in is connected with a configuration database.
8. The GRPC-based plug-in building method of claim 1, wherein the transmission process includes: the codec acquires the user-defined encoder to perform the codec processing of the content, and the content is transmitted through the GRPC after the processing is completed.
9. A method of GRPC-based plug-in construction as claimed in claim 1, wherein the request includes a timeout control mechanism; the timeout control mechanism includes: the timeout time can be configured separately for the plug-in, outputting a unified error response hint if the plug-in has not responded to the timeout.
10. A GRPC-based plug-in building system, comprising:
The plug-in definition module is used for defining a new plug-in through the configuration and management platform and setting basic information of the plug-in;
the plug-in association module is used for associating the plug-ins with the codec and transmitting and processing the request response of the corresponding plug-ins;
The plug-in configuration module is used for constructing an executor version mirror image by configuring a source code management path;
the plug-in issuing module is used for issuing the plug-in after the plug-in configuration is completed;
The plug-in request module is used for requesting plug-in service by an external system through a plug-in gateway, wherein the plug-in gateway performs authority verification, request protocol verification and flow control, and processes the request through a routing rule;
The plug-in scheduling module is used for generating a global request ID for each request by the request controller, pressing the request into a request cooperative pool, and the request cooperative pool encodes the request content and invokes plug-in executor service in a GRPC mode;
The plug-in changing module is used for matching according to the available versions of the plug-ins through the plug-in version manager, and if the versions do not exist or are offline, a rollback mechanism is started, and the latest version is used for processing;
And the plug-in application module is used for being deployed in a containerized mode through a plug-in executor, and calling and function testing are carried out through the configuration and management platform through GRPC load balancing.
CN202311697734.5A 2023-12-12 2023-12-12 Plug-in building method and system based on GRPC Pending CN117950628A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311697734.5A CN117950628A (en) 2023-12-12 2023-12-12 Plug-in building method and system based on GRPC

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311697734.5A CN117950628A (en) 2023-12-12 2023-12-12 Plug-in building method and system based on GRPC

Publications (1)

Publication Number Publication Date
CN117950628A true CN117950628A (en) 2024-04-30

Family

ID=90800697

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311697734.5A Pending CN117950628A (en) 2023-12-12 2023-12-12 Plug-in building method and system based on GRPC

Country Status (1)

Country Link
CN (1) CN117950628A (en)

Similar Documents

Publication Publication Date Title
JP7275171B2 (en) Operating System Customization in On-Demand Network Code Execution Systems
US11875173B2 (en) Execution of auxiliary functions in an on-demand network code execution system
EP3944082A1 (en) Extending the kubernetes api in-process
EP1300766A2 (en) Method and apparatus for partitioning resources within a computer system
US10833955B2 (en) Dynamic delivery of software functions
US20080222617A1 (en) Server side application integration framework
CN112104723A (en) Multi-cluster data processing system and method
US20200326931A1 (en) Federated Framework for Container Management
CN112394947A (en) Information system based on micro-service architecture
US20160294969A1 (en) Reusable message flow between applications of a message broker integrated systems environment
US12014216B2 (en) Method for platform-based scheduling of job flow
CN114938371A (en) Cloud edge cooperative data exchange service implementation method and system based on cloud originality
CN113407310A (en) Container management method, device, equipment and storage medium
US8612963B2 (en) Guided problem resolution in deploying an application
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
CN114489954A (en) Tenant creation method based on virtualization platform, tenant access method and equipment
CN114579250B (en) Method, device and storage medium for constructing virtual cluster
CN116670670A (en) Integrated authentication for container-based environments
US10255057B2 (en) Locale object management
CN113535254A (en) Micro-service processing method, micro-service deployment method and related device
CN117950628A (en) Plug-in building method and system based on GRPC
CN113472638B (en) Edge gateway control method, system, device, electronic equipment and storage medium
KR102685492B1 (en) 3rd Generation Partnership Project (3GPP) Framework for Live Uplink Streaming (FLUS) sync capability determination
CN115033290A (en) Instruction set-based micro-service splitting method and device and terminal equipment
CN112667441A (en) Service module scheduling method, system and storage medium based on fault-tolerant function

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination