A dynamic configuration system and method for edge server
By introducing a decoupled architecture of the master control module and named pipeline files in the edge server, the problem of resource consumption of the main server in high-real-time tasks is solved, and efficient dynamic configuration and secure configuration updates are achieved.
Patent Information
- Application Number
- CN202311805285.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-26
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2043-12-26
AI Technical Summary
In the existing technology, the dynamic configuration method of edge computing has architectural defects because the main server needs to monitor shared memory, resulting in the consumption of redundant resources in services with high real-time requirements.
A combination of a master control module, a main server, a configuration server, a configuration Web interface, and pipeline files is used. Through shared memory and decoupling, named pipeline files are used to decouple the main server and the configuration server. The master control module manages process start and stop and configuration file updates, preventing the main server from consuming additional resources to focus on configuration updates during operation.
It enables efficient operation of the main server in high real-time tasks, reduces memory usage, and improves the system's dynamic configuration efficiency and security.
Smart Images

Figure CN117908982B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of resource configuration, and in particular to a dynamic configuration system and method for an edge server. Background Art
[0002] As more and more smart devices gain access to the internet and technologies like big data and industrial interconnection mature, the low latency required for the excessive data streams produced by the IoT and industrial equipment is pushing network transmission speeds to their limits. This also creates a need for remote control of devices, leading to the concepts of edge computing and industrial cloud. Edge computing reduces the load on the cloud by leveraging computing, network, and storage resources at the edge—close to data sources or physical devices—to provide users with the computing services they need. However, some edge computing scenarios require dynamic configuration. A currently proposed dynamic configuration method links the master server and configuration server through shared memory, with the configuration server directly notifying the master server of configuration updates via shared memory. However, this approach requires the master server process to free up excess resources to monitor shared memory, which presents architectural flaws for services requiring high real-time performance. Summary of the Invention
[0003] In order to overcome the defects and shortcomings of the existing technology, the present invention provides a dynamic configuration system and method for an edge server, which can configure the edge server content in real time and dynamically. It solves the coupling problem between the configuration server and the main server based on shared memory and decoupling, so that the main server does not need to consume extra resources to pay attention to whether the configuration is updated during operation, and can make the main server process run more efficiently in high-real-time tasks.
[0004] In order to achieve the above object, the present invention adopts the following technical solutions:
[0005] The present invention provides a dynamic configuration system for an edge server, comprising: a master control module, a main server, a configuration server, a configuration Web interface, and a pipeline file;
[0006] The master control module is connected to the main server signal, and is connected to the configuration server signal through the pipeline file, and the configuration server is connected to the configuration Web interface signal;
[0007] The pipeline file includes a read pipeline file and a write pipeline file;
[0008] The configuration web interface is used to obtain the user's configuration information and transmit it to the configuration server;
[0009] The configuration server is used to receive the user's configuration information, parse the configuration information and write it into the configuration file, update the configuration file and write a character identifier into the read pipe file, and read the character identifier of the write pipe file after the main server is restarted;
[0010] The master control module is used to start and stop the main server process and the configuration server process respectively, read the read pipe file, and write the character identifier to the write pipe after restarting the main server;
[0011] The main server is used to read the configuration information of the configuration file and communicate with the master control module.
[0012] As a preferred technical solution, the master control module creates two sub-processes through fork, corresponding to starting the main server process and the configuration server process respectively, and the execution process of each process generates a PID identifier.
[0013] As a preferred technical solution, the configuration Web interface and the configuration server communicate via the http protocol, using the post semantics within the http protocol for communication.
[0014] As a preferred technical solution, the configuration server receives configuration information from the configuration Web page and writes the incoming configuration information into a local temporary string, which is used to temporarily record the configuration information;
[0015] If the current configuration information is found to be different from the information in the temporary string, the temporary string is checked for errors in the configuration file format;
[0016] If the format is incorrect, the configuration is considered to have failed, and the configuration server sends a failure message to the configuration web page through the post interface. If the format is correct, the configuration is considered to have succeeded, the content of the configuration file is updated, and a character identifier is written to the read pipe. The configuration server calls the read function to read the write pipe file and blocks.
[0017] If the character identifier that appears in the write pipe file is read during blocking, it is determined that the main server has completed the restart, the data in the write pipe file is read out, and the next round of information configuration begins.
[0018] As a preferred technical solution, the master control module performs polling for configuration file changes and calls the read function to perform non-blocking reading on the read pipeline file;
[0019] If a character identifier is found in the read pipe file, it is determined that the configuration has been updated. The master control module reads the data in the read pipe file and sends an interrupt signal to shut down the main server process.
[0020] Create a new master server process through the fork function. The new master server process automatically reads the new configuration file when it starts and generates a new PID identifier.
[0021] After the main server restarts, the master control module writes a character identifier to the write pipe file;
[0022] The configuration server is in a blocking read state. When characters in the write pipe are read, the next round of configuration rewrite detection begins.
[0023] The present invention also provides a dynamic configuration method of a dynamic configuration system of an edge server, comprising the following steps:
[0024] When the configuration server receives the configuration information from the configuration web page, it writes the incoming configuration information into a local temporary string. The temporary string is used to temporarily record the configuration information.
[0025] If the current configuration information is found to be different from the information in the temporary string, the temporary string is checked for errors in the configuration file format;
[0026] If the format is incorrect, the configuration is considered to have failed, and the configuration server sends a failure message to the configuration web page through the post interface. If the format is correct, the configuration is considered to have succeeded, the content of the configuration file is updated, and a character identifier is written to the read pipe. The configuration server calls the read function to read the write pipe file and blocks.
[0027] If the character identifier that appears in the write pipe file is read during blocking, it is determined that the main server has completed the restart, the data in the write pipe file is read out, and the next round of information configuration begins.
[0028] As a preferred technical solution, the error checking of the temporary character string on the configuration file format specifically includes:
[0029] Compare the configuration file contents to see if the brackets, parentheses, and double quotes are paired, and check if the commas in the contents are in the correct positions.
[0030] As a preferred technical solution, it also includes a polling step, in which the master control module polls for configuration file changes and calls the read function to perform non-blocking reading on the read pipeline file;
[0031] If a character identifier is found in the read pipe file, it is determined that the configuration has been updated. The master control module reads the data in the read pipe file and sends an interrupt signal to shut down the main server process.
[0032] Create a new master server process through the fork function. The new master server process automatically reads the new configuration file when it starts and generates a new PID identifier.
[0033] After the main server restarts, the master control module writes a character identifier to the write pipe file;
[0034] The configuration server is in a blocking read state. When characters in the write pipe are read, the next round of configuration rewrite detection begins.
[0035] As a preferred technical solution, when the master control module performs polling for configuration file changes, a judgment from an external signal is added to the while condition of the polling.
[0036] As a preferred technical solution, a judgment from an external signal is added to the while condition of the polling, specifically including:
[0037] Set the Boolean variable running. During normal operation, the Boolean variable running is set to true. When an external shutdown signal is received, the Boolean variable running is set to false, and the loop is exited at the next judgment.
[0038] After exiting the loop, the kill command is called to shut down the two main server processes and the configuration server process.
[0039] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0040] (1) The present invention solves the coupling problem between the configuration server and the main server based on shared memory and decoupling, so that the main server does not need to consume extra resources to pay attention to whether the configuration is updated during operation, and can make the main server process run more efficiently in high real-time tasks.
[0041] (2) Since the named pipe technology used in the present invention only transmits identifiers, it has the characteristics of occupying less resources and being simple to create compared to the configuration method of placing all configuration information in shared memory, thereby achieving the effect of smaller memory usage. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 Schematic diagram of the overall architecture of the dynamic configuration system of the edge server of the present invention;
[0043] Figure 2 A flow chart of the process of updating the configuration of the configuration server of the edge server of the present invention;
[0044] Figure 3 This is a flow chart of the control process of the master control module of the edge server of the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0046] Example 1
[0047] like Figure 1 As shown, this embodiment provides a dynamic configuration system for an edge server, including: a master control module, a main server, a configuration server, a configuration Web interface, and a pipeline file;
[0048] Among them, the master control module is connected to the main server signal, and is connected to the configuration server signal through the pipeline file, and the configuration server is connected to the configuration Web interface signal;
[0049] The pipeline file includes a read pipeline file and a write pipeline file. The pipeline file is the intermediate channel for communication between the configuration server and the master control module. It is used for communication between the master control module and the configuration server, decoupling the configuration server and the main server. The pipeline file provides a shared memory. When the configuration is modified, the configuration server writes a character to the master control module. When the main server process is restarted, the master control module writes a character to the pipeline file to inform the configuration server that it can start the next configuration.
[0050] The configuration web interface is used to obtain user configuration information, provide users with a visual configuration interface, and perform configuration by modifying options in the interface. The user's configuration information is updated to the configuration server in real time.
[0051] The configuration server serves as the backend server corresponding to the configuration web page. It is used to receive the user's configuration information, parse the configuration information and write it into the configuration file. It updates the configuration file and writes a character identifier into the read pipe file. After the main server is restarted, the character identifier of the write pipe file is read. Specifically, the configuration server receives the HTTP message of the user's configuration information, parses it and writes it into the configuration file used to record the configuration information to complete the configuration. When the configuration information is effectively updated, it notifies the master control module. The security of the server is ensured through the reverse proxy.
[0052] The master control module is used to start and stop the management main server process and configuration server process, read the read pipe file, and write the character identifier to the write pipe after restarting the main server;
[0053] The main server is used to read the configuration information of the configuration file and communicate with the master control module. It is a server that can read the configuration file by itself when it starts up. According to the configuration information in the configuration file, it provides services to users when receiving user requests;
[0054] In this embodiment, the master control module manages two sub-processes by controlling the start and stop of sub-processes, respectively starting and stopping the main server process and the configuration server process, and realizing the dynamic configuration of the entire edge server; when starting the entire server, the user only needs to turn on the master control module, and then the master control module will create two sub-processes through fork, thereby starting the main server process and the configuration server process. After starting, the master control module will receive the PIDs of the two sub-processes, and the subsequent shutdown operation will be implemented through the PIDs. PID is a unique identifier for each process execution in the Linux system, which is called PID (Process Identifier);
[0055] Dynamic configuration is achieved through the master control module and the configuration server, two parent and child processes, jointly maintaining two named pipeline files;
[0056] The parent process calls the mkfifo(FIFO_READ, 0644) function and the mkfifo(FIFO_WRITE, 0644) function to create the read pipe and the write pipe. The master control process periodically reads the read pipe file FIFO_READ. The configuration server is kept open for a long time, providing the user with server configuration. The configuration web page provides the user with a visual window to modify the configuration information. The configuration web page and the configuration server communicate through the http protocol and use the post semantics in the http protocol. The advantage of post semantics over get semantics is that it can transmit larger data, and post hides the request data in the request body, which is more secure than the get semantics that puts the information in the url.
[0057] like Figure 2As shown in the figure, when the configuration server receives the configuration information from the configuration web page, it first writes the incoming configuration information into a local temporary string. The temporary string serves as a temporary record of the configuration information. If the current configuration information differs from the information in the temporary string, the temporary string is checked for configuration file format errors. The configuration file format used in this example is JSON. For corrections, the only requirement is to check that the brackets, parentheses, and double quotes are paired, and that commas are correctly positioned. If there are format errors, the configuration fails, and the configuration server sends a failure message to the configuration web page via the post interface. If successful, the configuration file content is updated and a character identifier is written to the read pipe. The configuration server then calls the read function to read the write pipe file and block. This prevents the next configuration from being completed before the previous one is complete, thus preventing network attacks. If the character identifier in the write pipe file is read during the blocking process, it indicates that the primary server has restarted. The data in the write pipe file is read, and the next configuration monitoring cycle begins.
[0058] like Figure 3 As shown, after the master control module starts the two child processes, it enters the polling to determine whether there are any changes to the configuration file. The polling will call the read function to perform non-blocking reading on the read pipe file. If no content is read, the next reading cycle will be entered after a certain period of time. If a character identifier is read in the read pipe file, it means that the configuration has been updated. The master control module will first read the data in the read pipe file, and then send an interrupt signal to shut down the main server process. Then, a new main server process will be created through the fork function. The new main server process will automatically read the new configuration file at startup and generate a new PID. The new PID will overwrite the old PID for the next restart. After the restart is complete, the master control process will write a character identifier to the pipe file. At this time, the configuration server is in a blocked read state. Once the character in the write pipe is read, the next configuration rewrite detection will be entered.
[0059] In this embodiment, because the master control module needs to monitor the start and stop of both subprocesses, an external signal check is required within the polling while condition. This embodiment sets a Boolean variable, "running," which is true during normal operation but becomes false upon receiving an external shutdown signal, causing the loop to exit at the next check. After exiting the loop, the "kill" command is directly invoked to terminate both subprocesses.
[0060] In this embodiment, the master server is solely responsible for executing tasks, while the master control module and configuration server monitor whether configuration files have been modified. This architecture frees up the master server's performance. Furthermore, the read / write pipe does not need to be large; a single character is sufficient. The read / write pipe serves as a bridge between the master control module and the configuration server. The completion of a task is determined simply by a Boolean check of whether information exists within the pipe.
[0061] Example 2
[0062] This embodiment provides a dynamic configuration method for an edge server, which is implemented on a Linux operating system and is provided with the dynamic configuration system for the edge server of the above-mentioned embodiment 1. The method includes the following steps:
[0063] When the configuration server receives the configuration information from the configuration web page, it writes the incoming configuration information into a local temporary string. The temporary string is used to temporarily record the configuration information.
[0064] If the current configuration information is found to be different from the information in the temporary string, the temporary string is checked for errors in the configuration file format;
[0065] If the format is incorrect, the configuration is considered to have failed, and the configuration server sends a failure message to the configuration web page through the post interface. If the format is correct, the configuration is considered to have succeeded, the content of the configuration file is updated, and a character identifier is written to the read pipe. The configuration server calls the read function to read the write pipe file and blocks.
[0066] If the character identifier that appears in the write pipe file is read during blocking, it is determined that the main server has completed the restart, the data in the write pipe file is read out, and the next round of information configuration begins.
[0067] In this embodiment, the temporary character string is checked for errors in the configuration file format, specifically including:
[0068] Compare the configuration file contents to see if the brackets, parentheses, and double quotes are paired, and check if the commas in the contents are in the correct positions.
[0069] In this embodiment, a polling step is also included, in which the master control module polls for changes to the configuration file and calls the read function to perform non-blocking reading on the read pipeline file;
[0070] If a character identifier is found in the read pipe file, it is determined that the configuration has been updated. The master control module reads the data in the read pipe file and sends an interrupt signal to shut down the main server process.
[0071] Create a new master server process through the fork function. The new master server process automatically reads the new configuration file when it starts and generates a new PID identifier.
[0072] After the main server restarts, the master control module writes a character identifier to the write pipe file;
[0073] The configuration server is in a blocking read state. When characters in the write pipe are read, the next round of configuration rewrite detection begins.
[0074] In this embodiment, when the master control module performs polling for configuration file changes, a judgment from an external signal is added to the while condition of the polling.
[0075] In this embodiment, a judgment from an external signal is added to the while condition of the polling, specifically including:
[0076] Set the Boolean variable running. During normal operation, the Boolean variable running is set to true. When an external shutdown signal is received, the Boolean variable running is set to false, and the loop is exited at the next judgment.
[0077] After exiting the loop, the kill command is called to shut down the two main server processes and the configuration server process.
[0078] The above embodiments are preferred implementations of the present invention, but the implementations of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be considered equivalent replacement methods and are included in the scope of protection of the present invention.
Claims
1. A dynamic configuration system for an edge server, characterized in that: include: Master control module, main server, configuration server, configuration web interface, pipeline files; The master control module is connected to the main server signal, and is connected to the configuration server signal through the pipeline file, and the configuration server is connected to the configuration Web interface signal; The master control module creates two child processes through fork, corresponding to the main server process and the configuration server process respectively, and the execution process of each process generates a PID identifier; The pipeline file includes a read pipeline file and a write pipeline file; The configuration web interface is used to obtain the user's configuration information and transmit it to the configuration server; The configuration server is used to receive the user's configuration information, parse the configuration information and write it into the configuration file, update the configuration file and write a character identifier into the read pipe file, and read the character identifier of the write pipe file after the main server is restarted; The master control module is used to start and stop the main server process and the configuration server process respectively, read the read pipe file, and write the character identifier to the write pipe after restarting the main server; The main server is used to read the configuration information of the configuration file and communicate with the master control module; The configuration server receives the configuration information from the configuration web page and writes the incoming configuration information into a local temporary string, which is used to temporarily record the configuration information; If the current configuration information is found to be different from the information in the temporary string, the temporary string is checked for errors in the configuration file format; If the format is incorrect, the configuration is considered to have failed, and the configuration server sends a failure message to the configuration web page through the post interface. If the format is correct, the configuration is considered to have succeeded, the content of the configuration file is updated, and a character identifier is written to the read pipe. The configuration server calls the read function to read the write pipe file and blocks. If the character identifier that appears in the write pipe file is read during blocking, it is determined that the main server has completed the restart, the data in the write pipe file is read out, and the next round of information configuration begins.
2. The dynamic configuration system for edge servers according to claim 1, characterized in that: The configuration web interface and the configuration server communicate via the http protocol, using the post semantics within the http protocol for communication.
3. The dynamic configuration system for edge servers according to claim 1, characterized in that: The master control module polls for configuration file changes and calls the read function to perform non-blocking reading on the read pipeline file; If a character identifier is found in the read pipe file, it is determined that the configuration has been updated. The master control module reads the data in the read pipe file and sends an interrupt signal to shut down the main server process. Create a new master server process through the fork function. The new master server process automatically reads the new configuration file when it starts and generates a new PID identifier. After the main server restarts, the master control module writes a character identifier to the write pipe file; The configuration server is in a blocking read state. When characters in the write pipe are read, the next round of configuration rewrite detection begins.
4. A dynamic configuration method implemented by the dynamic configuration system of the edge server according to any one of claims 1 to 3, characterized in that: The steps include: When the configuration server receives the configuration information from the configuration web page, it writes the incoming configuration information into a local temporary string. The temporary string is used to temporarily record the configuration information. If the current configuration information is found to be different from the information in the temporary string, the temporary string is checked for errors in the configuration file format; If the format is incorrect, the configuration is considered to have failed, and the configuration server sends a failure message to the configuration web page through the post interface. If the format is correct, the configuration is considered to have succeeded, the content of the configuration file is updated, and a character identifier is written to the read pipe. The configuration server calls the read function to read the write pipe file and blocks. If the character identifier that appears in the write pipe file is read during blocking, it is determined that the main server has completed the restart, the data in the write pipe file is read out, and the next round of information configuration begins.
5. The dynamic configuration method according to claim 4, characterized in that: The error checking of the temporary character string on the configuration file format specifically includes: Compare the configuration file contents to see if the brackets, parentheses, and double quotes are paired, and check if the commas in the contents are in the correct positions.
6. The dynamic configuration method according to claim 4, characterized in that: It also includes a polling step, where the master control module polls for configuration file changes and calls the read function to perform non-blocking reading of the read pipe file; If a character identifier is found in the read pipe file, it is determined that the configuration has been updated. The master control module reads the data in the read pipe file and sends an interrupt signal to shut down the main server process. Create a new master server process through the fork function. The new master server process automatically reads the new configuration file when it starts and generates a new PID identifier. After the main server restarts, the master control module writes a character identifier to the write pipe file; The configuration server is in a blocking read state. When characters in the write pipe are read, the next round of configuration rewrite detection begins.
7. The dynamic configuration method according to claim 6, characterized in that: When the master control module polls for configuration file changes, add a judgment from an external signal within the while condition of the polling.
8. The dynamic configuration method according to claim 7, characterized in that: Add judgments from external signals in the while condition of polling, including: Set the Boolean variable running. During normal operation, the Boolean variable running is set to true. When an external shutdown signal is received, the Boolean variable running is set to false, and the loop is exited at the next judgment. After exiting the loop, the kill command is called to shut down the two main server processes and the configuration server process.
Citation Information
Patent Citations
Method and system for quickly loading data to database based on multi-process concurrency and plug-ins
CN110347440A
Data processing method and device based on pipeline communication
CN114138245A