Micro-service memory allocation method and device, equipment, medium and product

By obtaining the historical performance indicators and correlation characteristics of microservices, and dynamically adjusting memory allocation using prediction models and optimization models, the problem of low memory utilization of microservices is solved, and resource utilization is improved and memory overflow is avoided.

CN118916161APending Publication Date: 2024-11-08NANJING HUADUN ELECTRIC POWER INFORMATION SAFETY EVALUATION CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410970638.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

Existing microservice memory management methods are difficult to dynamically adapt to load changes, resulting in low memory utilization, slow request response speed, and even memory overflow problems.

Method used

By obtaining the historical performance indicators of microservices, determining the correlation characteristics between indicator items, and predicting and optimizing models based on pre-trained performance indicators, dynamically adjusting memory allocation to ensure the rational utilization of memory requirements.

Benefits of technology

It improves the resource utilization rate of microservices, avoids memory overload and resource waste, and ensures the stability of system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916161A_ABST
    Figure CN118916161A_ABST
Patent Text Reader

Abstract

The invention discloses a micro-service memory allocation method and device, electronic equipment, a storage medium and a program product. The method comprises the following steps: acquiring a performance index of a micro-service historical period; determining correlation characteristics among the index items according to the performance indexes of the historical period; wherein the correlation characteristics comprise the correlation of every two index items in the index items; determining a prediction result of the current periodic performance index based on a pre-trained performance index prediction model according to the performance index of the historical period; and determining a memory allocation result of the micro-service based on a preset optimization model according to the prediction result, the correlation characteristics and pre-acquired performance index limitation information. According to the technical scheme, the problem that the micro-service memory utilization rate is low is solved, the memory demand is estimated by predicting the performance index of the micro-service, the conditions of memory overload and resource waste are avoided, and the resource utilization rate is improved while the micro-service performance is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer application technology, and in particular to a microservice memory allocation method, device, electronic device, storage medium and program product. Background Art

[0002] With the widespread application of microservice architecture in distributed systems, how to efficiently manage and allocate memory resources has become an important challenge for system performance optimization.

[0003] Currently, existing memory management methods are usually difficult to dynamically adapt to changes in microservice loads, resulting in low memory utilization, slow request response, and even serious problems such as memory overflow.

[0004] Therefore, in order to solve the above problems, there is an urgent need for a microservice memory allocation method that can dynamically predict memory requirements and improve resource utilization efficiency based on the actual operation of the microservice. Summary of the invention

[0005] The present invention provides a microservice memory allocation method, device, electronic device, storage medium and program product to solve the problem of low memory utilization of microservices. By predicting the performance indicators of microservices, the memory demand is estimated, memory overload and resource waste are avoided, which is conducive to improving resource utilization while ensuring the performance of microservices.

[0006] According to one aspect of the present invention, a microservice memory allocation method is provided, the method comprising:

[0007] Obtaining performance indicators of the microservice historical period; wherein the performance indicators include multiple indicator items, each indicator item is memory usage, processor utilization, average response time and response error rate;

[0008] Determine the correlation characteristics between the indicator items according to the performance indicators of the historical period; wherein the correlation characteristics include the correlation between every two indicator items in each indicator item;

[0009] According to the performance indicators of the historical period, based on the pre-trained performance indicator prediction model, the prediction results of the performance indicators of the current period are determined;

[0010] According to the prediction result, the correlation feature and the pre-acquired performance indicator restriction information, based on a preset optimization model, a memory allocation result of the microservice is determined.

[0011] According to another aspect of the present invention, a microservice memory allocation device is provided, the device comprising:

[0012] An indicator acquisition module is used to obtain performance indicators of the microservice historical period; wherein the performance indicators include multiple indicator items, each of which is memory usage, processor utilization, average response time and response error rate;

[0013] A correlation determination module, used to determine the correlation characteristics between the indicator items according to the performance indicators of the historical period; wherein the correlation characteristics include the correlation between every two indicator items in each indicator item;

[0014] A prediction result determination module is used to determine the prediction result of the performance indicator of the current period based on the performance indicator of the historical period and the pre-trained performance indicator prediction model;

[0015] The allocation result determination module is used to determine the memory allocation result of the microservice based on the preset optimization model according to the prediction result, the correlation characteristics and the pre-acquired performance indicator restriction information.

[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0017] At least one processor; and a memory in communication with the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the microservice memory allocation method described in any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the microservice memory allocation method described in any embodiment of the present invention when executed.

[0019] According to another aspect of the present invention, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the microservice memory allocation method according to any embodiment of the present invention is implemented.

[0020] The technical solution of the embodiment of the present invention obtains the performance indicators of the historical period of the microservice, determines the correlation characteristics between the various indicator items according to the performance indicators of the historical period, and then determines the prediction results of the performance indicators of the current period based on the performance indicators of the historical period and the pre-trained performance indicator prediction model, and then determines the memory allocation results of the microservice based on the preset optimization model according to the prediction results, the correlation characteristics and the pre-acquired performance indicator restriction information. This technical solution solves the problem of low memory utilization of microservices, and estimates the memory demand by predicting the performance indicators of microservices, avoiding memory overload and resource waste, which is conducive to improving resource utilization while ensuring the performance of microservices.

[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.

[0023] Figure 1 This is a flowchart of a microservice memory allocation method provided according to Embodiment 1 of the present invention;

[0024] Figure 2 This is a flowchart of a microservice memory allocation method provided according to Embodiment 2 of the present invention;

[0025] Figure 3 This is a schematic diagram of the structure of a microservice memory allocation device provided according to Embodiment 3 of the present invention;

[0026] Figure 4 It is a structural schematic diagram of an electronic device for implementing the microservice memory allocation method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. The acquisition, storage, use, processing, etc. of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.

[0029] Embodiment 1

[0030] Figure 1 A flowchart of a microservice memory allocation method is provided for the first embodiment of the present invention. This embodiment is applicable to the hardware resource management scenario of microservices. The method can be executed by a microservice memory allocation device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0031] S110, obtaining performance indicators of a microservice historical period; wherein the performance indicators include multiple indicator items, each indicator item is a memory usage rate, a processor utilization rate, an average response time, and a response error rate.

[0032] This solution can be executed by the memory management system of the microservice. The memory management system can obtain the performance indicators of the microservice historical cycle. The performance indicators of the historical cycle can be performance indicators collected in multiple cycles before the current cycle. The performance indicators can include multiple indicators such as memory usage, processor utilization, average response time, and response error rate.

[0033] S120. Determine the correlation characteristics between the indicator items according to the performance indicators of the historical period; wherein the correlation characteristics include the correlation between every two indicator items in the indicator items.

[0034] The memory management system can extract the value of each indicator item from the performance indicators of the historical period, and use the value of the same indicator item in each historical period as the feature vector of the indicator item. The correlation between the feature vectors of every two indicator items is calculated in sequence to obtain the correlation characteristics between the indicator items.

[0035] S130: Determine the prediction result of the performance indicator of the current period according to the performance indicator of the historical period and based on the pre-trained performance indicator prediction model.

[0036] The memory management system can use the performance indicators of the historical period as the input of the performance indicator prediction model, and the performance indicator prediction model can output the prediction results of the performance indicators of the current period. Specifically, the performance indicator prediction model is a time series prediction model, which can be built based on deep learning algorithms, such as the autoregressive moving average model (ARIMA, Autoregressive Integrated Moving Average Model), long short-term memory network (LSTM, Long Short-Term Memory), time fusion transformer (TFT, Temporal Fusion Transformer) and Prophet algorithms.

[0037] S140. Determine a memory allocation result for the microservice based on a preset optimization model according to the prediction result, the correlation feature, and the pre-acquired performance indicator restriction information.

[0038] The memory management system may obtain performance indicator limitation information input by a user, where the performance indicator limitation information may include a memory utilization upper limit, a processor utilization upper limit, an average response time upper limit, and a response error rate upper limit.

[0039] After obtaining the performance indicator prediction results of the current cycle, the correlation characteristics between the various indicator items, and the performance indicator restriction information, the memory management system can generate an objective function based on the performance indicator prediction results of the current cycle, and determine the constraints based on the correlation characteristics between the various indicator items and the performance indicator restriction information. According to the objective function and the constraints, based on the optimization model, the minimum memory allocation amount of the microservice is determined, and the minimum optimal memory allocation amount is used as the memory allocation result of the microservice. Among them, the objective function can be used to characterize the correlation between the memory allocation amount and each indicator item. The optimization model can be a genetic algorithm, a particle swarm optimization algorithm, a simulated annealing algorithm, etc.

[0040] The technical solution of the embodiment of the present invention obtains the performance indicators of the historical period of the microservice, determines the correlation characteristics between the various indicator items according to the performance indicators of the historical period, and then determines the prediction results of the performance indicators of the current period based on the performance indicators of the historical period and the pre-trained performance indicator prediction model, and then determines the memory allocation results of the microservice based on the preset optimization model according to the prediction results, the correlation characteristics and the pre-acquired performance indicator restriction information. This technical solution solves the problem of low memory utilization of microservices, and estimates the memory demand by predicting the performance indicators of microservices, avoiding memory overload and resource waste, which is conducive to improving resource utilization while ensuring the performance of microservices.

[0041] Embodiment 2

[0042] Figure 2 This is a flowchart of a microservice memory allocation method provided in Embodiment 2 of the present invention. This embodiment refines the above embodiment. Figure 2 As shown, the method includes:

[0043] S201. Obtain performance indicators of the microservice according to a preset collection period through a performance collection tool pre-configured in the microservice, and store the performance indicators in a time series database.

[0044] In this solution, a performance collection tool, such as a Prometheus node exporter, can be configured in the microservice. The memory management system can use the performance collection tool to collect the performance indicators of the microservice according to the preset collection cycle and store the performance indicators in the time series database.

[0045] S202: Using a data migration tool, according to a preset migration cycle, migrate the performance indicator from the time series database to the relational database.

[0046] Microservices can also be configured with data migration tools, such as Victoria Metrics or Thanos. The memory management system can use data migration tools to migrate performance indicators stored in time series from the time series database to the relational database according to the preset migration cycle.

[0047] S203: Take multiple collection periods before the current period as historical periods, and extract performance indicators of the historical periods from the relational database.

[0048] The memory management system can use multiple collection cycles before the current cycle as historical cycles and directly extract performance indicators of the historical cycles in the relational database.

[0049] S204. Extracting the matching feature vectors of each indicator item from the performance indicators of the historical period.

[0050] The memory management system can extract the value of each indicator item from the performance indicators of the historical period, and use the value of the same indicator item in each historical period as the feature vector of the indicator item.

[0051] S205 . According to the feature vectors matched by each indicator item, based on the Pearson correlation calculation method, the correlation between every two indicator items in each indicator item is calculated in turn to obtain the correlation feature.

[0052] After obtaining the feature vector corresponding to each indicator item, the memory management system can calculate the correlation between every two indicator items in each indicator item in turn based on the Pearson correlation calculation method. Specifically, the Pearson correlation calculation method can be expressed as: Among them, x represents the eigenvector of one indicator item, y represents the eigenvector of another indicator item, cov(x,y) represents the covariance of eigenvector x and eigenvector y, σx represents the standard deviation of eigenvector x, and σy represents the standard deviation of eigenvector y.

[0053] S206. Determine the trend characteristics, seasonal characteristics, holiday characteristics, and error characteristics of each indicator item based on the performance indicators of the historical period.

[0054] The memory management system can perform feature extraction on the performance indicators of the historical period to obtain the trend characteristics, seasonal characteristics, holiday characteristics and error characteristics of each indicator item. Specifically, the memory management system can extract the trend characteristics of each indicator item in the performance indicators of the historical period according to the preset time length. According to the period associated with each season, the memory management system can extract the seasonal characteristics of each indicator item in the performance indicators of the historical period. According to the period associated with each holiday, the memory management system can extract the holiday characteristics of each indicator item in the performance indicators of the historical period. The memory management system can determine the performance indicators of the next period of a period in the historical period based on the performance indicator prediction model. According to the performance indicators actually obtained in the historical period and the performance indicators predicted based on the performance indicator prediction model, the memory management system can determine the error characteristics of each indicator item.

[0055] S207. According to the trend characteristics, seasonal characteristics, holiday characteristics, and error characteristics of each indicator item, based on the pre-trained Prophet model, determine the performance indicators of the current period and the confidence level of the performance indicators.

[0056] The trend characteristics, seasonal characteristics, holiday characteristics and error characteristics of each indicator item are used as the input of the Prophet model. The memory management system can determine the performance indicators of the current period and the confidence of the performance indicators according to the output of the Prophet model. Specifically, the Prophet model can be expressed as: y(t) = g(t) + s(t) + h(t) + ∈(t); where t represents the period, y(t) represents the indicator item in the performance indicator of the current period, g(t) represents the trend characteristics of the indicator item, s(t) represents the seasonal characteristics of the indicator item, h(t) represents the holiday characteristics of the indicator item, and ∈(t) represents the error characteristics of the indicator item.

[0057] S208: Determine an objective function according to the prediction result.

[0058] In this solution, the objective function can be expressed as:

[0059] y=w1×a+w2×b+w3×c+w4×d;

[0060] a represents the memory usage of the current cycle in the prediction result, b represents the processor utilization of the current cycle in the prediction result, c represents the average response time of the current cycle in the prediction result, d represents the response error rate of the current cycle in the prediction result, y represents the memory usage, and w1, w2, w3 and w4 represent the weight coefficients of a, b, c and d respectively.

[0061] S209: Determine constraint conditions according to the correlation characteristics and pre-acquired performance indicator restriction information.

[0062] It can be understood that the correlation feature can characterize the association between every two indicator items in each indicator item, thereby constituting a constraint between each indicator item. The performance indicator restriction information can be used to limit the upper or lower limit value of each indicator item, that is, to give the feasible domain of each indicator item. Therefore, by using the correlation feature and the performance indicator restriction information as the constraint conditions of the objective function, the optimal solution for the microservice memory allocation can be solved.

[0063] S210: Determine a memory allocation result of a microservice according to the objective function and the constraint conditions and based on a preset optimization model.

[0064] Based on the optimization model, the memory management system can determine the minimum value of the objective function under the constraints, that is, the minimum value of the memory allocation of the microservice. The minimum value of the memory allocation is used as the memory allocation result of the microservice.

[0065] In a preferred solution, after determining the prediction result of the performance indicator of the current period, the method further includes:

[0066] Obtain the performance indicators of the current cycle of the microservice through the performance collection tool pre-configured in the microservice;

[0067] Determining a memory adjustment amount according to the performance indicator and the prediction result and based on a preset control model;

[0068] After determining the memory allocation result of the microservice, the method further includes:

[0069] The microservice memory is adjusted according to the memory allocation result and the memory adjustment amount.

[0070] It is easy to understand that the memory management system can obtain the performance indicators of the current cycle of the microservice, that is, the actual performance indicators, through the performance collection tool. The memory management system can use the prediction results as the predicted performance indicators, and determine the prediction error by comparing the actual performance indicators with the predicted performance indicators. The prediction error is input into the preset control model, such as the PID control algorithm, to determine the memory adjustment amount, so as to achieve smooth adjustment of the microservice memory amount, gradually tend to the memory allocation result of the microservice, so as to maximize resource utilization.

[0071] The technical solution of the embodiment of the present invention obtains the performance indicators of the historical period of the microservice, determines the correlation characteristics between the various indicator items according to the performance indicators of the historical period, and then determines the prediction results of the performance indicators of the current period based on the performance indicators of the historical period and the pre-trained performance indicator prediction model, and then determines the memory allocation results of the microservice based on the preset optimization model according to the prediction results, the correlation characteristics and the pre-acquired performance indicator restriction information. This technical solution solves the problem of low memory utilization of microservices, and estimates the memory demand by predicting the performance indicators of microservices, avoiding memory overload and resource waste, which is conducive to improving resource utilization while ensuring the performance of microservices.

[0072] Embodiment 3

[0073] Figure 3 This is a schematic diagram of the structure of a microservice memory allocation device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device comprises:

[0074] The indicator acquisition module 310 is used to obtain the performance indicators of the microservice historical period; wherein the performance indicators include multiple indicator items, each indicator item is a memory usage rate, a processor utilization rate, an average response time, and a response error rate;

[0075] A correlation determination module 320 is used to determine the correlation characteristics between the indicator items according to the performance indicators of the historical period; wherein the correlation characteristics include the correlation between every two indicator items in each indicator item;

[0076] A prediction result determination module 330 is used to determine the prediction result of the performance indicator of the current period based on the performance indicator of the historical period and the pre-trained performance indicator prediction model;

[0077] The allocation result determination module 340 is used to determine the memory allocation result of the microservice based on the preset optimization model according to the prediction result, the correlation feature and the pre-acquired performance indicator restriction information.

[0078] In this solution, the indicator acquisition module 310 is specifically used to:

[0079] By using a performance collection tool pre-configured in the microservice, the performance indicators of the microservice are obtained according to a preset collection cycle, and the performance indicators are stored in a time series database;

[0080] Using a data migration tool, according to a preset migration cycle, the performance indicator is migrated from the time series database to the relational database;

[0081] A plurality of collection periods before the current period are taken as historical periods, and performance indicators of the historical periods are extracted from the relational database.

[0082] In a feasible solution, the correlation determination module 320 is specifically used to:

[0083] From the performance indicators of the historical period, extract the matching feature vectors of each indicator item;

[0084] According to the feature vectors matched by each indicator item, based on the Pearson correlation calculation method, the correlation between every two indicator items in each indicator item is calculated in turn to obtain the correlation feature.

[0085] In this embodiment, the performance indicator prediction model is constructed based on the Prophet model; the Prophet model includes a trend term, a seasonal term, a holiday term, and an error term; the prediction result includes the performance indicator of the current period and the confidence level of the performance indicator;

[0086] The prediction result determination module 330 is specifically used for:

[0087] According to the performance indicators of the historical period, determine the trend characteristics, seasonal characteristics, holiday characteristics and error characteristics of each indicator item;

[0088] According to the trend characteristics, seasonal characteristics, holiday characteristics and error characteristics of each indicator item, based on the pre-trained Prophet model, the performance indicators of the current period and the confidence level of the performance indicators are determined.

[0089] Optionally, the allocation result determination module 340 is specifically configured to:

[0090] Determining an objective function according to the prediction result;

[0091] Wherein, the objective function is:

[0092] y=w1×a+w2×b+w3×c+w4×d;

[0093] a represents the memory usage of the current cycle in the prediction result, b represents the processor utilization of the current cycle in the prediction result, c represents the average response time of the current cycle in the prediction result, d represents the response error rate of the current cycle in the prediction result, y represents the memory usage, w1, w2, w3 and w4 represent the weight coefficients of a, b, c and d respectively;

[0094] Determining constraint conditions according to the correlation characteristics and pre-acquired performance indicator restriction information;

[0095] According to the objective function and the constraint conditions, based on a preset optimization model, a memory allocation result of the microservice is determined.

[0096] In a preferred embodiment, the device is also used for:

[0097] After determining the prediction results of the performance indicators of the current cycle, the performance indicators of the microservice in the current cycle are obtained through the performance collection tool pre-configured in the microservice;

[0098] Determining a memory adjustment amount according to the performance indicator and the prediction result and based on a preset control model;

[0099] After determining the memory allocation result of the microservice, the microservice memory is adjusted according to the memory allocation result and the memory adjustment amount.

[0100] The microservice memory allocation device provided in the embodiment of the present invention can execute the microservice memory allocation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0101] Embodiment 4

[0102] Figure 4A schematic diagram of an electronic device 410 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0103] like Figure 4 As shown, the electronic device 410 includes at least one processor 411, and a memory connected to the at least one processor 411 in communication, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 411 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or the computer program loaded from the storage unit 418 to the random access memory (RAM) 413. In the RAM 413, various programs and data required for the operation of the electronic device 410 can also be stored. The processor 411, the ROM 412, and the RAM 413 are connected to each other via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0104] Multiple components in the electronic device 410 are connected to the I / O interface 415, including: an input unit 416, such as a keyboard, a mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a disk, an optical disk, etc.; and a communication unit 419, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 419 allows the electronic device 410 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0105] The processor 411 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 411 executes the various methods and processes described above, such as a microservice memory allocation method.

[0106] In some embodiments, the microservice memory allocation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 410 via the ROM 412 and / or the communication unit 419. When the computer program is loaded into the RAM 413 and executed by the processor 411, one or more steps of the microservice memory allocation method described above may be performed. Alternatively, in other embodiments, the processor 411 may be configured to execute the microservice memory allocation method in any other appropriate manner (e.g., by means of firmware).

[0107] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0108] The computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable microservice memory allocation device, so that when the computer programs are executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0109] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0110] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0111] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0112] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0113] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0114] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A microservice memory allocation method, characterized in that: The method comprises: Obtaining performance indicators of the microservice historical period; wherein the performance indicators include multiple indicator items, each indicator item is memory usage, processor utilization, average response time and response error rate; Determine the correlation characteristics between the indicator items according to the performance indicators of the historical period; wherein the correlation characteristics include the correlation between every two indicator items in each indicator item; According to the performance indicators of the historical period, based on the pre-trained performance indicator prediction model, the prediction results of the performance indicators of the current period are determined; According to the prediction result, the correlation feature and the pre-acquired performance indicator restriction information, based on a preset optimization model, a memory allocation result of the microservice is determined.

2. The method according to claim 1, characterized in that: The performance indicators of the microservice historical period are obtained, including: By using a performance collection tool pre-configured in the microservice, the performance indicators of the microservice are obtained according to a preset collection period, and the performance indicators are stored in a time series database; Using a data migration tool, according to a preset migration cycle, the performance indicator is migrated from the time series database to the relational database; A plurality of collection periods before the current period are taken as historical periods, and performance indicators of the historical periods are extracted from the relational database.

3. The method according to claim 1, characterized in that Based on the performance indicators of the historical period, determine the correlation characteristics between the indicators, including: From the performance indicators of the historical period, extract the matching feature vectors of each indicator item; According to the feature vectors matched by each indicator item, based on the Pearson correlation calculation method, the correlation between every two indicator items in each indicator item is calculated in turn to obtain the correlation feature.

4. The method according to claim 1, characterized in that: The performance indicator prediction model is constructed based on the Prophet model; the Prophet model includes a trend term, a seasonal term, a holiday term, and an error term; the prediction result includes the performance indicator of the current period and the confidence level of the performance indicator; The method of determining the prediction result of the performance indicator of the current period based on the performance indicator of the historical period and the pre-trained performance indicator prediction model includes: According to the performance indicators of the historical period, determine the trend characteristics, seasonal characteristics, holiday characteristics and error characteristics of each indicator item; According to the trend characteristics, seasonal characteristics, holiday characteristics and error characteristics of each indicator item, based on the pre-trained Prophet model, the performance indicators of the current period and the confidence level of the performance indicators are determined.

5. The method according to claim 1, characterized in that Determining the memory allocation result of the microservice based on the prediction result, the correlation feature, and the pre-acquired performance indicator restriction information and a preset optimization model includes: Determining an objective function according to the prediction result; Wherein, the objective function is: y=w1×a+w2×b+w3×c+w4×d; a represents the memory usage of the current cycle in the prediction result, b represents the processor utilization of the current cycle in the prediction result, c represents the average response time of the current cycle in the prediction result, d represents the response error rate of the current cycle in the prediction result, y represents the memory usage, w1, w2, w3 and w4 represent the weight coefficients of a, b, c and d respectively; Determining constraint conditions according to the correlation characteristics and pre-acquired performance indicator restriction information; According to the objective function and the constraint conditions, based on a preset optimization model, a memory allocation result of the microservice is determined.

6. The method according to claim 1, characterized in that After determining the prediction result of the performance indicator of the current period, the method further includes: Obtain the performance indicators of the current cycle of the microservice through the performance collection tool pre-configured in the microservice; Determining a memory adjustment amount according to the performance indicator and the prediction result and based on a preset control model; After determining the memory allocation result of the microservice, the method further includes: The microservice memory is adjusted according to the memory allocation result and the memory adjustment amount.

7. A microservice memory allocation device, characterized in that: The device comprises: An indicator acquisition module is used to obtain performance indicators of the microservice historical period; wherein the performance indicators include multiple indicator items, each of which is memory usage, processor utilization, average response time and response error rate; A correlation determination module, used to determine the correlation characteristics between the indicator items according to the performance indicators of the historical period; wherein the correlation characteristics include the correlation between every two indicator items in each indicator item; A prediction result determination module is used to determine the prediction result of the performance indicator of the current period based on the performance indicator of the historical period and the pre-trained performance indicator prediction model; The allocation result determination module is used to determine the memory allocation result of the microservice based on the preset optimization model according to the prediction result, the correlation characteristics and the pre-acquired performance indicator restriction information.

8. An electronic device, characterized in that: The electronic device comprises: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the microservice memory allocation method described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the microservice memory allocation method according to any one of claims 1 to 6 when executed.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the microservice memory allocation method according to any one of claims 1 to 6.

Citation Information

Cited By

  • Memory management method and device, computer equipment and storage medium

    CN119576545A

  • Memory optimization method, model training method, device, equipment and vehicle

    CN120233957A

  • Memory optimization method, model training method, device, equipment and vehicle

    CN120233957B