Container deployment optimization method and device, equipment and storage medium
By obtaining the number of repeated reads and writes of image data and determining hotspot data in the container deployment scenario, the memory cache and kernel parameter configuration are optimized to solve the performance problems caused by the on-demand loading mechanism, improve the startup and running performance of the application, and ensure the hotspot data Residence time in memory.
Patent Information
- Application Number
- CN202311340068.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-16
- Publication Date
- 2024-10-18
AI Technical Summary
In application container deployment scenarios, performance problems caused by the use of on-demand loading mechanisms include slow startup speed and reduced runtime performance, especially in 10,000+ Pod scale scenarios, poor network IO performance and intensified contention for memory cache resources. .
By obtaining the number of repeated reads and writes of the mirror data, the hotspot data is determined, and the hotspot cache page is moved to the head position of the memory linked list. The preset manual access strategy and kernel parameter configuration optimization model are used to optimize the memory cache and kernel parameter configuration. Improve the hit rate of hotspot data and application performance.
It effectively optimizes the startup speed and runtime performance of applications, ensures that hotspot data resides in memory for a longer period of time, reduces dependence on network IO, avoids contention for memory cache resources, and improves the overall performance of container deployment.
Smart Images

Figure CN118796332A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of container deployment, and in particular to a container deployment optimization method, device, equipment and storage medium. Background Art
[0002] At present, in the Pull stage of business containerized deployment, P2P (Peer-to-Peer) loading and on-demand loading mechanism optimization are mainly adopted to reduce the Pull time by increasing parallelism or reducing the transmission data.
[0003] However, the use of the on-demand loading mechanism in the application container deployment scenario still has the following problems: on the one hand, the on-demand loading mechanism changes the way container applications obtain data, from disk IO (Input / Output) to poor-performance network IO, especially in the 10,000+ Pod scale scenario, which causes the container to read data more slowly, which will interfere with the startup speed and runtime performance of the application; on the other hand, the on-demand loading mechanism changes the resource preference of container applications, and the application becomes more sensitive to the cache resources of the working node. At the same time, in large-scale deployment scenarios, the contention for memory cache resources is further intensified, which will cause a significant decline in the runtime performance of the application. Summary of the invention
[0004] The main purpose of the present invention is to provide a container deployment optimization method, device, equipment and storage medium, aiming to solve the technical problem in the prior art of using an on-demand loading mechanism in an application containerized deployment scenario, which causes performance interference to the application during runtime.
[0005] To achieve the above object, the present invention provides a container deployment optimization method, which comprises the following steps:
[0006] Obtaining the number of repeated read and write times of the mirrored data, and determining the hotspot data based on the number of repeated read and write times;
[0007] Based on the hotspot data, determine a hotspot cache page;
[0008] Move the hotspot cache page to the head position of the memory linked list.
[0009] Optionally, placing the hotspot cache page at the head position of a memory linked list includes:
[0010] Based on a preset manual access strategy, the hotspot cache page is moved to the head position of the memory linked list;
[0011] The preset manual access strategy includes:
[0012] The hotspot cache page is marked as a recently accessed page, and the number of repeated reads and writes corresponding to the hotspot data in the hotspot cache page is reduced by a preset amount.
[0013] Optionally, determining the hotspot cache page based on the hotspot data includes:
[0014] Get the block device information and starting sector information of the cache page;
[0015] Based on the block device information and the starting sector information, determining the index node information and the file offset corresponding to the cache page;
[0016] Based on the index node information and the file offset, query whether there is a cache-compliant page in the kernel's page hash table;
[0017] When there is a matching cache page, the matching cache page is determined to be the hotspot cache page.
[0018] Optionally, obtaining the number of repeated read and write times of the mirrored data includes:
[0019] Get the read and write information of the block device layer within a preset period;
[0020] According to a preset size, the read and write information of the block device layer is summarized to obtain the summarized read and write information;
[0021] The summary read and write information is mapped to the hash bucket of the kernel, and statistical analysis is performed to obtain the number of repeated read and write times of the mirror data.
[0022] Optionally, the container deployment optimization method further includes:
[0023] Based on the kernel parameter configuration combination, a configuration optimization model is established;
[0024] Based on the configuration optimization model, a target kernel parameter configuration combination is determined, and the kernel parameter configuration is adjusted according to the target kernel parameter configuration combination.
[0025] Optionally, establishing a configuration optimization model based on the kernel parameter configuration combination includes:
[0026] Based on the preset kernel parameters, multiple kernel parameter configuration combinations are determined, and the task completion time corresponding to each kernel parameter configuration combination is determined;
[0027] Combining the plurality of kernel parameter configuration combinations with corresponding task completion times to obtain a plurality of configuration data;
[0028] The plurality of configuration data are input into a preset fitting model to obtain the configuration optimization model.
[0029] Optionally, determining a target kernel parameter configuration combination based on the configuration optimization model, and adjusting the kernel parameter configuration according to the target kernel parameter configuration combination includes:
[0030] Acquire initial search data, input the initial search data into the configuration optimization model, and obtain initial configuration output data;
[0031] Determining initial configuration target data based on the initial configuration output data, and determining current search data according to the initial configuration target data;
[0032] Inputting the current search data into the configuration optimization model to obtain current configuration output data, and determining current configuration target data according to the current configuration output data;
[0033] Determining minimum configuration target data according to the current configuration target data and the initial configuration target data;
[0034] Based on the minimum configuration target data, determine a target kernel parameter configuration combination, and adjust the kernel parameter configuration according to the target kernel parameter configuration combination;
[0035] When the preset completion condition is not met, the initial configuration target data is updated to the minimum configuration target data, and the step of determining the current search data according to the initial configuration target data is returned to be executed.
[0036] In addition, to achieve the above-mentioned purpose, the present invention also proposes a container deployment optimization device, which includes:
[0037] An acquisition module, used to acquire the number of repeated read and write times of the mirror data, and determine the hot data based on the number of repeated read and write times;
[0038] An update module, used to determine a hotspot cache page based on the hotspot data;
[0039] The update module is also used to move the hotspot cache page to the head position of the memory linked list.
[0040] In addition, to achieve the above-mentioned purpose, the present invention also proposes a container deployment optimization device, which includes: a memory, a processor, and a container deployment optimization program stored in the memory and executable on the processor, and the container deployment optimization program is configured to implement the steps of the container deployment optimization method described above.
[0041] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a container deployment optimization program is stored, and when the container deployment optimization program is executed by a processor, the steps of the container deployment optimization method described above are implemented.
[0042] In the present invention, by obtaining the number of repeated read and write times of the mirror data, the hotspot data is determined based on the number of repeated read and write times, and the hotspot cache page is determined based on the hotspot data, and the hotspot cache page is moved to the head position of the memory linked list. Since the on-demand loading mechanism is used in the application container deployment scenario, it will interfere with the startup speed and runtime performance of the application. The present invention designs an efficient cache on-demand loading mechanism to ensure that the hotspot cache page where the hotspot data is located is always at the head of the memory linked list, so that the hotspot cache page resides in the kernel for a longer time, giving priority to hotspot page hits, optimizing the time consumed by the application startup and operation to obtain data, and will not affect the pages occupied by other programs in the memory. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 It is a structural diagram of a container deployment optimization device for a hardware operating environment involved in an embodiment of the present invention;
[0044] Figure 2 This is a schematic diagram of the process of the first embodiment of the container deployment optimization method of the present invention;
[0045] Figure 3 This is a schematic diagram of the principle of an on-demand mechanism of an embodiment of a container deployment optimization method of the present invention;
[0046] Figure 4 A schematic diagram of a page update strategy of an embodiment of a container deployment optimization method of the present invention;
[0047] Figure 5 This is a flow chart of a second embodiment of the container deployment optimization method of the present invention;
[0048] Figure 6 A schematic diagram of the process of the third embodiment of the container deployment optimization method of the present invention;
[0049] Figure 7 A schematic diagram of verification results of an embodiment of a container deployment optimization method of the present invention;
[0050] Figure 8 This is a structural block diagram of the first embodiment of the container deployment optimization device of the present invention.
[0051] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0052] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0053] Reference Figure 1 , Figure 1 A schematic diagram of the structure of a container deployment optimization device for a hardware operating environment according to an embodiment of the present invention.
[0054] like Figure 1 As shown, the container deployment optimization device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0055] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the container deployment optimization device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0056] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a container deployment optimization program.
[0057] exist Figure 1 In the container deployment optimization device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the container deployment optimization device of the present invention can be set in the container deployment optimization device, and the container deployment optimization device calls the container deployment optimization program stored in the memory 1005 through the processor 1001, and executes the container deployment optimization method provided by the embodiment of the present invention.
[0058] The embodiment of the present invention provides a container deployment optimization method, referring to Figure 2 , Figure 2 The figure is a flow chart of a first embodiment of a method for optimizing container deployment according to the present invention.
[0059] In this embodiment, the container deployment optimization method includes the following steps:
[0060] Step S10: Obtain the number of repeated read and write times of the mirror data, and determine the hotspot data based on the number of repeated read and write times.
[0061] It should be noted that the executor of this embodiment can be a container deployment optimization device, on which a container deployment optimization program is run. By running the container deployment optimization program, the application startup and running performance is optimized. It can also be other terminal devices with computing capabilities. This embodiment does not limit this and takes the container deployment optimization device as an example for explanation.
[0062] It is understandable that if Figure 3 As shown, Figure 3 The transmission path of application data under the on-demand loading mechanism is shown in FIG. When the image data required for application (application container) startup is not found in the memory, the memory cache loads the required image data from the remote image, and then the application uses the image data by accessing the memory cache page. This embodiment can optimize the time consumed in obtaining data when the application is started.
[0063] It should be understood that the image data refers to all the image data used to start the application container, the number of repeated reads and writes refers to the number of times the image data is repeatedly read and written, and the hot data refers to the data that is frequently accessed among all the image data. It is determined based on the number of repeated reads and writes. Usually, data with a high number of repeated reads and writes is considered to be hot data.
[0064] Furthermore, the step S10 includes: obtaining the read and write information of the block device layer within a preset period; summarizing the read and write information of the block device layer according to a preset size to obtain summarized read and write information; mapping the summarized read and write information to the hash bucket of the kernel, and performing statistical analysis to obtain the number of repeated read and write times of the mirror data.
[0065] It should be noted that the preset period is a preset cache page update period, for example: 1s. This embodiment does not limit this and can be flexibly adjusted according to actual needs. The number of repeated reads of the mirror data will be counted and updated every preset period to update the cache page.
[0066] It is understandable that read / write information refers to read / write events, which usually include specific block device number, total number of read / write bytes, specific offset position, etc. The preset size refers to the size of the read / write information to be aggregated, for example: 4k, which is 8 sectors, and the aggregated read / write information is the large read / write information obtained after aggregation.
[0067] In the specific implementation, the read and write events of the image layer obtained through Blktrace monitoring are first analyzed, and the read and write information of the block device layer is aggregated into large read and write information according to the size of 4K, that is, 8 sectors, and mapped to the corresponding hash bucket, and the number of repeated reads is counted.
[0068] Step S20: Determine the hotspot cache page based on the hotspot data.
[0069] It should be understood that the hotspot cache page is the memory cache page where the hotspot data determined in this embodiment is located, that is, the page most likely to be accessed next. This embodiment considers the memory cache page where the frequently accessed hotspot data is located as the page most likely to be accessed next.
[0070] Furthermore, the step S20 includes: obtaining block device information and starting sector information of the cache page; based on the block device information and the starting sector information, determining the index node information and file offset corresponding to the cache page; based on the index node information and the file offset, querying whether there is a matching cache page in the kernel's page hash table; when there is a matching cache page, determining that the matching cache page is the hotspot cache page.
[0071] It should be noted that the cache page is each memory cache page, the block device information is information related to the block device, such as the block device number, the starting sector information is related information of the starting sector, and the index node information refers to the inode number. According to the block device number and starting sector of each memory cache page, the corresponding inode number and file offset are queried in debugfs.
[0072] It can be understood that the matching cache page refers to one or several cache pages that can be queried in the page hash table. The obtained inode number and file offset are used to query whether the corresponding memory cache page is in the kernel's page hash table, and the queried memory cache page is used as a hot cache page.
[0073] Step S30: moving the hotspot cache page to the head position of the memory linked list.
[0074] It should be understood that for the memory cache part, the default implementation of the Linux kernel is to organize the allocated memory pages in the form of a linked list, and when the memory is tight, the LRU (Least Recently Used) algorithm is used to recycle part of the previously allocated memory to achieve a balance of memory revenue and expenditure. The Linux kernel works at the operating system layer and cannot perceive the typical read and write characteristics of the application load. Therefore, in its implementation process, an algorithm that performs well in most cases must be selected as the elimination algorithm for the memory cache. The operation process of LRU does not require additional input, and judgment can be made only through previous access records. It is very suitable for scenarios where multiple programs run together. The algorithm idea of LRU is to believe that the most recently accessed memory page is the most likely to be accessed next, but the application is most likely to be accessed next in the process of using the container image, which should be the page where the hot data such as the program and the link library are located, and it cannot be simply considered that the recently accessed memory cache page is most likely to be accessed next. Therefore, this embodiment uses the hot cache page where the hot data is located as the page most likely to be accessed next. In addition, when using the on-demand loading mechanism, once the image data does not exist in the memory, the application will be forced to read data from the network IO with poor performance. For hot data, the problem is even more serious. If the hot data memory cache does not hit, multiple containers will simultaneously obtain data from the remote mirror storage, further exacerbating the severity of the problem. Therefore, it is necessary to improve the hit rate of hot data in the kernel cache and increase the residence time of hot data in the kernel cache.
[0075] Furthermore, the step S30 includes: based on a preset manual access strategy, moving the hotspot cache page to the head position of the memory linked list; the preset manual access strategy includes: marking the hotspot cache page as a recently accessed page, and reducing the number of repeated reads and writes corresponding to the hotspot data in the hotspot cache page by a preset amount.
[0076] It should be noted that the preset manual access strategy refers to a manual page access method, which marks the hot cache page as a recently accessed page and reduces the corresponding repeated read and write times by 1, wherein the repeated read and write times reduced by 1 indicates that a page has been accessed once, and the preset number in this embodiment is 1. The hot cache page can be marked by calling the kernel function mark_page_accessed() to mark it as a recently accessed page (recently accessed page).
[0077] In the specific implementation, if the corresponding hotspot cache page is found in the page hash table, the page will be marked as recently accessed, and the number of repeated reads and writes corresponding to the page will be reduced by one. At this time, the page will be placed back at the head of the memory linked list to avoid the risk of being eliminated. Through the cache update of the page, it can be ensured that the identified hotspot data page can reside in the memory for a long time. At the same time, the algorithm logic will not affect the pages occupied by other programs in the memory. The pages of other programs are still managed and recycled according to the default LRU algorithm.
[0078] It is understandable that if the corresponding hotspot cache page is found in the page hash table, it means that the hotspot cache page has been eliminated, and the count of the page can be cleared. At this time, the number of repeated reads and writes corresponding to the page is equivalent to the frequency of the page.
[0079] like Figure 4 The page update strategy diagram shown in the figure finds the memory cache page where the frequently accessed hot data is located as the hot cache page. Through manual page access, the hot cache page will always be at the head of the memory linked list, thereby avoiding being eliminated by the LRU algorithm during memory recycling.
[0080] In this embodiment, by obtaining the number of repeated read and write times of the mirror data, the hotspot data is determined based on the number of repeated read and write times, and the hotspot cache page is determined based on the hotspot data, and the hotspot cache page is moved to the head position of the memory list. Since the on-demand loading mechanism is used in the application container deployment scenario, it will interfere with the startup speed and runtime performance of the application. This embodiment uses hotspot data to update the memory cache page, ensuring that the hotspot cache page where the hotspot data is located is always at the head of the memory list, so that the hotspot cache page resides in the kernel for a longer time, giving priority to hotspot page hits, optimizing the time consumed by the application startup and operation to obtain data, and will not affect the pages occupied by other programs in the memory.
[0081] Reference Figure 5 , Figure 5 The figure is a flow chart of a second embodiment of a method for optimizing container deployment according to the present invention.
[0082] Based on the above embodiment, after step S30, the following further steps are included:
[0083] Step S401: Establish a configuration optimization model based on the kernel parameter configuration combination.
[0084] Furthermore, the step S401 includes: based on preset kernel parameters, determining multiple kernel parameter configuration combinations, and determining the task completion time corresponding to each kernel parameter configuration combination; combining the multiple kernel parameter configuration combinations with the corresponding task completion time to obtain multiple configuration data; inputting the multiple configuration data into a preset fitting model to obtain the configuration optimization model.
[0085] It should be noted that the preset kernel parameters are pre-set kernel system parameters that need to be optimized and configured, usually the default kernel parameters of the operating system and memory cache tuning, and this embodiment does not limit this. The kernel parameter configuration combination is a combination of various preset kernel parameters. According to different values of the preset kernel parameters, multiple possible kernel parameter configuration combinations can be obtained. The task completion time refers to the average task completion time value of the container application under load conditions, and each set of kernel parameter configuration combinations corresponds to a task completion time. A kernel parameter configuration combination is combined with its corresponding task completion time to obtain a configuration data, and each kernel parameter configuration combination is combined with its corresponding task completion time to obtain multiple configuration data.
[0086] It can be understood that the preset fitting model is a Gaussian distribution fitting model. All the obtained configuration data are input into the preset fitting model, and a new model that obeys the Gaussian distribution is obtained through iteration through the Gaussian process, that is, the configuration optimization model. If the configuration data is (x, y), p(y|x, D) is used to represent the configuration optimization model, where x represents the kernel parameter configuration combination, y represents the task completion time, and D represents the configuration data set.
[0087] It should be understood that this embodiment uses task completion time to define the performance of a certain application in the workload, which has the following advantages: compared with other indicators, task completion time can represent the average status of application performance; compared with other indicators, this indicator is more commonly used and easy to obtain, and can usually be obtained in the monitoring interface of the application itself, without consuming additional statistical time.
[0088] Step S402: Based on the configuration optimization model, determine a target kernel parameter configuration combination, and adjust the kernel parameter configuration according to the target kernel parameter configuration combination.
[0089] It should be noted that the target kernel parameter configuration combination refers to the obtained better kernel parameter configuration combination. The obtained configuration optimization model is used to search for a kernel parameter configuration combination that is better than the currently used kernel parameter configuration combination. Each time a better kernel parameter configuration combination is determined, the current kernel parameter configuration will be updated.
[0090] It is understandable that due to the application of the on-demand loading mechanism, container applications are more sensitive to cache hit rates, and the increasing density of containers when the working nodes are running will cause more serious contention for the memory cache. Therefore, in large-scale container deployment scenarios, the management strategy of the memory cache becomes particularly important. Once the cache management mechanism does not perform well enough, the application will suffer performance degradation due to changes in the image loading mechanism. The memory management strategy of the Linux kernel itself is very complex, and many parameters are provided for users to adjust and optimize. There are more than twenty configurable parameters provided in the kernel documentation. Under different application loads and different machine conditions, it is necessary to select appropriate kernel parameter configurations. This embodiment proposes a kernel parameter configuration search strategy based on the Bayesian optimization idea. With the help of the Bayesian algorithm, on the basis of ensuring a sufficient number of iterations, it will eventually converge to the characteristics of the global optimal solution, and the kernel system parameters are used as variable inputs to obtain the optimal parameter configuration results.
[0091] In this embodiment, a configuration optimization model is established based on the kernel parameter configuration combination, and the optimal kernel parameter configuration combination is determined based on the configuration optimization model. Since the on-demand loading mechanism is used in the application container deployment scenario, it will interfere with the startup speed and runtime performance of the application. This embodiment can realize automatic configuration of kernel parameters, and can determine the optimal parameter configuration under different application loads and different machine conditions, which can optimize the time consumed by the application startup to obtain data. In addition, this embodiment uses hotspot data to update the memory cache page, ensuring that the hotspot cache page where the hotspot data is located is always at the head of the memory linked list, so that the hotspot cache page resides in the kernel for a longer time, giving priority to guaranteeing the hit of the hotspot page, and optimizing the time consumed by the application startup to obtain data. By updating the cache page and automatically configuring the kernel parameters, the interference of the on-demand loading mechanism on the application runtime performance is reduced.
[0092] Reference Figure 6 , Figure 6 It is a flowchart of a third embodiment of a container deployment optimization method of the present invention.
[0093] Based on the above second embodiment, step S402 includes:
[0094] Step S4021: Acquire initial search data, input the initial search data into the configuration optimization model, and obtain initial configuration output data.
[0095] It should be noted that the initial search data is the determined initial search value, and usually the combination of the initial default kernel parameters of the Linux kernel is used as the initial search data. The initial search data is input into the configuration optimization model, and the output data obtained is the initial configuration output data, which can be considered as the optimized task completion time corresponding to the initial search data.
[0096] Step S4022: Determine initial configuration target data based on the initial configuration output data, and determine current search data according to the initial configuration target data.
[0097] It can be understood that the initial configuration target data is the target function value calculated based on the initial configuration output data. The target function is the cache sorting times multiplied by the performance of the workload, that is, in, Indicates the overall performance of the application load. This embodiment uses the task completion time, which is the output data obtained by configuring the optimization model. Indicates the number of cache sorting times, that is, the cost of each search. Represents the objective function. At this time, substituting the initial configuration output data into it, the initial configuration target data can be obtained.
[0098] It should be understood that the current search data refers to the data currently being searched, which can be considered as the kernel parameter configuration combination currently being searched. This embodiment determines the current search data through an acquisition function. The acquisition function used in this embodiment is the EI (Expected Improvement) method. The specific calculation relationship is as follows:
[0099]
[0100] In the formula, Indicates the current search data. and They are the CDF (cumulative distribution function) and PDF (probability density function) of the standard Gaussian distribution, represents the current search data of the t-th search, That is, the minimum value of all objective function values so far. At this time, since there is only one data, the initial configuration target data, Target data for initial configuration.
[0101] It should be noted that, since EI is less likely to fall into local optimum than the PI (Probability of improvement) method, and does not introduce additional tuning parameters compared to the GP-UCB (Gaussian Process Upper Confidence Bound) method, this embodiment selects EI as the acquisition function. The basic idea of EI is to select the difference from the currently known minimum function value as the incentive, so that the next objective function value found is smaller than the known minimum function value.
[0102] Step S4023: input the current search data into the configuration optimization model to obtain current configuration output data, and determine current configuration target data based on the current configuration output data.
[0103] It can be understood that the current configuration output data, i.e., the output data obtained after the current search data is input into the configuration optimization model, can be considered as the optimized task completion time corresponding to the current search data. The current configuration target data, i.e., the objective function value calculated based on the current configuration output data, can be obtained by substituting the current configuration output data into the above objective function calculation formula.
[0104] Step S4024: Determine minimum configuration target data according to the current configuration target data and the initial configuration target data.
[0105] It should be understood that due to is the minimum value of all objective function values so far. At this time, the current configuration target data and the initial configuration target data have been obtained. It is necessary to find the data with the smaller value of the two data, that is, the minimum configuration output data. The process of determining the minimum configuration output data can be considered as determining process.
[0106] Step S4025: Based on the minimum configuration target data, determine a target kernel parameter configuration combination, and adjust the kernel parameter configuration according to the target kernel parameter configuration combination.
[0107] It should be noted that the target kernel parameter configuration combination is the kernel parameter configuration combination to be searched next calculated based on the minimum configuration target data. Each time a target kernel parameter configuration combination is calculated, the current kernel parameter configuration is adjusted to optimize it.
[0108] It is understandable that after obtaining the target kernel parameter configuration combination, the next target kernel parameter configuration combination is usually determined again at a certain interval, for example, 5 minutes, which can be set according to actual needs and is not limited in this embodiment.
[0109] Step S4026: When the preset completion condition is not met, the initial configuration target data is updated to the minimum configuration target data, and the process returns to the step of determining the current search data according to the initial configuration target data.
[0110] It should be understood that the preset completion condition refers to the number of iterations having been reached or the confidence interval having been satisfied. It conforms to the Gaussian distribution. It can also be considered to be in accordance with the Gaussian distribution, so is also Gaussian, which ensures that the Bayesian optimization process can be based on The observed value is used to infer The confidence interval of . ε represents Gaussian white noise.
[0111] It should be noted that when the preset completion condition is not met, it is necessary to continue searching, use the minimum configuration target data as the new initial configuration target data, and calculate the new current search data, that is, the next kernel parameter configuration combination to be searched. According to the new current search data obtained, calculate the new current configuration output data to obtain the new current configuration target data, and then compare the new current configuration target data with the previously obtained minimum configuration target data, use the smaller value as the new minimum configuration target data, update the current kernel parameter configuration, and then continue to determine the new current search data until the completion condition is met. After the completion condition is met, the next round of search will be stopped, that is, the calculation of the next target kernel parameter configuration combination will be stopped. At this time, it is considered that the kernel parameter configuration has reached a better state, and the current target kernel parameter configuration combination is the optimal kernel parameter configuration combination.
[0112] It is understandable that in order to reduce the parameter search space, this paper adopts the strategy of variable discretization, setting different variable intervals according to different kernel parameter variables. For example, for percentage-type variables, different discrete intervals of 30%, 60%, and 90% are set, and then the discretized different kernel parameter variables are normalized, and the processed kernel parameter combination is used as the search value.
[0113] It should be understood that in order to verify and analyze the effect of automatic kernel parameter configuration, two typical database applications, Redis and PostgreSQL, were selected. PostgreSQL is a typical relational database storage, while Redis is a typical KV type database storage. Because the database itself is a typical memory-intensive application, they are also particularly sensitive to the adjustment of kernel parameters. The effect of kernel cache parameters is tuned through the application's task completion time indicator, and the application's task completion time can be obtained from the Redis info command or PostgreSQL's monitoring data table. The parameter configuration for the next search is obtained every 5 minutes based on the task completion time, and the kernel cache parameters are reconfigured after the parameter search is completed. The verification results are as follows: Figure 7As shown in the figure, after kernel parameter tuning, the application throughput increased by about 10-20% compared with the original default kernel parameters. At this time, on the working node, in addition to the two applications, there are also programs that consume memory resources, which will occupy the remaining memory space on the working node to the greatest extent. Therefore, under the premise of limited memory resources, automatic kernel parameter configuration can capture some characteristics of the application in using memory cache, thereby helping the application improve performance.
[0114] In this embodiment, initial search data is obtained, the initial search data is input into the configuration optimization model to obtain initial configuration output data, initial configuration target data is determined based on the initial configuration output data, and current search data is determined based on the initial configuration target data, current search data is input into the configuration optimization model to obtain current configuration output data, and current configuration target data is determined based on the current configuration output data, minimum configuration target data is determined based on the current configuration target data and the initial configuration target data, a target kernel parameter configuration combination is determined based on the minimum configuration target data, and kernel parameter configuration is adjusted based on the target kernel parameter configuration combination. This embodiment proposes a kernel parameter configuration search strategy based on the Bayesian optimization idea, which uses the characteristics of the Bayesian algorithm that will eventually converge to the global optimal solution on the basis of ensuring a sufficient number of iterations, and uses the kernel system parameters as variables to obtain the optimal parameter configuration results, so as to realize automatic kernel parameter configuration, and can determine the optimal parameter configuration under different application loads and different machine conditions, which can optimize the time consumption of application startup and data acquisition, and reduce the interference of the on-demand loading mechanism on the application runtime performance.
[0115] In addition, an embodiment of the present invention further proposes a storage medium, on which a container deployment optimization program is stored. When the container deployment optimization program is executed by a processor, the steps of the container deployment optimization method described above are implemented.
[0116] Reference Figure 8 , Figure 8 This is a structural block diagram of the first embodiment of the container deployment optimization device of the present invention.
[0117] like Figure 8 As shown, the container deployment optimization device proposed in the embodiment of the present invention includes:
[0118] The acquisition module 10 is used to acquire the number of repeated read and write times of the mirror data, and determine the hotspot data based on the number of repeated read and write times.
[0119] The updating module 20 is used to determine the hotspot cache page based on the hotspot data.
[0120] The updating module 20 is also used to move the hotspot cache page to the head position of the memory linked list.
[0121] In this embodiment, by obtaining the number of repeated read and write times of the mirror data, the hotspot data is determined based on the number of repeated read and write times, and the hotspot cache page is determined based on the hotspot data, and the hotspot cache page is moved to the head position of the memory list. Since the on-demand loading mechanism is used in the application container deployment scenario, it will interfere with the startup speed and runtime performance of the application. This embodiment uses hotspot data to update the memory cache page, ensuring that the hotspot cache page where the hotspot data is located is always at the head of the memory list, so that the hotspot cache page resides in the kernel for a longer time, giving priority to hotspot page hits, optimizing the time consumed by the application startup and operation to obtain data, and will not affect the pages occupied by other programs in the memory.
[0122] In one embodiment, the update module 20 is further used to move the hotspot cache page to the head position of the memory linked list based on a preset manual access strategy;
[0123] The preset manual access strategy includes:
[0124] The hotspot cache page is marked as a recently accessed page, and the number of repeated reads and writes corresponding to the hotspot data in the hotspot cache page is reduced by a preset amount.
[0125] In one embodiment, the update module 20 is further used to obtain block device information and starting sector information of the cache page;
[0126] Based on the block device information and the starting sector information, determining the index node information and the file offset corresponding to the cache page;
[0127] Based on the index node information and the file offset, query whether there is a cache-compliant page in the kernel's page hash table;
[0128] When there is a matching cache page, the matching cache page is determined to be the hotspot cache page.
[0129] In one embodiment, the acquisition module 10 is further used to acquire the read and write information of the block device layer within a preset period;
[0130] According to a preset size, the read and write information of the block device layer is summarized to obtain the summarized read and write information;
[0131] The summary read and write information is mapped to the hash bucket of the kernel, and statistical analysis is performed to obtain the number of repeated read and write times of the mirror data.
[0132] In one embodiment, the container deployment optimization device further includes a configuration module 30, wherein the configuration module 30 is used to establish a configuration optimization model based on a kernel parameter configuration combination;
[0133] Based on the configuration optimization model, a target kernel parameter configuration combination is determined, and the kernel parameter configuration is adjusted according to the target kernel parameter configuration combination.
[0134] In one embodiment, the configuration module 30 is further used to determine a plurality of kernel parameter configuration combinations based on preset kernel parameters, and determine the task completion time corresponding to each kernel parameter configuration combination;
[0135] Combining the plurality of kernel parameter configuration combinations with corresponding task completion times to obtain a plurality of configuration data;
[0136] The plurality of configuration data are input into a preset fitting model to obtain the configuration optimization model.
[0137] In one embodiment, the configuration module 30 is further used to obtain initial search data, input the initial search data into the configuration optimization model, and obtain initial configuration output data;
[0138] Determining initial configuration target data based on the initial configuration output data, and determining current search data according to the initial configuration target data;
[0139] Inputting the current search data into the configuration optimization model to obtain current configuration output data, and determining current configuration target data according to the current configuration output data;
[0140] Determining minimum configuration target data according to the current configuration target data and the initial configuration target data;
[0141] Based on the minimum configuration target data, determine a target kernel parameter configuration combination, and adjust the kernel parameter configuration according to the target kernel parameter configuration combination;
[0142] When the preset completion condition is not met, the initial configuration target data is updated to the minimum configuration target data, and the step of determining the current search data according to the initial configuration target data is returned to be executed.
[0143] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.
[0144] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0145] In addition, for technical details not fully described in this embodiment, reference can be made to the container deployment optimization method provided in any embodiment of the present invention, and will not be repeated here.
[0146] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0147] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0148] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0149] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A container deployment optimization method, characterized in that: The container deployment optimization method comprises: Obtaining the number of repeated read and write times of the mirrored data, and determining the hotspot data based on the number of repeated read and write times; Based on the hotspot data, determine a hotspot cache page; Move the hotspot cache page to the head position of the memory linked list.
2. The method according to claim 1, characterized in that Placing the hotspot cache page at the head position of a memory linked list includes: Based on a preset manual access strategy, the hotspot cache page is moved to the head position of the memory linked list; The preset manual access strategy includes: The hotspot cache page is marked as a recently accessed page, and the number of repeated reads and writes corresponding to the hotspot data in the hotspot cache page is reduced by a preset amount.
3. The method according to claim 1, characterized in that The step of determining a hotspot cache page based on the hotspot data includes: Get the block device information and starting sector information of the cache page; Based on the block device information and the starting sector information, determining the index node information and the file offset corresponding to the cache page; Based on the index node information and the file offset, query whether there is a cache-compliant page in the kernel's page hash table; When there is a matching cache page, the matching cache page is determined to be the hotspot cache page.
4. The method according to claim 1, characterized in that The obtaining of the number of repeated read and write times of the mirror data includes: Get the read and write information of the block device layer within a preset period; According to a preset size, the read and write information of the block device layer is summarized to obtain the summarized read and write information; The summary read and write information is mapped to the hash bucket of the kernel, and statistical analysis is performed to obtain the number of repeated read and write times of the mirror data.
5. The method according to any one of claims 1 to 4, characterized in that: The container deployment optimization method further includes: Based on the kernel parameter configuration combination, a configuration optimization model is established; Based on the configuration optimization model, a target kernel parameter configuration combination is determined, and the kernel parameter configuration is adjusted according to the target kernel parameter configuration combination.
6. The method according to claim 5, characterized in that The configuration optimization model is established based on the kernel parameter configuration combination, including: Based on the preset kernel parameters, multiple kernel parameter configuration combinations are determined, and the task completion time corresponding to each kernel parameter configuration combination is determined; Combining the plurality of kernel parameter configuration combinations with corresponding task completion times to obtain a plurality of configuration data; The plurality of configuration data are input into a preset fitting model to obtain the configuration optimization model.
7. The method according to claim 5, characterized in that The step of determining a target kernel parameter configuration combination based on the configuration optimization model, and adjusting the kernel parameter configuration according to the target kernel parameter configuration combination includes: Acquire initial search data, input the initial search data into the configuration optimization model, and obtain initial configuration output data; Determining initial configuration target data based on the initial configuration output data, and determining current search data according to the initial configuration target data; Inputting the current search data into the configuration optimization model to obtain current configuration output data, and determining current configuration target data according to the current configuration output data; Determining minimum configuration target data according to the current configuration target data and the initial configuration target data; Based on the minimum configuration target data, determine a target kernel parameter configuration combination, and adjust the kernel parameter configuration according to the target kernel parameter configuration combination; When the preset completion condition is not met, the initial configuration target data is updated to the minimum configuration target data, and the step of determining the current search data according to the initial configuration target data is returned to be executed.
8. A container deployment optimization device, characterized in that: The container deployment optimization device comprises: An acquisition module, used to acquire the number of repeated read and write times of the mirror data, and determine the hot data based on the number of repeated read and write times; An update module, used to determine a hotspot cache page based on the hotspot data; The update module is also used to move the hotspot cache page to the head position of the memory linked list.
9. A container deployment optimization device, characterized in that: The device comprises: a memory, a processor, and a container deployment optimization program stored in the memory and executable on the processor, wherein the container deployment optimization program is configured to implement the steps of the container deployment optimization method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a container deployment optimization program, and when the container deployment optimization program is executed by the processor, the steps of the container deployment optimization method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Memory management method, electronic equipment and related device
CN121542017A
