A method and system for controlling system resources based on Web technology
By establishing communication connection and resource management modules between the proxy and the system in Web technology, the problem of large size and dependence of Node.js development tools is solved, and the development using any language in any Web terminal environment is realized, which improves development flexibility and efficiency .
Patent Information
- Application Number
- CN202011332092.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-24
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2040-11-24
AI Technical Summary
The tools developed by Node.js are large in size and cannot be run independently. They must rely on the corresponding runtime environment, which limits the development and use of Web management system resources.
By establishing a communication connection between the proxy and the system-side application services, defining the basic communication services and proxy interfaces, encapsulating them into a computer language used by the Web side, realizing the connection between the Web side and the system side and resource management, avoiding dependence on Node.js.
It realizes the development of any language in any terminal environment that supports the web, avoids packaging volume and dependency problems, and improves the flexibility and efficiency of development.
Smart Images

Figure CN112416621B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more specifically, to a method and system for managing and controlling system resources based on Web technology. Background Art
[0002] There are many advantages to using Web technology for development. On the one hand, thanks to the rapid development of the Web, the improvement of package managers and development tools, there are many ready-made libraries on the Internet that can meet various functional requirements. From the current technology stack, the technology that can use Web management system resources can only be developed using Node.js, but the technology stack provided by Node.js is too small and has many limitations. For example, the implementation of the application must be developed using Node.js, and other suitable development languages cannot be used. On the other hand, the tools developed using Node.js are relatively large in size and cannot run independently. They must rely on the corresponding runtime environment.
[0003] Therefore, there is an urgent need for a method and system for controlling system resources based on Web technology to solve this problem. Summary of the invention
[0004] The present invention provides a method and system for managing system resources based on Web technology, which are used to solve the problem that tools developed using Node.js are large in size, cannot run independently, and must rely on a corresponding runtime environment.
[0005] In a first aspect, an embodiment of the present invention provides a method for managing system resources based on Web technology, including:
[0006] Establish the communication connection between the agent and system application services, and the link between the Web and system agent application services;
[0007] After obtaining the system request, the system request is sent to the system-side proxy application service through the link for processing, so as to parse the parameter fields in the system request and return the result;
[0008] The returned results are rendered on the Web side to manage the resources of the system.
[0009] The establishment of a communication connection between the agent end and the system end application service and a link between the Web end and the system end agent application service includes:
[0010] Establish the communication foundation based on the predefined TCP ports for the Web-side and system-side service connections;
[0011] Based on the communication foundation, define the basic communication services of the system end;
[0012] Encapsulating the service interface of the basic communication service of the system end into the computer language used by the Web end to establish a connection between the Web end and the system end;
[0013] A proxy interface is defined, and the proxy interface is encapsulated into a computer language used by the Web end, so that the proxy application can be downloaded to a local cache path through the proxy interface.
[0014] Wherein, based on the communication foundation, the basic communication service of the system end is defined, including:
[0015] The Ping interface, AttachProxy interface and LaunchProxy interface are defined. The Ping interface is used to check the current status of the basic communication service, the AttachProxy interface is used to register the proxy program, and the LaunchProxy interface is used to start the registered proxy program in the basic communication service.
[0016] The step of defining a proxy interface and encapsulating the proxy interface into a computer language used by a Web client so as to download the proxy application to a local cache path through the proxy interface includes:
[0017] Define the proxy interface for registering applications;
[0018] Encapsulating the proxy interface into a computer language used by the Web end;
[0019] The TCP port is connected via the encapsulated basic communication service to download the proxy application to the local cache path.
[0020] Wherein, the method further comprises:
[0021] Define corresponding application programming interfaces according to different usage environments and requirements.
[0022] Wherein, after obtaining the system request, sending the system request through the link to the system-side proxy application service for processing, so as to parse the parameter fields in the system request and return the result, including:
[0023] Determining the system application to process the system request from the header information of the system request;
[0024] The system request is forwarded to a corresponding system application to parse the parameter fields in the system request and return the result.
[0025] In a second aspect, an embodiment of the present invention provides a system for managing and controlling system resources based on Web technology, including:
[0026] The link establishment module is used to establish the communication connection between the agent end and the system end application service and the link between the Web end and the system end agent application service;
[0027] A parameter parsing module, used for obtaining a system request and sending the system request to the system-side proxy application service through the link for processing, so as to parse the parameter fields in the system request and return the result;
[0028] The resource management module is used to render the returned results on the Web side to manage the resources of the system.
[0029] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of a method for managing system resources based on Web technology as provided in the first aspect above are implemented.
[0030] In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of a method for managing system resources based on Web technology as provided in the first aspect above are implemented.
[0031] The method and system for managing system resources based on Web technology provided by the embodiment of the present invention can be applied to any terminal environment that supports the Web, and can be developed in any language without being limited to using Node.js, while also avoiding the problems of packaging volume and dependency. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 A method for managing and controlling system resources based on Web technology is provided in an embodiment of the present invention;
[0034] Figure 2 is a system flow chart provided by an embodiment of the present invention;
[0035] Figure 3 This is a schematic diagram of a system structure for managing and controlling system resources based on Web technology provided by an embodiment of the present invention;
[0036] Figure 4 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0039] Figure 1 A method for managing and controlling system resources based on Web technology is provided in an embodiment of the present invention. Figure 1 As shown, including:
[0040] 101. Establish a communication connection between the agent end and the system end application service and a link between the Web end and the system end agent application service;
[0041] 102. After obtaining the system request, the system request is sent to the system-side proxy application service through the link for processing, so as to parse the parameter fields in the system request and return the result;
[0042] 103. Render the returned result on the Web side to manage the resources of the system.
[0043] Specifically, Figure 2 is a system flow chart provided by an embodiment of the present invention, such as Figure 2 As shown, taking the Web end initiating a request to obtain CPU usage as an example, in step 101, if the current proxy Proxy has not established a link with the system-side Proxy application service, it will connect to the bootstrap service through TCP port 7890, and start the corresponding proxy service, and then return the corresponding proxy service address to the Web end. The Web end establishes a link between the Web-side Proxy and the system-side Proxy application service based on the returned address information.
[0044] Furthermore, in step 102, the request for obtaining CPU usage is sent to the system-side Proxy application through the link established by the proxy for processing, and then the header information (Header) in the corresponding request is used to determine which system application is responsible for processing the current request. If not found, an attempt is made to search from the registered applications. If the application has been registered, the application is started. Otherwise, a prompt is given that there is no error in the application, and the request is forwarded to the corresponding application, the parameter fields in the request are parsed, and finally the result is returned.
[0045] Finally, in step 103, after obtaining the result returned by the CPU, the Web end renders the result and manages the system resources.
[0046] The method and system for managing system resources based on Web technology provided by the embodiment of the present invention can be applied to any terminal environment that supports the Web, and can be developed in any language without being limited to using Node.js, while also avoiding the problems of packaging volume and dependency.
[0047] Based on the above embodiment, in step 101, the establishment of a communication connection between the agent end and the system end application service and a link between the Web end and the system end agent application service includes:
[0048] 201, establish the communication basis based on the predefined TCP ports for the Web and system service connections;
[0049] 202, based on the communication basis, define basic communication services of the system end;
[0050] 203, encapsulating the service interface of the basic communication service of the system end into a computer language used by the Web end, so as to establish a connection between the Web end and the system end;
[0051] 204 , define a proxy interface, and encapsulate the proxy interface into a computer language used by the Web end, so as to download the proxy application to a local cache path through the proxy interface.
[0052] Specifically, the embodiment of the present invention defines the service connection TCP port 7890 between the Web end and the system end. TCP port 7890 is a fixed port. The Web end can use HTTP to connect to the service of the system end through port 7890 to establish a communication basis for subsequent requests. Then, gRPC is used to define the basic communication service bootstrap of the system end. The subsequent system applications are all based on the interface on bootstrap for operation and expansion. Secondly, the gRPC service interface of bootstrap is encapsulated into a language (JavaScript) that can be run on the Web end through grpc-web. Through the TCP port 7890 defined on the system end, the Web end can use HTTP to establish a connection with the bootstrap service on the system end. Finally, the interface of the proxy Proxy is defined, and the interface of the proxy Proxy is encapsulated into a language (JavaScript) that can be run on the Web end through grpc-web and combined with the previously encapsulated bootstrap service. Through the encapsulated bootstrap service connection port 7890, the communication between the Web end and the system end is established, and then the proxy Proxy application is downloaded to the local cache path and the program is started.
[0053] Based on the above embodiment, in step 202, based on the communication foundation, the basic communication service of the system side is defined, including:
[0054] The Ping interface, AttachProxy interface and LaunchProxy interface are defined. The Ping interface is used to check the current status of the basic communication service, the AttachProxy interface is used to register the proxy program, and the LaunchProxy interface is used to start the registered proxy program in the basic communication service.
[0055] Specifically, bootstrap contains 4 basic interfaces:
[0056] Ping interface, used to check the status of the current bootstrap service. Request parameters: empty, return parameters:
[0057] 1. Platform information, such as linux / amd64, linux / arm, windows / amd64, etc.
[0058] 2.version bootstrap version information, such as 0.0.1, etc.
[0059] AttachProxy interface, used to register the proxy program; request parameters:
[0060] 1.addr address, the path information where the Proxy application is located.
[0061] 2. Platform information, such as linux / amd64, linux / arm, windows / amd64, etc.
[0062] 3. Hash value is used to check whether the current Proxy program has been hijacked, modified or damaged.
[0063] Return parameter:
[0064] 1.addr address, the path information where the Proxy application is located.
[0065] 2. Platform information, such as linux / amd64, linux / arm, windows / amd64, etc.
[0066] 3. Hash value is used to check whether the current Proxy program has been hijacked, modified or damaged.
[0067] LaunchProxy interface is used to start the proxy program registered in boostrap service. Request parameters:
[0068] 1.addr, get the valid path of Proxy.
[0069] 2. The hash value is used to check whether the current Proxy program has been hijacked, modified or damaged. If the check fails, it will refuse to start.
[0070] 3. Sign the signature of the hash. If the verification fails, the application will be refused to start.
[0071] 4.args: the additional parameters for starting the application. Return parameters:
[0072] 1.addr address, the path information where the Proxy application is located.
[0073] 2. Platform information, such as linux / amd64, linux / arm, windows / amd64, etc.
[0074] 3. Hash value is used to check whether the current Proxy program has been hijacked, modified or damaged.
[0075] Based on the above embodiment, in step 204, a proxy interface is defined and encapsulated into a computer language used by the Web end, so as to download the proxy application to a local cache path through the proxy interface, including:
[0076] Define the proxy interface for registering applications;
[0077] Encapsulating the proxy interface into a computer language used by the Web end;
[0078] The TCP port is connected via the encapsulated basic communication service to download the proxy application to the local cache path.
[0079] Specifically, define the proxy interface, the interface is:
[0080] RegistryApp registers an app. The request parameters are:
[0081] 1.name is the unique ID of the application, which is used to distinguish different application services.
[0082] 2.path The path of the application, used to cache the application
[0083] 3.size The size of the application.
[0084] 4. The hash value calculated by the hash application.
[0085] 5.permissions The permissions requested by the application are used to handle different usage environments. For example, some applications need to use normal permissions to run, and some applications need to use administrator permissions to run. The return parameter is empty.
[0086] Then, through grpc-web, the proxy interface is encapsulated into a language (JavaScript) that can be run on the Web side and combined with the previously encapsulated bootstrap service. Through the encapsulated bootstrap service, connect to port 7890, establish communication between the Web side and the system side, then download the proxy application to the local cache path and start the program.
[0087] Based on the above embodiment, the method for managing and controlling system resources based on Web technology also includes:
[0088] Define corresponding application programming interfaces according to different usage environments and requirements.
[0089] Specifically, the App part defines different interfaces according to different usage environments and requirements. Here, obtaining the CPU usage of system resources through the Web end is taken as an example.
[0090] First, define the interface for obtaining CPU usage. The request parameter is empty and the return parameter is:
[0091] 1.time recorded time
[0092] 2.used is the percentage of CPU usage during the recording time
[0093] Then use a language that supports gRPC to implement the application service. For example, use golang to implement a gRPC service and compile it into an independent binary program file.
[0094] Finally, grpc-web is used to encapsulate the interface for obtaining system CPU resources into a language (JavaScript) that can be used by the Web side, and the previously encapsulated Proxy program is further integrated. The App will deploy the independent binary file to the system and run it through the Proxy. The App will then forward the request through the Proxy, and then determine which App service the request belongs to based on the header information in the request (similar to the HTTP Header), and forward the request to the corresponding App service for processing, and then return the result.
[0095] Based on the above embodiment, in step 102, after obtaining the system request, the system request is sent to the system-side proxy application service through the link for processing, so as to parse the parameter fields in the system request and return the result, including:
[0096] Determining the system application to process the system request from the header information of the system request;
[0097] The system request is forwarded to a corresponding system application to parse the parameter fields in the system request and return the result.
[0098] Specifically, taking the CPU request as an example, the request to obtain the CPU usage is sent to the system-side Proxy application through the link established by the proxy for processing, and then the header information (Header) in the corresponding request is used to determine which system application is responsible for processing the current request (if not found, an attempt is made to search from the registered applications. If the application has been registered, the application is started, otherwise a prompt will be displayed that there is no error in the application), the request is forwarded to the corresponding application, the parameter fields in the request are parsed, and finally the result is returned.
[0099] Figure 3 1 is a schematic diagram of a system structure of a Web-based system resource management and control system provided by an embodiment of the present invention. The system of the Web-based system resource management and control system provided by an embodiment of the present invention is used to execute the method of the Web-based system resource management and control system in the above method embodiment. Figure 3 As shown, it includes: a link establishment module 301, a parameter analysis module 302 and a resource management module 303, wherein:
[0100] The link establishment module 301 is used to establish a communication connection between the agent end and the system end application service and a link between the Web end and the system end agent application service;
[0101] The parameter parsing module 302 is used to obtain the system request and then send the system request to the system-side proxy application service through the link for processing, so as to parse the parameter fields in the system request and return the result;
[0102] The resource management module 303 is used to render the returned results on the Web side to manage the resources of the system.
[0103] For details on how to use the link establishment module 301, the parameter analysis module 302 and the resource management module 303 to implement the management and control of system resources based on Web technology, please refer to the above method embodiment, which will not be described in detail in the embodiment of the present invention.
[0104] In one embodiment, the present invention also provides an electronic device, such as Figure 4 As shown, Figure 4 The structural diagram of an electronic device is illustrated, and the electronic device may include: a processor 401, a communication interface 402, a memory 403 and a bus 404, wherein the processor 401, the communication interface 402 and the memory 403 communicate with each other through the bus 404. The processor 401 may call the logic instructions in the memory 403 to execute the following steps of the road network matching method between heterogeneous high-precision maps, for example, including: establishing a communication connection between the agent end and the system end application service and a link between the Web end and the system end agent application service; after obtaining the system request, sending the system request through the link to the system end agent application service for processing, so as to parse the parameter fields in the system request and return the result; rendering the returned result on the Web end to manage the resources of the system.
[0105] In one embodiment, this embodiment also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the steps of the road network matching method between heterogeneous high-precision maps provided by the above-mentioned method embodiments, for example, including: establishing a communication connection between the agent end and the system end application service and a link between the Web end and the system end agent application service; after obtaining the system request, sending the system request through the link to the system end agent application service for processing, so as to parse the parameter fields in the system request and return the result; rendering the returned result on the Web end to manage the resources of the system.
[0106] In one embodiment, based on the same concept, an embodiment of the present invention also provides a non-transitory computer-readable storage medium, which stores a computer program. When the computer program is executed by a computer, the computer executes the steps of the road network matching method between heterogeneous high-precision maps provided in the above embodiments, for example, including: establishing a communication connection between the agent end and the system end application service and a link between the Web end and the system end agent application service; after obtaining the system request, sending the system request through the link to the system end agent application service for processing, so as to parse the parameter fields in the system request and return the result; rendering the returned result on the Web end to manage the resources of the system.
[0107] The various embodiments of the present invention can be combined arbitrarily to achieve different technical effects.
[0108] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0109] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for managing and controlling system resources based on Web technology, characterized in that: include: Establish the communication connection between the agent and system application services, and the link between the Web and system agent application services; After obtaining the system request, the system request is sent to the system-side proxy application service through the link for processing, so as to parse the parameter fields in the system request and return the result; Rendering the returned results on the Web side to manage system resources; The establishment of the communication connection between the agent end and the system end application service and the link between the Web end and the system end agent application service includes: Establish the communication foundation based on the predefined TCP ports for the Web-side and system-side service connections; Based on the communication foundation, define the basic communication services of the system end; Encapsulating the service interface of the basic communication service of the system end into the computer language used by the Web end to establish a connection between the Web end and the system end; Defining a proxy interface and encapsulating the proxy interface into a computer language used by the Web end, so as to download the proxy application to a local cache path through the proxy interface; The step of defining a proxy interface and encapsulating the proxy interface into a computer language used by a Web client so as to download the proxy application to a local cache path through the proxy interface includes: Define the proxy interface for registering applications; Encapsulating the proxy interface into a computer language used by the Web end; The TCP port is connected via the encapsulated basic communication service to download the proxy application to the local cache path.
2. The method for managing and controlling system resources based on Web technology according to claim 1, characterized in that: Based on the communication foundation, the basic communication services of the system end are defined, including: The Ping interface, AttachProxy interface and LaunchProxy interface are defined. The Ping interface is used to check the current status of the basic communication service, the AttachProxy interface is used to register the proxy program, and the LaunchProxy interface is used to start the registered proxy program in the basic communication service.
3. The method for managing and controlling system resources based on Web technology according to claim 1, characterized in that: The method further comprises: Define corresponding application programming interfaces according to different usage environments and requirements.
4. The method for managing and controlling system resources based on Web technology according to claim 3 is characterized in that: After obtaining the system request, the system request is sent to the system-side proxy application service through the link for processing, so as to parse the parameter fields in the system request and return the result, including: Determining the system application to process the system request from the header information of the system request; The system request is forwarded to a corresponding system application to parse the parameter fields in the system request and return the result.
5. A system for managing and controlling system resources based on Web technology, characterized in that: include: The link establishment module is used to establish the communication connection between the agent end and the system end application service and the link between the Web end and the system end agent application service; A parameter parsing module, used for obtaining a system request and sending the system request to the system-side proxy application service through the link for processing, so as to parse the parameter fields in the system request and return the result; A resource management module is used to render the returned results on the Web side to manage the resources of the system; The establishment of the communication connection between the agent end and the system end application service and the link between the Web end and the system end agent application service includes: Establish the communication foundation based on the predefined TCP ports for the Web-side and system-side service connections; Based on the communication foundation, define the basic communication services of the system end; Encapsulating the service interface of the basic communication service of the system end into the computer language used by the Web end to establish a connection between the Web end and the system end; Defining a proxy interface and encapsulating the proxy interface into a computer language used by the Web end, so as to download the proxy application to a local cache path through the proxy interface; The step of defining a proxy interface and encapsulating the proxy interface into a computer language used by a Web client so as to download the proxy application to a local cache path through the proxy interface includes: Define the proxy interface for registering applications; Encapsulating the proxy interface into a computer language used by the Web end; The TCP port is connected via the encapsulated basic communication service to download the proxy application to the local cache path.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method for managing and controlling system resources based on Web technology as described in any one of claims 1 to 4 are implemented.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for managing and controlling system resources based on Web technology as described in any one of claims 1 to 4 are implemented.
