Memory configuration method and device, electronic equipment and storage medium

Through cyclical acquisition and analysis of the memory usage data on the preset instructions on the independent station platform, dynamically adjust the memory configuration, solve the problem of insufficient memory or waste, and improve the accuracy and efficiency of memory configuration.

CN119376944APending Publication Date: 2025-01-28GUANGZHOU OVERSEAS KANGBAZI NETWORK TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411518921.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

In an Internet platform based on independent stations, the pre-set memory size cannot be adjusted dynamically, resulting in problems such as insufficient memory or waste of memory when executing instructions.

Method used

The memory value of the preset instruction during the execution is determined through the periodic obtaining the preset instructions, and the current trend of memory use is determined, and the default internal deposit value is updated according to the preset period and instruction information to dynamically adjust the memory configuration.

Benefits of technology

Effectively avoid the problem of insufficient memory or memory waste, improve the accuracy and efficiency of memory configuration, and ensure the stability of the instruction execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The invention provides a memory configuration method and device, electronic equipment and a storage medium, the memory configuration method comprises the following steps: periodically obtaining a first memory value corresponding to a preset instruction in an execution process to obtain a plurality of first memory values, the first memory values being used for representing a memory occupied by the preset instruction in the execution process; determining a second memory value from the plurality of first memory values according to a preset time period; determining a third memory value of the preset instruction according to the second memory value; and according to the third memory value, updating a default memory value which is preset in the electronic equipment and is used for executing the preset instruction. The invention relates to the technical field of independent stations, and can improve the accuracy of memory configuration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of independent station technology, and in particular to a memory configuration method, device, electronic device and storage medium. Background Art

[0002] Independent websites are new official websites built on the SaaS technology platform with independent domain names, content, data, and private rights. Therefore, independent websites are autonomous, unique, and highly free. Each merchant can build his or her own independent website according to his or her needs, thereby building his or her own online store and performing personalized design and operation.

[0003] At present, Internet platforms based on independent stations can receive and respond to requests sent by users and provide corresponding services to users. For example, cross-border e-commerce can provide commodity trading services with the help of independent stations. In e-commerce platforms based on independent stations, data analysis services can be provided to users by processing instructions submitted by users. In order to ensure that the instructions submitted by users can be executed successfully, it is usually necessary to pre-set the memory size used to run the instructions. However, in the related art, after the memory size is set, the memory size always remains unchanged. Therefore, in actual applications, it is easy to cause technical problems such as insufficient memory or memory waste. Summary of the invention

[0004] In view of the above, it is necessary to propose a memory configuration method, device, electronic device and storage medium to solve the technical problem of insufficient memory or memory waste when executing instructions on the Internet platform.

[0005] The present application provides a memory configuration method, which is applied to an electronic device, and the method includes: periodically acquiring a first memory value corresponding to a preset instruction during execution to obtain multiple first memory values, wherein the first memory value is used to characterize the memory occupied by the preset instruction during execution; determining a second memory value from the multiple first memory values ​​based on a preset time period; determining a third memory value of the preset instruction based on the second memory value; and updating a default memory value preset in the electronic device for executing the preset instruction based on the third memory value.

[0006] In some embodiments, determining the third memory value of the preset instruction based on the second memory value includes: determining the corresponding instruction information based on the instruction type of the preset instruction; determining the coefficient of the preset instruction based on the data volume and parallelism in the instruction information; and determining the third memory value based on the coefficient and the second memory value.

[0007] In some embodiments, determining the third memory value of the preset instruction based on the second memory value includes: determining a second memory value from the multiple first memory values ​​within each preset time period to obtain multiple second memory values; determining the third memory value based on the weight of each preset time period and the multiple second memory values.

[0008] In some embodiments, the method for determining the weight of each preset time period includes: determining the maximum value and the minimum value among multiple first memory values ​​within each preset time period; determining the difference between the maximum value and the minimum value; and normalizing the difference corresponding to each preset time period to obtain the weight of each preset time period.

[0009] In some embodiments, the method for determining the weight of each preset time period includes: determining the variance of multiple first memory values ​​within each preset time period; and normalizing the variance corresponding to each preset time period to obtain the weight corresponding to each preset time period.

[0010] In some embodiments, the method also includes: determining a first timestamp when each first memory value is obtained; constructing first sample data according to the instruction information of the preset instruction and the first timestamp; based on the first sample data, using a pre-constructed initial prediction model, obtaining a first predicted memory value; determining a loss value of the initial prediction model according to the first predicted memory value and the first memory value, and updating the initial prediction model using a back propagation algorithm until the loss value meets the preset conditions to obtain a trained memory prediction model.

[0011] In some embodiments, determining the third memory value of the preset instruction based on the second memory value includes: constructing second sample data based on the instruction information and a second timestamp, the second timestamp representing any moment in the execution process of the preset instruction; based on the second sample data, using the memory prediction model to obtain a second predicted memory value; and determining the third memory value based on the second predicted memory value and the second memory value.

[0012] In some embodiments, determining the second memory value from the plurality of first memory values ​​according to a preset time period includes: determining the largest first memory value within the preset time period as the second memory value.

[0013] An embodiment of the present application also provides a memory configuration device, which includes: an acquisition module, which is used to periodically acquire a first memory value corresponding to a preset instruction during execution, and obtain multiple first memory values, wherein the first memory value is used to characterize the memory occupied by the preset instruction during execution; an analysis module, which is used to determine a second memory value from the multiple first memory values ​​based on a preset time period; the analysis module is also used to determine a third memory value of the preset instruction based on the second memory value; and an execution module, which is used to update a default memory value used to execute the preset instruction based on the third memory value.

[0014] An embodiment of the present application also provides an electronic device, which includes: a memory storing at least one instruction; and a processor executing the instruction stored in the memory to implement the memory configuration method.

[0015] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the memory configuration method is implemented.

[0016] It can be seen from the above technical solutions that in order to determine the changing trend of memory usage during the operation of preset instructions based on historical data during the operation of preset instructions, the embodiment of the present application first periodically obtains the first memory value of the preset instruction during the execution process, so as to provide data support for the subsequent configuration of the memory value of the preset instruction. The second memory value is determined from the first memory value, thereby determining the upper limit of the memory usage during the execution of the preset instruction, and the problem of insufficient memory or memory waste can be avoided when configuring the memory later. The third memory value of the preset instruction is determined based on the second memory value, and the second memory value can be further updated, thereby improving the accuracy of the third memory value, and then the accuracy of the configured memory can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 This is an application scenario diagram of a memory configuration method provided in one embodiment of the present application.

[0018] Figure 2 This is a flowchart of a memory configuration method provided in one embodiment of the present application.

[0019] Figure 3 This is a flowchart of a method for determining a third memory value provided by an embodiment of the present application.

[0020] Figure 4 This is a flowchart of a method for determining a third memory value provided by another embodiment of the present application.

[0021] Figure 5 It is a flowchart of a method for training a memory prediction model provided by an embodiment of the present application.

[0022] Figure 6 It is a flowchart of a method for determining a third memory value based on a memory prediction model provided by an embodiment of the present application.

[0023] Figure 7 This is a flowchart of a method for determining a weight of a preset time period provided by an embodiment of the present application.

[0024] Figure 8 This is a flowchart of a method for determining a weight of a preset time period provided by another embodiment of the present application.

[0025] Fig. 9 It is a functional module diagram of a memory configuration device provided in one embodiment of the present application.

[0026] Fig.10 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to more clearly understand the purpose, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other. In the following description, many specific details are set forth to facilitate a full understanding of the present application, and the embodiments described are only a part of the embodiments of the present application, rather than all of the embodiments.

[0028] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art to which the present application belongs. The terms used herein in the specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0030] An embodiment of the present application provides a memory configuration method, which can be applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA), a digital processor (Digital Signal Processor, DSP), an embedded device, etc.

[0031] An electronic device can be any electronic product that can interact with customers, such as personal computers, tablet computers, smart phones, personal digital assistants (PDAs), game consoles, Internet Protocol Television (IPTV), smart wearable devices, etc.

[0032] The electronic device may also include a network device and / or a client device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.

[0033] The networks where electronic devices are located include but are not limited to the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.

[0034] like Figure 1The figure shows an application scenario diagram of a memory configuration method provided by an embodiment of the present application. A memory configuration method provided by the present application can be applied to an electronic device 100. Among them, the electronic device 100 can be an electronic device such as a computer or server running an independent site. An independent site is a new type of official website with an independent domain name, content, data, and private rights and interests established based on the SaaS technology platform. Therefore, the independent site has autonomy, uniqueness and a high degree of freedom. Each merchant can establish his own independent site according to his own needs, thereby building his own online store and performing personalized design and operation. Users using independent sites input demand information to the electronic device 100 through the display device 110 of the electronic device 100 (for example, a computer display). Among them, the demand information is used to characterize the user's demand for operating the data in the independent site. Exemplarily, when the user is a merchant in an independent site, the demand information can be used to characterize the merchant's demand for querying the sales data of the goods in the independent site. When the user is a consumer in an independent site, the demand information can be used to characterize the consumer's demand for querying the data in the independent site. Specifically, the electronic device 100 determines the corresponding preset instruction according to the demand information, and implements the data operation function that meets the user's needs by executing the preset instruction. For example, the electronic device 100 satisfies the user's need to aggregate and analyze the data in independent sites by executing preset instructions with data aggregation and analysis functions.

[0035] Before executing the preset instruction, the electronic device 100 may also set the memory value used to run the preset instruction, thereby ensuring that the preset instruction can be called normally. Since factors such as the amount of data and the complexity of calculation may change during the process of executing the preset instruction to process data, the electronic device 100 may adjust the memory allocation strategy according to the amount of memory occupied by the preset instruction when it was running in the past period of time and the related instruction information, thereby avoiding problems such as insufficient memory or memory overflow caused by improper memory configuration.

[0036] like Figure 2 , is a flow chart of a memory configuration method provided in an embodiment of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. A memory configuration method provided in an embodiment of the present application includes the following steps.

[0037] S20, periodically obtaining a first memory value corresponding to a preset instruction during execution, and obtaining a plurality of first memory values, where the first memory value is used to represent a memory occupied by the preset instruction during execution.

[0038] In one embodiment of the present application, an independent station running an Internet platform must allocate memory for different preset instructions to ensure that the preset instructions can run normally. The preset instructions are used to implement data processing functions in the independent station.

[0039] Exemplarily, when the Internet platform is a cross-border e-commerce platform, the independent station may be a server running a commodity trading platform, which runs instructions that meet user needs to achieve a variety of data processing functions. For example, when the user's demand is to query the sales volume of goods in the commodity trading platform, the preset instruction may be a pre-written instruction for querying the sales volume of goods. In order to ensure that the instructions can be run and respond to the user's needs, the electronic device may set the memory occupied by the preset instructions during the execution process according to the default memory value to ensure that the preset instructions can run normally. Exemplarily, the default memory value may be 8G.

[0040] In one embodiment of the present application, since the memory pre-set for the preset instruction cannot be changed during the execution of the instruction, the memory occupied by the preset instruction during the execution process can be obtained and analyzed to determine the change trend of the memory corresponding to the preset instruction, so as to adjust the memory value pre-set for each preset instruction according to the change trend, thereby improving the accuracy of the memory configuration. Specifically, the electronic device in the server can call the preset monitoring instruction at any time to obtain the operation log of the server, and analyze the content of the operation log based on the text matching method to determine the first memory value corresponding to different preset instructions during the execution process, and obtain multiple first memory values ​​corresponding to each preset instruction. Among them, the operation log is used to record the memory value occupied by the periodically obtained preset instruction during the operation process, and each first memory value corresponds to a first timestamp, which is used to characterize the collection time of the first memory value.

[0041] Exemplarily, the operation log can be used to record the first memory value corresponding to the preset instruction within at least one preset time period, wherein the preset time period can be one week, 72 hours or 24 hours before obtaining the operation log, etc., and this application does not limit this. Among them, the first memory value and the corresponding first timestamp can be in the form of a key-value pair, for example, multiple first memory values ​​and the first timestamp corresponding to each first memory value can be: [00:00:00:00, 1G], [00:00:00:02, 1.3G], [00:00:00:04, 1.5G], [00:00:00:06, 1.8G], [00:00:00:08, 2G]. Among them, [00:00:00:00, 1G] is used to represent that the memory occupied by the preset instruction at 0 hours, 0 minutes, 0 seconds, and 0 milliseconds during the operation is 1G.

[0042] S21, determining a second memory value from the plurality of first memory values ​​according to a preset time period.

[0043] In one embodiment of the present application, in order to determine the trend of memory changes during the execution of a preset instruction, a second memory value may be determined from a plurality of first memory values ​​according to a preset time period. The second memory value may be a peak value of memory occupied during the execution of the preset instruction. Specifically, according to the preset time period, determining the second memory value from a plurality of first memory values ​​includes: determining the largest first memory value within the preset time period as the second memory value.

[0044] Based on the above embodiments, the bottleneck of the memory occupied by the preset instructions during the operation process can be identified according to the peak value of the preset instructions during the operation process in the preset time period. When a preset instruction occupies a high amount of memory, the system may experience performance degradation or insufficient memory. The memory configuration of the system can also be adjusted according to the peak value of memory usage to ensure that the system can still run stably under high load. In addition, the largest first memory value in the preset time period is determined as the second memory value, and the problem of memory leakage can also be determined in time. When the memory peak values ​​corresponding to multiple preset time periods continue to rise and there is no downward trend, the execution process of the preset instructions may have a memory leakage problem. In this way, by monitoring and analyzing the memory peak value, potential memory problems can be discovered and solved in time, thereby reducing the risk of system crashes. When the memory occupancy is close to the system limit, corresponding measures can be taken to release the memory or increase the memory configuration to ensure that the system can still run stably under high load.

[0045] In one embodiment of the present application, according to a preset time period, determining a second memory value from a plurality of first memory values ​​includes: sorting a plurality of first memory values ​​within a preset time period in order from large to small; determining a plurality of candidate memory values ​​from a plurality of first memory values ​​according to the order of each first memory value; and determining the mean of the plurality of candidate memory values ​​as the second memory value. Among them, the candidate memory value may be a plurality of first memory values ​​from large to small, and the number of the candidate memory values ​​is much smaller than the first memory value. Exemplarily, when the plurality of first memory values ​​are 2G, 1.8G, 1.5G, 1.3G, and 1G from large to small, the candidate memory values ​​may be determined to be 2G, 1.8G, and 1.5G, and the mean of the candidate memory values, 1.7G, may be determined as the second memory value. In this way, the second memory value can be determined according to a plurality of candidate memory values, the tolerance of the second memory value can be increased, and the error caused when the second memory value is determined by a single first memory value can be avoided.

[0046] S22: Determine a third memory value of the preset instruction according to the second memory value.

[0047] In one embodiment of the present application, the second memory value can represent the upper limit of the memory occupied by the preset instruction during the running process. For example, when the second memory value is 2G, it indicates that the upper limit of the memory occupied by the preset instruction during the running process is 2G.

[0048] In one embodiment of the present application, since the second memory value is the upper limit of the memory occupied by the preset instruction during the execution of any time period in the past, errors may occur when evaluating the memory value that needs to be allocated during the execution of the preset instruction based on the second memory value. In order to improve the accuracy of the configured memory on the basis of ensuring the successful operation of the preset instruction, the second memory value can be updated according to the instruction information of the preset instruction to obtain the third memory value of the preset instruction. Among them, the third memory value represents the upper limit of the memory occupied by the preset instruction on the premise of ensuring the successful operation of the preset instruction. Among them, the instruction information of the preset instruction includes: instruction execution status, which is used to display the current status of the preset instruction, such as running, completed, failed, etc.; instruction execution time, which is used to record the time when the instruction starts to execute, the time when it ends, and the total execution time; resource allocation ratio, which is used to record the usage of resources such as the central processing unit and cache space allocated to the preset instruction; instruction attempt number, which is used to record the number of times the preset instruction attempts to execute. If the number of instruction attempts is large, it indicates that the execution of the preset instruction may be unstable due to insufficient memory allocation; data volume, which is used to record the size of the input and output data volume of the preset instruction. When the data volume of the preset instruction is high, it may cause the execution speed of the preset instruction to be slow, and the higher the memory value required for the normal operation of the preset instruction; parallelism, which is used to characterize the ability of the preset instruction to divide the input data and output data into multiple parts for parallel processing. When the parallelism is higher, it indicates that the ability of the preset instruction to divide the data into multiple parts for parallel processing is stronger, and when the parallelism is lower, it indicates that the ability of the preset instruction to divide the data into multiple parts for parallel processing is weaker. Specifically, for the method of determining the third memory value based on the instruction information and the second memory value, please refer to Figure 3 The corresponding detailed description.

[0049] In another embodiment of the present application, in order to increase the time span of the second memory value, the memory usage change trend during the execution of the preset instruction is evaluated according to the second memory value with a longer time span, thereby improving the accuracy of the configured memory. Multiple second memory values ​​can be determined from multiple preset time periods, and the third memory value can be determined according to the multiple second memory values. For a specific method of determining the third memory value according to multiple second memory values, please refer to Figure 4 The corresponding detailed description.

[0050] In another embodiment of the present application, in order to determine the trend of memory change according to the memory occupied by the acquired preset instruction during execution, and to determine the mapping relationship between the instruction information of the preset instruction and the memory value change trend, and then improve the accuracy, a memory prediction model can also be trained according to the instruction information and the first memory value, and the third memory value can be predicted based on the memory prediction model. For details, please refer to the method for training the memory prediction model. Figure 5 For detailed description of the method for determining the third memory value based on the memory prediction model, see Figure 6 The corresponding detailed description.

[0051] S23: updating a default memory value preset in the electronic device for executing the preset instruction according to the third memory value.

[0052] In one embodiment of the present application, the third memory value can represent the upper limit of the memory occupied by the preset instruction under the premise of ensuring the successful operation of the preset instruction. In order to ensure that the preset instruction can run normally and the memory value allocated to the preset instruction is appropriate (avoiding the problem of memory waste or insufficient memory), the pre-stored default memory value for executing the preset instruction can be updated according to the third memory value. Among them, the default memory value is the default memory size allocated for all preset instructions. For example, when the default memory value is 8G, it indicates that the memory size allocated by the electronic device for the preset instruction is 8G.

[0053] In one embodiment of the present application, the default memory value may be stored in a configuration file in the electronic device. For example, when the Internet platform running in the electronic device is an Internet platform based on Spark, the configuration file may be a spark-defaults.conf file. Specifically, the spark-defaults.conf file is used to configure a variety of Spark properties, such as memory allocation, number of executors, task scheduling, etc. Among them, the parameter spark.executor.memory is used to set the size of the default memory value. For example, when the value of spark.executor.memory is 8G, it indicates that the default memory value is 8G.

[0054] In one embodiment of the present application, before the preset instruction is executed, the default memory value recorded in the configuration file can be updated to the third memory value, so as to ensure that the preset instruction can avoid the problem of insufficient memory or memory waste during execution, thereby improving the efficiency of the electronic device running the Internet platform. Exemplarily, when the third memory value is 2G, it indicates that based on the analysis of the memory occupied by the preset instruction when it was running in the past one or more time periods, it is determined that the upper limit of the memory occupied by the preset instruction during execution is 2G, so the default memory value in the configuration file can be replaced with 2G, which can avoid the problem of memory waste or insufficient memory on the basis of ensuring the successful operation of the preset instruction.

[0055] It can be seen from the above technical solutions that in order to determine the changing trend of memory usage during the operation of preset instructions based on historical data during the operation of preset instructions, the embodiment of the present application first periodically obtains the first memory value of the preset instruction during the execution process, so as to provide data support for the subsequent configuration of the memory value of the preset instruction. The second memory value is determined from the first memory value, thereby determining the upper limit of the memory usage during the execution of the preset instruction, and the problem of insufficient memory or memory waste can be avoided when configuring the memory later. The third memory value of the preset instruction is determined based on the second memory value, and the second memory value can be further updated, thereby improving the accuracy of the third memory value, and then the accuracy of the configured memory can be improved.

[0056] like Figure 3 , is a flow chart of a method for determining a third memory value provided by an embodiment of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. The method for determining a third memory value provided by an embodiment of the present application includes the following steps.

[0057] S30: Determine corresponding instruction information according to the instruction type of the preset instruction.

[0058] In one embodiment of the present application, due to the diversity of data processing functions in the Internet platform, the types of different preset instructions are also different. Different preset instructions correspond to different instruction types, which are used to characterize different data processing functions implemented by the preset instructions. For example, the instruction types include: large-scale data processing class, which is used to implement data cleaning and conversion functions or log analysis functions, etc.; real-time data analysis class, which is used to implement real-time log analysis functions, real-time recommendation functions, etc.; machine learning class, which is used to implement classification and regression algorithms, clustering and recommendation algorithms, etc.; social network analysis class, which is used to implement graph data calculation functions, and then realize data processing requirements such as social network analysis and network security threat detection.

[0059] In one embodiment of the present application, different instruction types correspond to different instruction information, and the instruction information includes at least the data volume and parallelism of the preset instruction. Among them, the data volume is used to record the size of the input and output data volume of the preset instruction. When the data volume of the preset instruction is high, it may cause the execution speed of the preset instruction to be slow, and the higher the memory value required for the normal operation of the preset instruction; the parallelism is used to characterize the ability of the preset instruction to divide the input data and output data into multiple parts for parallel processing. When the parallelism is higher, it indicates that the ability of the preset instruction to divide the data into multiple parts for parallel processing is stronger, and when the parallelism is lower, it indicates that the ability of the preset instruction to divide the data into multiple parts for parallel processing is weaker. For example, when the instruction type is a large-scale data processing class, it indicates that the preset instruction is used for large-scale data processing, then the data volume of the preset instruction can be 1G, and the parallelism can be 3. Among them, the parallelism of 3 is used to characterize that the preset instruction is processed in parallel by 3 threads.

[0060] S31, determining the coefficient of the preset instruction according to the data amount and parallelism in the instruction information.

[0061] In one embodiment of the present application, in order to adjust the second memory value according to the instruction information to obtain a third memory value with higher accuracy, the coefficient of the preset instruction can be determined according to the data volume and parallelism. The coefficient of the preset instruction is used to characterize the range of changes that may occur in the preset instruction in the future.

[0062] Exemplarily, when the amount of data in the instruction information is higher, it indicates that the preset instruction needs to process more data, and the memory required for the normal operation of the preset instruction is higher, so the coefficient of the preset instruction is higher; when the degree of parallelism in the instruction information is higher, it indicates that the electronic device allocates more threads to the preset instruction, and the memory required for the normal operation of the preset instruction is higher, so the coefficient of the preset instruction is higher.

[0063] In one embodiment of the present application, the historical data volume and historical parallelism of the preset instruction can be determined based on the operation log of the preset instruction within a preset time period, the ratio of the data volume to the historical data volume is determined as a first coefficient, the ratio of the parallelism to the historical parallelism is determined as a second coefficient, and the average of the first coefficient and the second coefficient is determined as the coefficient corresponding to the preset instruction.

[0064] For example, the amount of historical data corresponding to the execution of the preset instruction in the preset time period may be 0.8G, and the historical degree of parallelism may be 2, indicating that the amount of data processed during the execution of the preset instruction in the preset time period is 0.8G, and the number of threads allocated by the electronic device to the preset instruction is 2. When the amount of data of the preset instruction is 1G and the degree of parallelism is 4, the first coefficient is 0.8 and the second coefficient is 2, then it can be determined that the coefficient corresponding to the preset instruction is 1.4. This indicates that the change in the memory occupied by the preset instruction during the execution process is 1.4 times that of the past.

[0065] S32: Determine the third memory value according to the coefficient and the second memory value.

[0066] In one embodiment of the present application, since the coefficient is used to characterize the change range of the peak value of the memory occupied during the execution of the preset instruction, the product of the coefficient and the second memory value can be determined as the third memory value.

[0067] Exemplarily, when the second memory value is 2G and the coefficient is 1.4, it can be determined that the third memory value is 2.8G.

[0068] like Figure 4, is a flow chart of a method for determining a third memory value according to a plurality of second memory values ​​provided in an embodiment of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. The method for determining a third memory value according to a plurality of second memory values ​​provided in an embodiment of the present application includes the following steps.

[0069] S40, determining a second memory value from the multiple first memory values ​​in each preset time period to obtain multiple second memory values.

[0070] In one embodiment of the present application, in order to evaluate the memory usage change trend during the execution of a preset instruction based on a second memory value with a longer time span, thereby improving the accuracy of memory configuration, a second memory value can be determined from multiple first memory values ​​in each preset time period of multiple preset time periods to obtain a second memory value corresponding to each preset time period.

[0071] S41, determining the third memory value according to the weight of each preset time period and the plurality of second memory values.

[0072] In one embodiment of the present application, when the preset instruction runs in different preset time periods, the amount of memory occupied is affected differently. In some preset time periods, when the amount of data corresponding to the preset instruction is high or the degree of parallelism is high, the second memory value of the preset instruction is relatively high; in other preset time periods, when the amount of data corresponding to the preset instruction is low or the degree of parallelism is low, the second memory value of the preset instruction is relatively low. Therefore, when determining the third memory value, the second memory values ​​corresponding to different preset time periods have different weights. In order to improve the accuracy of determining the third memory value, the weight of each preset time period can be determined first, and the second memory values ​​corresponding to all preset time periods can be weighted and summed according to the weight, and the ratio of the sum to the number of preset time periods is calculated to obtain the third memory value.

[0073] Exemplarily, the weight corresponding to the first preset time period may be 0.8, and the corresponding second memory value may be 2G; the weight corresponding to the second preset time period may be 0.9, and the corresponding second memory value may be 1.8G; the weight corresponding to the third preset time period may be 0.7, and the corresponding second memory value may be 2G; then the sum obtained after weighted summation calculation is 4.62G, and the third memory value is 4.62G / 3=1.54G.

[0074] In one embodiment of the present application, the difference of the first memory value in different preset time periods is different, which leads to the difference of the second memory value. Therefore, the weight of each preset time period can be determined according to the difference between the maximum value and the minimum value in the first memory value. For a specific method of determining the weight of each preset time period, please refer to Figure 7 The corresponding detailed description.

[0075] In another embodiment of the present application, the change range of the first memory value in different preset time periods is different, which leads to different second memory values. Therefore, the weight of each preset time period can be determined according to the change range of the first memory value. For a specific method of determining the weight of each preset time period, please refer to Figure 8 The corresponding detailed description.

[0076] like Figure 5 , is a flowchart of a method for training a memory prediction model provided in an embodiment of the present application. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted. The method for training a memory prediction model provided in an embodiment of the present application includes the following steps.

[0077] S50: Determine a first timestamp when obtaining each first memory value.

[0078] In one embodiment of the present application, in order to ensure that the trained memory prediction model can predict the correlation between the first memory values ​​corresponding to different timestamps, the first timestamp when each first memory value is obtained can be determined first.

[0079] S51: Construct first sample data according to the instruction information of the preset instruction and the first timestamp.

[0080] In one embodiment of the present application, the instruction information and the first timestamp of the preset instruction can be formatted to construct the first sample data for training the memory prediction model. Specifically, the first timestamp and the instruction information can be spliced ​​into a vector form to obtain the first sample data. Exemplarily, the first sample data can be [00:00:00:00, 1G, 2], [00:00:00:01, 1G, 2], [00:00:00:02, 1G, 2]. Among them, [00:00:00:00, 1G, 2] represents that during the execution of the preset instruction, when the first timestamp is 0 hours, 0 minutes, 0 seconds, and 0 milliseconds, the amount of data in the instruction information is 1G, and the degree of parallelism in the instruction information is 2.

[0081] S52: Based on the first sample data, a first predicted memory value is obtained using a pre-built initial prediction model.

[0082] In one embodiment of the present application, the initial prediction model may be a long short-term memory model, a recurrent neural network model, or a convolutional neural network model, which is not limited in the present application. The first sample data may be input into the pre-built initial prediction model to obtain a first predicted memory value. The first predicted memory value may be a memory value corresponding to the first sample data predicted by the initial prediction model.

[0083] S53, determining the loss value of the initial prediction model according to the first predicted memory value and the first memory value, and updating the initial prediction model using a back propagation algorithm until the loss value meets a preset condition, thereby obtaining a trained memory prediction model.

[0084] In one embodiment of the present application, in order to evaluate the accuracy of the initial prediction model, the loss value of the initial prediction model can be determined based on the first predicted memory value and the first memory value. For example, the difference between the first predicted memory value and the first memory value can be determined as the loss value of the initial prediction model. When the loss value fails to meet the preset conditions, it indicates that the accuracy of the first predicted memory value predicted by the initial prediction model is low, so the initial prediction model can be updated using the back propagation algorithm. The first sample data is continuously input into the initial prediction model until the loss value meets the preset conditions, indicating that the accuracy of the initial prediction model is high, and then it can be determined that the memory prediction model is obtained.

[0085] like Figure 6 As shown, it is a flowchart of a method for determining a third memory value according to a memory prediction model provided by an embodiment of the present application. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted. The method for determining a third memory value according to a memory prediction model provided by an embodiment of the present application includes the following steps.

[0086] S60: Construct second sample data according to the instruction information and a second timestamp, where the second timestamp represents any moment in the execution process of the preset instruction.

[0087] In one embodiment of the present application, second sample data can be constructed for the instruction information and the second timestamp of the preset instruction. The second sample data is used to predict the memory value occupied at the second timestamp during the execution of the preset instruction, and the format of the second sample data is the same as the first sample data. Exemplarily, the second sample data can be [00:00:00:10, 2G, 3], indicating that during the execution of the preset instruction, when the second timestamp is 0 hours, 0 minutes, 0 seconds, and 10 milliseconds, the amount of data in the instruction information is 2G, and the degree of parallelism in the instruction information is 3.

[0088] S61: Based on the second sample data, using the memory prediction model, obtain a second predicted memory value.

[0089] In one embodiment of the present application, the second sample data can be input into the memory prediction model trained to a converged state to obtain the memory value occupied at the second timestamp during the execution of the preset instruction. Exemplarily, when the second sample data is [00:00:00:10, 2G, 3], and the second predicted memory value predicted by the memory prediction model is 3G, it indicates that the preset instruction predicted by the memory prediction model occupies 3G of memory at a timestamp of 0 hours, 0 minutes, 0 seconds, and 10 milliseconds.

[0090] S62: Determine the third memory value according to the second predicted memory value and the second memory value.

[0091] In one embodiment of the present application, in order to avoid the problem of memory waste or insufficient memory during the execution of the preset instruction, the larger value of the second predicted memory value and the second memory value can be determined as the third memory value. For example, when the second predicted memory value is 3G and the second memory value is 2G, it means that the peak value of the memory occupied by the preset instruction during the past execution is 2G, but the memory occupied may reach 3G when the future timestamp is 0 hours, 0 minutes, 0 seconds and 10 milliseconds, so the third memory value can be determined to be 3G.

[0092] like Figure 7 , is a flow chart of a method for determining the weight of each preset time period provided in an embodiment of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. The method for determining the weight of each preset time period provided in an embodiment of the present application includes the following steps.

[0093] S70, determining a maximum value and a minimum value among the plurality of first memory values ​​within each preset time period.

[0094] In one embodiment of the present application, in order to determine the difference between multiple first memory values ​​in each preset time period and determine the weight of each preset time period based on the difference, the maximum and minimum values ​​of the multiple first memory values ​​in each preset time period may be first determined.

[0095] S71, determining a difference between the maximum value and the minimum value.

[0096] In an embodiment of the present application, for any preset time period, the difference between the maximum value and the minimum value can be used to characterize the difference between the multiple first memory values ​​in the preset time period. When the difference is small, it indicates that the difference between the multiple first memory values ​​in the preset time period is small; when the difference is large, it indicates that the difference between the multiple first memory values ​​in the preset time period is large.

[0097] S72, normalizing the difference corresponding to each preset time period to obtain the weight of each preset time period.

[0098] In one embodiment of the present application, a preset normalization algorithm may be used to normalize the difference corresponding to each preset time period to obtain the weight of each preset time period. The preset normalization algorithm may be a maximization algorithm, a mean algorithm, etc., which is not limited in the present application.

[0099] Exemplarily, when the differences corresponding to the multiple preset time periods are 0.2G, 0.1G, and 0.3G respectively, if the preset normalization algorithm is a maximization algorithm, the corresponding weights can be determined to be 0.6, 0.3, and 1 respectively.

[0100] like Figure 8 , is a flow chart of a method for determining the weight of each preset time period provided by another embodiment of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. The method for determining the weight of each preset time period provided by the embodiment of the present application includes the following steps.

[0101] S80, determining the variance of the plurality of first memory values ​​within each preset time period.

[0102] In one embodiment of the present application, in order to determine the variation range of multiple first memory values ​​in each preset time period and determine the weight of each preset time period according to the variation range, the variance of the multiple first memory values ​​in each preset time period may be first determined.

[0103] S81, normalizing the variance corresponding to each preset time period to obtain a weight corresponding to each preset time period.

[0104] In an embodiment of the present application, a preset standardization algorithm may be used to standardize the variance corresponding to each preset time period to obtain the weight of each preset time period. The preset standardization algorithm may be a maximization algorithm, a mean algorithm, etc., which is not limited in the present application.

[0105] Exemplarily, when the variances corresponding to the plurality of preset time periods are 0.1G, 0.05G, and 0.2G respectively, if the preset normalization algorithm is a maximization algorithm, the corresponding weights may be determined to be 0.5, 0.25, and 1 respectively.

[0106] See also Fig. 9 , Fig. 9 1 is a functional module diagram of a memory configuration device provided in an embodiment of the present application. The memory configuration device 91 includes an acquisition module 910, an analysis module 920, and an execution module 930. The module / unit referred to in the present application refers to a series of computer-readable instruction segments that can be executed by the processor 13 and can complete fixed functions, which are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0107] The acquisition module 910 is used to periodically acquire the first memory value corresponding to the preset instruction during the execution process to obtain multiple first memory values, where the first memory value is used to represent the memory occupied by the preset instruction during the execution process.

[0108] The analysis module 920 is configured to determine a second memory value from the plurality of first memory values ​​according to a preset time period.

[0109] The analysis module 920 is further configured to determine a third memory value of the preset instruction according to the second memory value.

[0110] The execution module 930 is used to update a default memory value preset in the electronic device for executing the preset instruction according to the third memory value.

[0111] The analysis module 920 is also used to determine the corresponding instruction information according to the instruction type of the preset instruction; determine the coefficient of the preset instruction according to the data volume and parallelism in the instruction information; and determine the third memory value according to the coefficient and the second memory value.

[0112] The analysis module 920 is further used to determine a second memory value from the multiple first memory values ​​in each preset time period to obtain multiple second memory values; and determine the third memory value based on the weight of each preset time period and the multiple second memory values.

[0113] The analysis module 920 is also used to determine the maximum and minimum values ​​among the multiple first memory values ​​within each preset time period; determine the difference between the maximum and the minimum; and standardize the difference corresponding to each preset time period to obtain the weight of each preset time period.

[0114] The analysis module 920 is further used to determine the variance of the plurality of first memory values ​​within each preset time period; and to perform standardization processing on the variance corresponding to each preset time period to obtain a weight corresponding to each preset time period.

[0115] The analysis module 920 is also used to determine the first timestamp when each first memory value is obtained; construct the first sample data according to the instruction information of the preset instruction and the first timestamp; based on the first sample data, use the pre-constructed initial prediction model to obtain the first predicted memory value; determine the loss value of the initial prediction model according to the first predicted memory value and the first memory value, and use the back propagation algorithm to update the initial prediction model until the loss value meets the preset conditions to obtain a trained memory prediction model.

[0116] The analysis module 920 is also used to construct second sample data based on the instruction information and the second timestamp, wherein the second timestamp represents any moment in the execution process of the preset instruction; based on the second sample data, using the memory prediction model, a second predicted memory value is obtained; and based on the second predicted memory value and the second memory value, the third memory value is determined.

[0117] The analysis module 920 is further configured to determine the largest first memory value within the preset time period as the second memory value.

[0118] See also Fig.10 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 100 includes a memory 12 and a processor 13. The memory 12 is used to store computer-readable instructions, and the processor 13 is used to execute the computer-readable instructions stored in the memory to implement a memory configuration method described in any of the above embodiments.

[0119] In an embodiment of the present application, the electronic device 100 further includes a bus, and a computer program stored in the memory 12 and executable on the processor 13, such as a memory configuration program.

[0120] Fig.10 Only the electronic device 100 having the memory 12 and the processor 13 is shown, and those skilled in the art can understand that Fig.10 The structure shown does not constitute a limitation on the electronic device 100 , and the electronic device 100 may include fewer or more components than shown in the figure, or combine some components, or arrange the components differently.

[0121] Combination Figure 2 The memory 12 in the electronic device 100 stores a plurality of computer-readable instructions to implement the memory configuration method, and the processor 13 can execute the plurality of instructions to implement: periodically obtaining a first memory value corresponding to a preset instruction during execution to obtain a plurality of first memory values, wherein the first memory value is used to characterize the memory occupied by the preset instruction during execution; determining a second memory value from the plurality of first memory values ​​according to a preset time period; determining a third memory value of the preset instruction according to the second memory value; and updating a default memory value preset in the electronic device for executing the preset instruction according to the third memory value.

[0122] Specifically, the specific implementation method of the processor 13 for the above instructions can refer to Figure 3 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0123] Those skilled in the art will appreciate that the schematic diagram is merely an example of the electronic device 100 and does not constitute a limitation on the electronic device 100. The electronic device 100 may be a bus-type structure or a star-type structure. The electronic device 100 may also include more or less other hardware or software than shown in the diagram, or a different arrangement of components. For example, the electronic device 100 may also include input and output devices, network access devices, etc.

[0124] It should be noted that the electronic device 100 is only an example, and other existing or future electronic products that are suitable for the present application should also be included in the protection scope of the present application and included here by reference.

[0125] Among them, the memory 12 includes at least one type of readable storage medium, and the readable storage medium can be non-volatile or volatile. The readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 100, such as a mobile hard disk of the electronic device 100. In other embodiments, the memory 12 can also be an external storage device of the electronic device 100, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the electronic device 100. The memory 12 can not only be used to store application software and various types of data installed in the electronic device 100, such as a code of a memory configuration program, etc., but also can be used to temporarily store data that has been output or is to be output.

[0126] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The processor 13 is the control core (Control Unit) of the electronic device 100, and uses various interfaces and lines to connect various components of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing programs or modules stored in the memory 12 (for example, executing memory configuration programs, etc.), and calling data stored in the memory 12.

[0127] The processor 13 executes the operating system of the electronic device 100 and various installed applications. The processor 13 executes the applications to implement the steps in the above-mentioned various memory configuration method embodiments, for example Figure 2 Steps shown.

[0128] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the electronic device 100. For example, the computer program may be divided into an acquisition module 910, an analysis module 920, and an execution module 930.

[0129] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to execute a part of a memory configuration method described in various embodiments of the present application.

[0130] If the module / unit integrated in the electronic device 100 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware devices to complete through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented.

[0131] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory and other memory, etc.

[0132] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0133] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. Fig.10 Only one arrow is used in the figure, but it does not mean that there is only one bus or one type of bus. The bus is configured to realize the connection and communication between the memory 12 and at least one processor 13, etc.

[0134] An embodiment of the present application also provides a computer-readable storage medium (not shown), in which computer-readable storage medium is stored computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the memory configuration method described in any of the above embodiments.

[0135] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0136] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0137] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0138] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the specification can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.

[0139] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.

Claims

1. A memory configuration method, applied to an electronic device, characterized in that: The method comprises: Periodically acquiring a first memory value corresponding to a preset instruction during execution to obtain a plurality of first memory values, where the first memory value is used to represent the memory occupied by the preset instruction during execution; Determining a second memory value from the plurality of first memory values ​​according to a preset time period; Determine a third memory value of the preset instruction according to the second memory value; According to the third memory value, a default memory value preset in the electronic device for executing the preset instruction is updated.

2. The memory configuration method according to claim 1, wherein: Determining the third memory value of the preset instruction according to the second memory value includes: Determine corresponding instruction information according to the instruction type of the preset instruction; Determining the coefficient of the preset instruction according to the amount of data and the degree of parallelism in the instruction information; The third memory value is determined according to the coefficient and the second memory value.

3. The memory configuration method according to claim 1, wherein: Determining the third memory value of the preset instruction according to the second memory value includes: Determine a second memory value from the plurality of first memory values ​​in each preset time period to obtain a plurality of second memory values; The third memory value is determined according to the weight of each preset time period and the plurality of second memory values.

4. The memory configuration method according to claim 3, wherein: The method for determining the weight of each preset time period includes: Determine a maximum value and a minimum value among a plurality of first memory values ​​within each of the preset time periods; determining a difference between the maximum value and the minimum value; The difference corresponding to each preset time period is normalized to obtain the weight of each preset time period.

5. The memory configuration method according to claim 3, wherein: The method for determining the weight of each preset time period includes: determining a variance of a plurality of first memory values ​​within each of the preset time periods; The variance corresponding to each preset time period is standardized to obtain a weight corresponding to each preset time period.

6. The memory configuration method according to claim 1, wherein: The method further comprises: Determining a first timestamp when each first memory value is obtained; Constructing first sample data according to the instruction information of the preset instruction and the first timestamp; Based on the first sample data, using a pre-built initial prediction model, a first predicted memory value is obtained; According to the first predicted memory value and the first memory value, the loss value of the initial prediction model is determined, and the initial prediction model is updated using a back propagation algorithm until the loss value meets a preset condition, thereby obtaining a trained memory prediction model.

7. The memory configuration method according to claim 6, wherein: Determining the third memory value of the preset instruction according to the second memory value includes: Constructing second sample data according to the instruction information and a second timestamp, wherein the second timestamp represents any moment in the execution process of the preset instruction; Based on the second sample data, using the memory prediction model, obtaining a second predicted memory value; The third memory value is determined according to the second predicted memory value and the second memory value.

8. The memory configuration method according to claim 1, wherein: Determining the second memory value from the plurality of first memory values ​​according to the preset time period includes: The maximum first memory value within the preset time period is determined as the second memory value.

9. A memory configuration device, characterized in that: The device comprises: An acquisition module, used for periodically acquiring a first memory value corresponding to a preset instruction during execution, and obtaining a plurality of first memory values, wherein the first memory value is used to represent a memory occupied by the preset instruction during execution; An analysis module, configured to determine a second memory value from the plurality of first memory values ​​according to a preset time period; The analysis module is further used to determine a third memory value of the preset instruction according to the second memory value; An execution module is used to update a default memory value used to execute the preset instruction according to the third memory value.

10. An electronic device, characterized in that: The electronic device comprises a processor and a memory, and the processor is used to implement the memory configuration method as described in any one of claims 1 to 8 when executing a computer program stored in the memory.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the memory configuration method according to any one of claims 1 to 8 are implemented.