Configuration information loading method, system and server
By using domain name status identification in CDN to determine the loading strategy of configuration information, delaying loading of configuration information of non-hot domain names, and using shared memory to optimize memory usage, the problem of high memory consumption in CDN is solved, and system stability and resource utilization are improved Rate.
Patent Information
- Application Number
- CN202110063945.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-18
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-01-18
AI Technical Summary
In CDN, the prior art loads the configuration information of all domain names into memory, resulting in high memory consumption, and the configuration information of non-hot domain names may not be used for a long time and occupy memory.
The domain name's status identification determines whether to delay loading configuration information. The hot domain name is loaded directly into shared memory when initialized, while the non-hot domain name is loaded only when the request is received, and the shared memory and delay loading strategies are used to reduce memory consumption.
It effectively reduces memory consumption, avoids duplicate loading of configuration information, and improves system stability and resource utilization.
Smart Images

Figure CN114827158B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a configuration information loading method, system and server. Background Art
[0002] In CDN (Content Delivery Network), load balancers, proxy servers, node servers and other devices usually need to load the server configuration information of all domain names into memory when running, and then initialize according to these configuration information. Then, when receiving acceleration requests for domain names, different acceleration services can be provided according to different configuration information.
[0003] However, this method of loading all domain name configuration information into memory will obviously consume a lot of memory, and different domain names may have different activities. After the configuration information of some domain names is loaded into memory, there may be no acceleration requests to be processed for a period of time, which will cause a large amount of memory to be occupied. Therefore, a more effective method for processing acceleration requests is urgently needed. Summary of the invention
[0004] The purpose of this application is to provide a configuration information loading method, system and server, which can save system memory consumption.
[0005] To achieve the above-mentioned purpose, the present application provides a method for loading configuration information on the one hand, which is applied to the main process, and the method includes: receiving request information about the target domain name sent by the working process, and querying the status identifier of the target domain name; if the status identifier represents a loaded state, feeding back the loading information of the target domain name to the working process, so that the working process provides an acceleration service based on the loading information; if the status identifier represents a loading state or an unloaded state, writing the process identifier carried in the request information into a request linked list of a shared memory, and loading the configuration information of the target domain name into the shared memory; after providing the loading result to the working process represented by the process identifier, clearing the request linked list.
[0006] To achieve the above-mentioned purpose, the present application also provides a configuration information loading system on the other hand, the system comprising: a status identifier query unit, used to receive request information about a target domain name sent by a working process, and query the status identifier of the target domain name; a first processing unit, used to feed back the loading information of the target domain name to the working process if the status identifier represents a loaded state, so that the working process provides an acceleration service based on the loading information; a second processing unit, used to write the process identifier carried in the request information into a request linked list of a shared memory if the status identifier represents a loading state or an unloaded state, and load the configuration information of the target domain name into the shared memory; after providing the loading result to the working process represented by the process identifier, clearing the request linked list.
[0007] To achieve the above-mentioned purpose, the present application also provides a method for loading configuration information, which is applied to a working process, and includes: receiving an acceleration request for a target domain name, and querying a status identifier of the target domain name; if the status identifier represents a loaded state, reading the configuration information of the target domain name from a shared memory, and providing an acceleration service based on the configuration information; if the status identifier represents a loading state or an unloaded state, sending the request information corresponding to the acceleration request to the main process, and suspending processing of the acceleration request until receiving a loading result fed back by the main process, continuing to process the acceleration request, and providing an acceleration service based on the loading result.
[0008] To achieve the above-mentioned purpose, the present application also provides a configuration information loading system on the other hand, the system comprising: a request query unit, used to receive an acceleration request for a target domain name and query the status identifier of the target domain name; a non-delay processing unit, used to read the configuration information of the target domain name from the shared memory if the status identifier represents a loaded state, and provide acceleration services based on the configuration information; a delay processing unit, used to send the request information corresponding to the acceleration request to the main process if the status identifier represents a loading state or an unloaded state, and suspend processing of the acceleration request until receiving the loading result feedback from the main process, continue processing the acceleration request, and provide acceleration services based on the loading result.
[0009] The present application also provides a server, which includes a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the above-mentioned method for loading configuration information is implemented.
[0010] As can be seen from the above, the technical solution provided by one or more embodiments of the present application can determine whether to delay the loading of the configuration information of the domain name by the status identifier of the domain name. Specifically, when the main process receives the request information about the target domain name sent by the working process, the current status identifier of the target domain name can be queried. Generally speaking, the status identifier can be used to distinguish between hot domain names and non-hot domain names. When the main process initializes the configuration, the configuration information of the hot domain name can be directly loaded into the shared memory, and the status identifier of the hot domain name can be marked as loaded. In this way, for the hot domain name, the working process can directly read the configuration information from the shared memory and provide acceleration services. For non-hot domain names, when the main process initializes the configuration, the status identifier can be marked as unloaded, that is, the configuration information of the non-hot domain name does not need to be loaded into the shared memory at the beginning. When the main process receives the request information sent by the working process, the configuration information of the non-hot domain name will be loaded into the shared memory. In addition, for the same accelerated domain name, if there are multiple concurrent working processes requesting acceleration, the loading results can be provided to each working process one by one. In this way, the configuration information only needs to be loaded once in the shared memory to provide the loading results for multiple processes, avoiding repeated loading of configuration information. It can be seen that through delayed loading and shared memory, the memory consumption can be greatly reduced at the same time, ensuring the stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only 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.
[0012] Figure 1 It is a schematic diagram of the steps of a method for loading configuration information in nginx executed by a main process in an embodiment of the present invention;
[0013] Figure 2 Operation diagram of the main process in the embodiment of the present invention;
[0014] Figure 3 It is a schematic diagram of the steps of a method for loading configuration information in nginx executed by a working process in an embodiment of the present invention;
[0015] Figure 4 It is an operation diagram of the working process in an embodiment of the present invention. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in combination with the specific implementation methods of this application and the corresponding drawings. Obviously, the described implementation methods are only part of the implementation methods of this application, not all of the implementation methods. Based on the implementation methods in this application, all other implementation methods obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0017] The present application provides a method for loading configuration information, which can be applied to devices such as node servers, load balancers, and proxy servers. Among them, in the above-mentioned node servers, load balancers, proxy servers, and other devices, a business system for implementing a business can usually be deployed, and the business system can be implemented based on a certain architecture. For example, in the current CDN, the nginx architecture is widely used in devices such as node servers, load balancers, and proxy servers due to its high performance and high stability. This application takes the nginx architecture as an example to explain the method for loading the configuration information.
[0018] See also Figure 1 and Figure 2 , a method for loading configuration information provided by an implementation mode can be executed by a main process in a business system, and the method can include the following multiple steps.
[0019] S11: receiving request information about a target domain name from a working process, and querying a status identifier of the target domain name.
[0020] In this embodiment, a status identifier may be first added to the acceleration domain name, and the status identifier may represent the loading status of the configuration information of the acceleration domain name. For example, the status identifier may represent the loaded state, the loading state, and the unloaded state. At the same time, the status identifier of each acceleration domain name will only represent one of the loading states. In order to ensure that the status identifier of the acceleration domain name remains synchronized between multiple processes, a read-write lock needs to be added when reading and updating the status identifier.
[0021] In the nginx system, there is usually one main process and multiple worker processes. The main process and each worker process can communicate through a bidirectional pipe. In this way, for N worker processes, corresponding N bidirectional pipes can be created. Through the bidirectional pipe, the main process can receive request information from the worker process, and the worker process can listen to various messages sent by the main process.
[0022] In this embodiment, in order to share the configuration information of the acceleration domain name between multiple processes, the configuration information of the acceleration domain name needs to be stored in the shared memory. The nginx system usually uses heap memory for data storage, so it is necessary to expand the memory pool of the nginx system. Specifically, a pointer ngx_slab_pool_t of the shared memory pool can be added to the ngx_pool_t object. The pointer can be initially empty by default. After the shared memory is created, the pointer can be pointed to the shared memory. In this way, the configuration information of the acceleration domain name can be stored in the shared memory pointed to by the pointer later.
[0023] See also Figure 2 In this embodiment, when the main process is started, the configuration items of each acceleration domain name can be read through the configuration management system or file scanning. In actual applications, the configuration items of the acceleration domain name can be included in the configuration block. For example, the configuration block in an application example can be:
[0024]
[0025]
[0026] In this configuration block, multiple configuration items can limit the domain name of the server to www.wangsu.com, the speed of this domain name is limited to 10kbps, and the configuration block can return the test content "test" after being parsed.
[0027] By reading the configuration items of the acceleration domain name, the main process can obtain the listening ports of each of the acceleration domain names. The listening port can be determined according to the type of the acceleration domain name. For example, the acceleration domain name of http often uses ports 80, 8000 or 8080, and the acceleration domain name of https often uses ports 443, 8443, etc. After obtaining the listening port of the acceleration domain name, the mapping relationship between the port and the acceleration domain name can be recorded. Through the acceleration domain name, the corresponding listening port can be queried. The mapping relationship can be recorded in the above-mentioned shared memory, so that the mapping relationship can be shared among multiple processes. Of course, the acceleration domain name in the mapping relationship can be a precise domain name or a wildcard domain name with a specified prefix or a specified suffix. This application does not limit the implementation method of the acceleration domain name. In order for the listening port to be used normally, it is necessary to call the interface of the initialization port configuration item of nginx to initialize the listening port and set the listening.
[0028] In one embodiment, after the main process creates the shared memory, it can use the shared memory to store the process data generated by the accelerated domain name during the loading process. In actual applications, the process data may include:
[0029] 1. Status identification, used to indicate the loading status;
[0030] 2. Request linked list, used to store the process ID of the working process and the request ID of the acceleration request;
[0031] 3. Configuration items, used to load corresponding configuration information;
[0032] 4. The server loads data to store the configuration data of the accelerated domain name after loading is completed.
[0033] In this embodiment, when the main process initializes the original configuration information of each acceleration domain name, it can identify the delay flag of each acceleration domain name. The delay flag can be a manually marked flag, and the delay flag can indicate whether the acceleration domain name is a hotspot domain name. If the acceleration domain name is a hotspot domain name, it means that the number of visits to the acceleration domain name is usually large. Therefore, when providing acceleration services, the configuration information should adopt a strategy of not delaying loading. For non-hotspot domain names, since the number of visits is not large, the configuration information can adopt a delayed loading strategy to save memory consumption.
[0034] Specifically, after identifying the delay identifier of each acceleration domain name, the target acceleration domain name that represents non-delayed loading can be screened out, and this part of the target acceleration domain name can be used as the above-mentioned hotspot domain name. The main process can load the configuration information of the target acceleration domain name, and write the loaded configuration information into the server-side loading data of the shared memory, and can mark the state identifier of the target acceleration domain name as loaded in the shared memory. Other acceleration domain names except the target acceleration domain name can be used as non-hotspot domain names, and the state identifier can be marked as unloaded. In this way, when initializing the original configuration information, the original configuration information of the hotspot domain name can be pre-loaded into the shared memory, and for non-hotspot domain names, the loading can be delayed. In actual applications, in order to efficiently query the corresponding status identifier and configuration information according to the acceleration domain name, the data in the server-side loading data can be stored in the form of a hash table or a balanced binary tree.
[0035] In this embodiment, after receiving the acceleration request of the target domain name, the working process can send the request information of the target domain name to the main process. The request information can include information such as the target domain name, the process ID of the working process, and the request ID of the acceleration request. In practical applications, the request memory address of the working process can be directly used as the request ID of the acceleration request, thereby saving time and resources for generating the request ID, thereby improving the efficiency of data processing.
[0036] In this embodiment, after the main process receives the request information of the target domain name, it can query the status flag of the target domain name. According to the initialization result, the status flag can be a loaded state or an unloaded state. Of course, since the working process may not be the first time to receive the acceleration request of the target domain name, the status flag of the target domain name may have been modified before, so that the status flag may also be marked as a loading state.
[0037] S13: If the status identifier indicates a loaded state, the loading information of the target domain name is fed back to the working process, so that the working process provides an acceleration service based on the loading information.
[0038] In this embodiment, if the query obtains that the status of the target domain name is marked as loaded, it indicates that the configuration information of the target domain name has been stored in the shared memory. At this time, the main process can feed back the loading information of the target domain name to the working process through a two-way pipe. The loading information may include the target domain name and the storage address of the target domain name in the server-side loading data of the shared memory. In addition, in order to let the working process know which acceleration request the loading information is fed back to, the request identifier of the acceleration request may also be included in the loading information. After receiving the loading information fed back by the main process, the working process can read the corresponding configuration information from the shared memory and use the read configuration information to provide acceleration services.
[0039] S15: If the status identifier represents a loading state or an unloaded state, write the process identifier carried in the request information into the request linked list of the shared memory, and load the configuration information of the target domain name into the shared memory; after providing the loading result to the working process represented by the process identifier, clear the request linked list.
[0040] In this embodiment, if the status identifier represents the loading state, it means that the main process is currently storing the configuration information of the target domain name in the shared memory. At this time, the process identifier carried in the request information can be written into the request list of the shared memory. Of course, in order to distinguish different acceleration requests, the request identifier can also be written into the request list. The request list can record the process identifiers and request identifiers corresponding to different work processes. In this way, if there are multiple concurrent work processes that receive the same acceleration request for the target domain name in a short period of time, in the process of loading the configuration information of the target domain name, the process identifiers and request identifiers of these work processes can be recorded in the request list. In other words, before the configuration information is loaded, this part of the acceleration request can be suspended (paused processing).
[0041] In addition, if the status identifier represents an unloaded state, the process identifier and the request identifier can also be recorded in the request linked list of the target domain name, and the status identifier can be modified to a loading state.
[0042] In this embodiment, after the main process loads the configuration information of the target domain name into the server-side loading data of the shared memory, the state identifier of the target domain name can be modified to the loaded state. Then, the main process can traverse each group of process identifiers and request identifiers in the request linked list of the target domain name, and provide the loading results to the working processes represented by each process identifier one by one. The loading result can include the target domain name and the storage address of the target domain name in the server-side loading data of the shared memory. In addition, in order to let the working process know which acceleration request the loading information is for feedback, the request identifier of the acceleration request can also be included in the loading result. In this way, after receiving the loading result, the working process can read the corresponding configuration information from the shared memory and use the read configuration information to provide acceleration services.
[0043] In this embodiment, after the main process feeds back the loading results to the work processes represented by each process identifier in the request list, the request list can be cleared, thereby completing the batch processing of concurrent requests. It can be seen that for the same accelerated domain name, if there are multiple concurrent work processes requesting acceleration, the loading results can be provided to each work process one by one. In this way, only one configuration information needs to be loaded in the shared memory once to provide the loading results for multiple processes, avoiding repeated loading of configuration information.
[0044] In this embodiment, the main process can read the configuration items of the target domain name when loading the configuration information of the target domain name. Specifically, the ngx_conf_t object can read the configuration items of the target domain name by calling the interface (ngx_parse_conf interface) of nginx to parse and load the configuration. Among the read configuration items, multiple configuration items that have been initialized are included. For example, the two configuration items representing the listening port (listen) and the domain name (server_name) have been initialized before. Therefore, it is necessary to remove the configuration items that have been initialized in the read configuration items and load the configuration information of the remaining configuration items.
[0045] In this embodiment, since the configuration information of the target domain name may be partially configured on http and partially configured on a specific domain name, the configuration information loaded according to the configuration items of the target domain name may be incomplete. In this case, the loaded configuration information can be merged with the preset http configuration information to obtain complete configuration information, and the merged configuration information can be written into the shared memory for reading by the working process.
[0046] In actual applications, if an exception occurs during the above loading process, you can call the nginx reload interface to restart the loading service to ensure that the loading process can be completed normally.
[0047] The present application also provides a configuration information loading system, the system comprising:
[0048] A status identification query unit, used to receive request information about a target domain name sent by a working process, and query the status identification of the target domain name;
[0049] A first processing unit is configured to feed back the loading information of the target domain name to the working process if the status identifier indicates a loaded state, so that the working process provides an acceleration service based on the loading information;
[0050] The second processing unit is used to write the process identifier carried in the request information into the request list of the shared memory if the status identifier represents a loading state or an unloaded state, and load the configuration information of the target domain name into the shared memory; traverse the process identifiers in the request list, and after providing the loading results to each working process represented by the process identifier one by one, clear the request list.
[0051] See also Figure 3 and Figure 4 The present application also provides a method for loading configuration information applied to a working process, which method may include the following steps.
[0052] S21: receiving an acceleration request for a target domain name, and querying a status identifier of the target domain name;
[0053] S23: If the status identifier indicates a loaded state, read the configuration information of the target domain name from the shared memory, and provide an acceleration service based on the configuration information;
[0054] S25: If the status identifier represents a loading state or an unloaded state, the request information corresponding to the acceleration request is sent to the main process, and the processing of the acceleration request is suspended until the loading result feedback from the main process is received, and the acceleration request continues to be processed, and acceleration service is provided according to the loading result.
[0055] In this embodiment, the working process can monitor the message fed back by the main process through the bidirectional pipeline, and can also receive the acceleration request about the target domain name sent by the user. When receiving the acceleration request for the target domain name, the working process can query the status identifier of the target domain name.
[0056] In actual applications, the working process can directly query the status identifier of the target domain name from the shared memory, or send the request information of the target domain name to the main process, in which the request information may include the target domain name, the process identifier of the working process itself, and the request identifier of the acceleration request. In this way, after obtaining the status identifier of the target domain name, if the status identifier represents the loaded state, it indicates that the configuration information of the target domain name already exists in the server-side loading data of the shared memory. At this time, the working process can read the corresponding configuration information from the shared memory and use the read configuration information to provide acceleration services.
[0057] In one embodiment, if the status identifier represents a loading state or an unloaded state, the working process can send the request information corresponding to the acceleration request to the main process and suspend processing of the acceleration request. As described in step S15, when loading the configuration information, the main process can write the process identifier of the working process and the request identifier of the acceleration request into the request list of the target domain name. When the configuration information is loaded, the main process can feedback the loading result to the working process represented by each process identifier in the request list. In this way, after receiving the loading result fed back by the main process, the working process can continue to process the acceleration request. According to the content of the loading result, the working process can read the configuration information from the shared memory and provide acceleration service according to the loading result.
[0058] In one embodiment, after receiving an acceleration request regarding a target domain name, the working process may query whether the domain name information of the target domain name exists in the shared memory. If not, it indicates that the acceleration service is not deployed for the target domain name. In this case, the acceleration request may be rejected or an acceleration service may be provided for the target domain name based on general configuration information.
[0059] In one embodiment, after receiving an acceleration request for a target domain name, the working process can also identify the port obtained by parsing the configuration item when the target domain name is initialized from the shared memory, and compare the identified port with the port that receives the acceleration request. If the two are inconsistent, it indicates that the port is abnormal. At this time, the acceleration request can be processed in a manner specified by the configuration information of the target domain name. The specified manner can be, for example, to reject the acceleration request, or to ignore the port abnormality and continue to execute subsequent steps.
[0060] The present application also provides a configuration information loading system, the system comprising:
[0061] A request query unit, configured to receive an acceleration request for a target domain name and query a status identifier of the target domain name;
[0062] a non-delay processing unit, configured to read the configuration information of the target domain name from the shared memory if the status identifier indicates a loaded state, and provide an acceleration service based on the configuration information;
[0063] A delay processing unit is used to send the request information corresponding to the acceleration request to the main process if the status identifier represents a loading state or an unloaded state, and suspend processing of the acceleration request until receiving the loading result feedback from the main process, continue processing the acceleration request, and provide acceleration service based on the loading result.
[0064] The present application also provides a server, which includes a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the above-mentioned method for loading configuration information is implemented.
[0065] As can be seen from the above, the technical solution provided by one or more embodiments of the present application can determine whether to delay the loading of the configuration information of the domain name by the status identifier of the domain name. Specifically, when the main process receives the request information about the target domain name sent by the working process, the current status identifier of the target domain name can be queried. Generally speaking, the status identifier can be used to distinguish between hot domain names and non-hot domain names. When the main process initializes the configuration, the configuration information of the hot domain name can be directly loaded into the shared memory, and the status identifier of the hot domain name can be marked as loaded. In this way, for the hot domain name, the working process can directly read the configuration information from the shared memory and provide acceleration services. For non-hot domain names, when the main process initializes the configuration, the status identifier can be marked as unloaded, that is, the configuration information of the non-hot domain name does not need to be loaded into the shared memory at the beginning. When the main process receives the request information sent by the working process, the configuration information of the non-hot domain name will be loaded into the shared memory. In addition, for the same accelerated domain name, if there are multiple concurrent working processes requesting acceleration, the loading results can be provided to each working process one by one. In this way, the configuration information only needs to be loaded once in the shared memory to provide the loading results for multiple processes, avoiding repeated loading of configuration information. It can be seen that through delayed loading and shared memory, the memory consumption can be greatly reduced at the same time, ensuring the stability of the system.
[0066] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the system and the server, they can all refer to the introduction and comparison of the embodiments of the aforementioned method.
[0067] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0068] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0069] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0070] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0071] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0072] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0073] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0074] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0075] The above is only the implementation mode of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for loading configuration information, characterized in that: The method is applied in the main process, and the method includes: Receive request information about the target domain name from the working process, and query the status identifier of the target domain name; If the status identifier indicates a loaded state, feeding back the loading information of the target domain name to the working process, so that the working process provides an acceleration service based on the loading information; wherein the loading information includes the target domain name and a storage address of the target domain name in the server-side loading data of the shared memory; If the status identifier represents a loading state or an unloaded state, write the process identifier carried in the request information into the request linked list of the shared memory, and load the configuration information of the target domain name into the shared memory; after providing the loading result to the working process represented by the process identifier, clear the request linked list; Before receiving the request information about the target domain name sent by the working process, the method also includes: loading the configuration information of the target acceleration domain name, writing the loaded configuration information into the shared memory, and marking the status identifier of the target acceleration domain name as loaded in the shared memory, and marking the status identifiers of other acceleration domain names except the target acceleration domain name as unloaded, wherein the target acceleration domain name is an acceleration domain name that represents non-delayed loading.
2. The method according to claim 1, characterized in that Before receiving the request information about the target domain name sent by the working process, the method further includes: Read the configuration items of each acceleration domain name, and obtain the listening port of each acceleration domain name from the read configuration items; Initialize each of the listening ports, and record the mapping relationship between the listening port and the corresponding acceleration domain name.
3. The method according to claim 1 or 2, characterized in that: Before loading the configuration information of the target acceleration domain name, the method further includes: Creating a shared memory, where the shared memory is used to store process data generated during the loading process of the accelerated domain name; Identify the delay flags of each acceleration domain name, and filter out the target acceleration domain name that indicates no delayed loading.
4. The method according to claim 3, characterized in that The process data generated during the loading process at least includes: A status indicator used to represent the loading status; A request linked list, used to store the process ID of the working process and the request ID of the acceleration request; Configuration items, used to load corresponding configuration information; The server loads data, which is used to store the configuration data of the accelerated domain name after loading is completed.
5. The method according to claim 1, characterized in that If the state identifier represents an unloaded state, after the process identifier carried in the request information is written into the request linked list of the shared memory, the state identifier is modified to a loading state.
6. The method according to claim 1, characterized in that Loading the configuration information of the target domain name into the shared memory includes: Read the configuration items of the target domain name, remove the configuration items that have been initialized, and load the configuration information of the remaining configuration items; The loaded configuration information is merged with the preset http configuration information, and the merged configuration information is written into the shared memory.
7. The method according to claim 1, characterized in that The request information also includes a request identifier; accordingly, the process identifier and the request identifier carried in the request information are written into the request linked list of the shared memory, and the request identifier is included in the provided loading result.
8. The method according to claim 1, characterized in that Providing the loading result to the working process represented by the process identifier includes: The process identifiers in the request linked list are traversed, and the loading results are provided one by one to the working processes represented by the process identifiers.
9. A configuration information loading system, characterized in that: The system comprises: A status identifier query unit is used to receive request information about a target domain name from a working process, and query the status identifier of the target domain name; before receiving the request information about the target domain name from the working process, it also includes: loading configuration information of a target acceleration domain name, writing the loaded configuration information into a shared memory, and marking the status identifier of the target acceleration domain name as a loaded state in the shared memory, and marking the status identifiers of other acceleration domain names except the target acceleration domain name as an unloaded state, wherein the target acceleration domain name is an acceleration domain name that indicates non-delayed loading; A first processing unit is configured to feed back the loading information of the target domain name to the working process if the status identifier indicates a loaded state, so that the working process provides an acceleration service based on the loading information; wherein the loading information includes the target domain name and a storage address of the target domain name in the server-side loading data of the shared memory; The second processing unit is used to write the process identifier carried in the request information into the request list of the shared memory if the status identifier represents a loading state or an unloaded state, and load the configuration information of the target domain name into the shared memory; after providing the loading result to the working process represented by the process identifier, clear the request list.
10. A server, characterized in that: The server comprises a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 8 is implemented.
11. A method for loading configuration information, characterized in that: The method is applied in a work process, and the method comprises: Receiving an acceleration request for a target domain name, and querying a status identifier of the target domain name; If the status identifier represents a loaded state, read the configuration information of the target domain name from the shared memory, and provide an acceleration service based on the configuration information; wherein the loaded state indicates that the configuration information of the target domain name has been stored in the shared memory; If the status identifier represents a loading state or an unloaded state, the request information corresponding to the acceleration request is sent to the main process, and processing of the acceleration request is suspended until the loading result feedback from the main process is received, and the acceleration request continues to be processed, and acceleration service is provided based on the loading result.
12. The method according to claim 11, characterized in that After receiving the acceleration request for the target domain name, the method further includes: It is queried in the shared memory whether the domain name information of the target domain name exists. If not, the acceleration request is rejected or an acceleration service is provided for the target domain name based on the general configuration information.
13. The method according to claim 11, characterized in that After receiving the acceleration request for the target domain name, the method further includes: The port of the target domain name is identified, and the port is compared with the port for receiving the acceleration request. If the two are inconsistent, the acceleration request is processed in a manner specified by the configuration information of the target domain name.
14. A configuration information loading system, characterized in that: The system comprises: A request query unit, configured to receive an acceleration request for a target domain name and query a status identifier of the target domain name; A non-delay processing unit, configured to read the configuration information of the target domain name from the shared memory if the state identifier represents a loaded state, and provide an acceleration service based on the configuration information; wherein the loaded state indicates that the configuration information of the target domain name has been stored in the shared memory; A delay processing unit is used to send the request information corresponding to the acceleration request to the main process if the status identifier represents a loading state or an unloaded state, and suspend processing of the acceleration request until receiving the loading result feedback from the main process, continue processing the acceleration request, and provide acceleration service based on the loading result.
15. A server, characterized in that: The server comprises a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the method according to any one of claims 11 to 13 is implemented.
Citation Information
Patent Citations
Configuration loading method and device
CN107544828A
Configuration information loading method, device, service processing method and device
CN109150930A