File generation control method and apparatus, server, and storage medium

By selecting the optimal file generation strategy when the service process encounters an anomaly, the problem of low recovery efficiency caused by the long coredump file generation time is solved, and the service process can be quickly restored.

CN113886142BActive Publication Date: 2025-11-04BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111210322.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-18
Publication Date
2025-11-04
Estimated Expiration
2041-10-18

AI Technical Summary

Technical Problem

The service process is unavailable when generating the coredump file, resulting in low recovery efficiency. In particular, service processes that consume a lot of memory may take up to half an hour to recover.

Method used

The file generation control program selects the optimal strategy from a variety of preset strategies to generate a file that corresponds to the current memory state information, including compressing large memory information or improving generation efficiency, ensuring that the generation time is less than the time required by the operating system.

Benefits of technology

This shortens the coredump file generation time, improves the recovery efficiency of the service process, and enables it to be restored to use as soon as possible.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113886142B_ABST
    Figure CN113886142B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a file generation control method and device, a server and a storage medium. The method comprises: when an abnormality of a current service process is detected, obtaining current memory state information of the current service process; sending the current memory state information to a file generation control program, and determining a current file generation strategy from a plurality of preset file generation strategies by the file generation control program; the current file generation strategy is a strategy in which, for the same memory state information, a file generation time required by the file generation control program is less than a preset file generation time; the preset file generation time is a file generation time required by an operating system corresponding to the current service process; and a file corresponding to the current memory state information is generated based on the current file generation strategy. The method can shorten the file generation time corresponding to the current memory state information, thereby improving the recovery efficiency of the service process.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, and particularly relates to a file generation control method and device, a server and a storage medium. BACKGROUND

[0002] In the technical field of computer, when a service process (such as an online service process) has a problem, an operating system stores a current working state of the service process into a core dump file; the core dump file is a snapshot of the entire memory, generally including memory, register state, stack pointer, memory management information and the like of the service process at runtime.

[0003] However, during writing of the core dump file, the service process is completely unavailable, uncontrollable and unable to restart; if the service process occupies several hundred GB of memory, it may take half an hour to write the entire core dump file, during which the service process is unavailable, resulting in low service process recovery efficiency. SUMMARY

[0004] The present disclosure provides a file generation control method and device, a server and a storage medium to at least solve the problem of low service process recovery efficiency in the related art. The technical solutions of the present disclosure are as follows.

[0005] According to a first aspect of an embodiment of the present disclosure, a file generation control method is provided, comprising:

[0006] When an exception of a current service process is detected, current memory state information of the current service process is acquired;

[0007] The current memory state information is sent to a file generation control program, and a current file generation strategy is determined from a plurality of preset file generation strategies by the file generation control program; the current file generation strategy is a strategy in which, for the same memory state information, a file generation time required by the file generation control program is less than a preset file generation time; the preset file generation time is a file generation time required by an operating system corresponding to the current service process;

[0008] Based on the current file generation strategy, a file corresponding to the current memory state information is generated.

[0009] In an exemplary embodiment, the current file generation strategy is determined from the plurality of preset file generation strategies by the file generation control program, comprising:

[0010] If the information amount occupied by the current memory state information is greater than or equal to the preset information amount, a first file generation strategy is selected as the current file generation strategy from the preset multiple file generation strategies by the file generation control program; the first file generation strategy is used to represent a strategy of compressing the memory state information and generating a file corresponding to the compressed memory state information.

[0011] If the information amount occupied by the current memory state information is less than the preset information amount, a second file generation strategy is selected as the current file generation strategy from the preset multiple file generation strategies by the file generation control program; the second file generation strategy is used to represent a strategy of generating a file corresponding to the memory state information according to a file generation efficiency greater than a preset file generation efficiency, the preset file generation efficiency being used to represent a file generation efficiency of an operating system corresponding to the current service process.

[0012] In an example embodiment, the file corresponding to the current memory state information is generated based on the current file generation strategy, including:

[0013] If the current file generation strategy is the first file generation strategy, the current memory state information is compressed by the file generation control program to obtain compressed current memory state information, and a file corresponding to the compressed current memory state information is generated.

[0014] If the current file generation strategy is the second file generation strategy, a target file generation efficiency greater than the preset file generation efficiency is determined by the file generation control program, and a file corresponding to the current memory state information is generated according to the target file generation efficiency.

[0015] In an example embodiment, the current file generation strategy is determined by the file generation control program from the preset multiple file generation strategies, further including:

[0016] The cumulative file generation number of the current service process in a preset time period is obtained by the file generation control program.

[0017] If the cumulative file generation number is less than a preset file generation number, the current file generation strategy is determined by the file generation control program from the preset multiple file generation strategies.

[0018] In an example embodiment, the preset multiple file generation strategies are obtained by the following way:

[0019] File generation configuration information is obtained.

[0020] determining a plurality of file generation strategies corresponding to the file generation configuration information; each of the file generation strategies represents a file generation time less than the preset file generation time;

[0021] The plurality of file generation strategies are the preset plurality of file generation strategies.

[0022] In an exemplary embodiment, before the current memory state information of the current service process is acquired when it is detected that the current service process has an exception, the method further includes:

[0023] acquiring a configuration file of the current service process;

[0024] replacing a preset file path of the memory state information in the configuration file with information processing guide information; the information processing guide information is guide information for sending the memory state information to the file generation control program for processing.

[0025] In an exemplary embodiment, the sending of the current memory state information to the file generation control program includes:

[0026] If the information processing guide information is included in the configuration file, the current memory state information is sent to the file generation control program according to an information sending mode pre-configured in the information processing guide information.

[0027] According to a second aspect of the embodiments of the present disclosure, a file generation control device is provided, including:

[0028] an information acquisition unit configured to acquire current memory state information of a current service process when it is detected that the current service process has an exception;

[0029] a strategy determination generation unit configured to send the current memory state information to a file generation control program, and determine a current file generation strategy from a plurality of preset file generation strategies by the file generation control program; the current file generation strategy is a strategy in which a file generation time required by the file generation control program for the same memory state information is less than a preset file generation time; the preset file generation time is a file generation time required by an operating system corresponding to the current service process;

[0030] a file generation unit configured to generate a file corresponding to the current memory state information based on the current file generation strategy.

[0031] In an example embodiment, the policy determining unit is further configured to perform the following: if the information amount occupied by the current memory state information is greater than or equal to a preset information amount, selecting, by the file generation control program, a first file generation policy from the plurality of preset file generation policies as the current file generation policy, the first file generation policy being used to represent a policy of compressing the memory state information and generating a file corresponding to the compressed memory state information; and if the information amount occupied by the current memory state information is less than the preset information amount, selecting, by the file generation control program, a second file generation policy from the plurality of preset file generation policies as the current file generation policy, the second file generation policy being used to represent a policy of generating a file corresponding to the memory state information according to a file generation efficiency greater than a preset file generation efficiency, the preset file generation efficiency being used to represent a file generation efficiency of an operating system corresponding to the current service process.

[0032] In an example embodiment, the file generation unit is further configured to perform the following: if the current file generation policy is the first file generation policy, compressing, by the file generation control program, the current memory state information to obtain compressed current memory state information, and generating a file corresponding to the compressed current memory state information; and if the current file generation policy is the second file generation policy, determining, by the file generation control program, a target file generation efficiency greater than the preset file generation efficiency, and generating a file corresponding to the current memory state information according to the target file generation efficiency.

[0033] In an example embodiment, the policy determining unit is further configured to perform the following: acquiring, by the file generation control program, a cumulative file generation number of the current service process within a preset time period; and if the cumulative file generation number is less than a preset file generation number, determining, by the file generation control program, a current file generation policy from the plurality of preset file generation policies.

[0034] In an example embodiment, the apparatus further comprises a policy configuration unit configured to perform the following: acquiring file generation configuration information; determining a plurality of file generation policies corresponding to the file generation configuration information, each file generation policy representing a file generation time less than a preset file generation time; and taking the plurality of file generation policies as the plurality of preset file generation policies.

[0035] In an exemplary embodiment, the apparatus further comprises an information replacing unit configured to perform: obtaining a configuration file of the current service process; and replacing a preset file path of memory state information in the configuration file with information processing guide information; the information processing guide information being guide information for sending the memory state information to the file generation control program for processing.

[0036] In an exemplary embodiment, the policy determining unit is further configured to perform: if it is detected that the configuration file includes the information processing guide information, sending the current memory state information to the file generation control program according to an information sending mode pre-configured in the information processing guide information.

[0037] According to a third aspect of embodiments of the present disclosure, a server is provided, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the file generation control method according to any one of the embodiments of the first aspect.

[0038] According to a fourth aspect of embodiments of the present disclosure, a computer readable storage medium is provided, comprising: instructions executable by a processor of a server, when the instructions are executed by the processor of the server, causing the server to perform the file generation control method according to any one of the embodiments of the first aspect.

[0039] According to a fifth aspect of embodiments of the present disclosure, a computer program product is provided, comprising instructions executable by a processor of a server, when the instructions are executed by the processor of the server, causing the server to perform the file generation control method according to any one of the embodiments of the first aspect.

[0040] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:

[0041] When it is detected that the current service process is abnormal, the current memory state information of the current service process is acquired; then the current memory state information is sent to the file generation control program, and the current file generation strategy is determined from the preset multiple file generation strategies by the file generation control program; the current file generation strategy is a strategy in which the file generation time required by the file generation control program is less than the file generation time required by the corresponding operating system of the current service process for the same memory state information; based on the current file generation strategy, the file corresponding to the current memory state information is generated; in this way, the purpose of selecting the strategy with shorter file generation time by the file generation control program and generating the file corresponding to the current memory state information in the case of abnormality of the current service process is achieved, which is beneficial to shorten the file generation time corresponding to the current memory state information, so that the current service process can be restored for use as soon as possible, avoiding the defect that the file generation time is long in the traditional technology, resulting in low recovery efficiency of the service process, thereby improving the recovery efficiency of the service process.

[0042] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0043] The accompanying drawings incorporated in the specification and forming a part of it illustrate embodiments consistent with the present disclosure and together with the description are used to explain the principles of the present disclosure, and do not limit the present disclosure.

[0044] Figure 1 is an application environment diagram of a file generation control method according to an exemplary embodiment.

[0045] Figure 2 is a flowchart of a file generation control method according to an exemplary embodiment.

[0046] Figure 3 is a flowchart of a configuration step of the preset multiple file generation strategies according to an exemplary embodiment.

[0047] Figure 4 is a flowchart of another file generation control method according to an exemplary embodiment.

[0048] Figure 5 is a block diagram of a file generation control device according to an exemplary embodiment.

[0049] Figure 6 is a block diagram of a server according to an exemplary embodiment. DETAILED DESCRIPTION

[0050] In order for the ordinary person in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings.

[0051] It should be noted that the terms "first", "second" and the like in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0052] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, analyzed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties.

[0053] The file generation control method provided by the present disclosure can be applied to an application environment as shown in Figure 1 . Among them, the server 110 interacts with the file generation control program 120 through the network, the server 110 includes an operating system, and a plurality of service processes run in the operating system, such as the current service process; specifically, referring to Figure 1 , when the server 110 detects that the current service process is abnormal, the current memory state information of the current service process is obtained; the current memory state information is sent to the file generation control program 120; the current file generation strategy is determined from the preset multiple file generation strategies through the file generation control program 120, and the file corresponding to the current memory state information is generated based on the current file generation strategy; the current file generation strategy is a strategy in which the file generation time required by the file generation control program 120 is less than the file generation time required by the operating system corresponding to the current service process for the same memory state information. Wherein, the server 110 can be realized by an independent server or a server cluster composed of multiple servers, and the file generation control program 120 refers to a script program for generating a file corresponding to the memory state information, such as a python script.

[0054] Figure 2 is a flowchart of a file generation control method according to an exemplary embodiment, as shown in Figure 2 , the file generation control method is used in a server as shown in Figure 1 , comprising the following steps:

[0055] In step S210, when detecting that the current service process is abnormal, the current memory state information of the current service process is acquired.

[0056] The service process refers to a program providing services in an operating system, and the current service process refers to a program currently providing services in the operating system. The current service process being abnormal can refer to the current service process being faulty. In addition, each service process corresponds to an operating system, and the operating system corresponding to the current service process can refer to a Linux operating system.

[0057] The current memory state information refers to information related to the memory of the current service process, including the memory, register state, stack pointer, and memory management information of the current service process when running.

[0058] Specifically, the server detects the current service process according to a preset abnormality detection instruction. If it is detected that the current service process is abnormal, the current memory state information of the current service process is acquired through a memory state information acquisition instruction.

[0059] For example, when the server detects that the current service process has a problem, the coredump information of the current service process is acquired as the current memory state information of the current service process.

[0060] In step S220, the current memory state information is sent to a file generation control program, and the current file generation strategy is determined from a plurality of preset file generation strategies through the file generation control program.

[0061] In step S230, a file corresponding to the current memory state information is generated based on the current file generation strategy.

[0062] The file corresponding to the current memory state information specifically refers to a coredump file.

[0063] The file generation control program refers to a script program for generating a file corresponding to the memory state information, such as a python script. The file generation control program is configured with a plurality of preset file generation strategies. The file generation control program can select a file generation strategy according to actual conditions, and generate a file corresponding to the memory state information based on the selected file generation strategy.

[0064] The file generation strategy refers to a way of generating a file corresponding to the memory state information, such as compressing the memory state information first, then generating a file corresponding to the compressed memory state information, generating a file corresponding to the memory state information with higher file generation efficiency (i.e., quickly generating a file corresponding to the memory state information), generating an empty file (i.e., not generating a file corresponding to the memory state information), etc.

[0065] It should be noted that for the same memory state information, the file generation time required by the file generation control program using any of the plurality of preset file generation strategies is less than the file generation time required by the operating system corresponding to the current service process.

[0066] Among them, the current file generation strategy is a strategy in which the file generation time required by the file generation control program for the same memory state information is less than the preset file generation time, and the preset file generation time is the file generation time required by the operating system corresponding to the current service process. For example, the current file generation strategy is used to represent a strategy in which the file generation time required by the file generation control program for the same memory state information is less than the file generation time required by the operating system (such as a Linux operating system) corresponding to the current service process, which specifically refers to the optimal file generation strategy corresponding to the current memory state information of the current service process.

[0067] It should be noted that the optimal file generation strategy corresponding to different memory state information is different; for example, some memory state information occupies several hundred GB of information, so the memory state information needs to be compressed first, and then a file corresponding to the compressed memory state information is generated; some memory state information occupies less information, so a file corresponding to the entire memory state information can be generated at an efficiency greater than the file generation efficiency of the operating system corresponding to the current service process.

[0068] Specifically, the server sends the current memory state information to the corresponding file generation control program, determines the file generation strategy corresponding to the current memory state information from the plurality of preset file generation strategies through the file generation control program, as the current file generation strategy, and generates a file corresponding to the current memory state information based on the current file generation strategy.

[0069] For example, the file generation control program identifies that the data volume of the current memory state information is greater than the preset data volume, such as several hundred GB of information occupied by the current memory state information, and selects the file generation strategy of "first compressing the memory state information, and then generating a file corresponding to the compressed memory state information" from the plurality of preset file generation strategies as the current file generation strategy, and generates a file corresponding to the compressed current memory state information based on the current file generation strategy.

[0070] Further, the file generation control program can also determine the file generation result corresponding to the current memory state information according to the file corresponding to the current memory state information, and send the file generation result corresponding to the current memory state information to the server; if the server receives the file generation result corresponding to the current memory state information, it means that the file corresponding to the current memory state information is successfully generated, and the current service process is repaired through the preset process repair instruction, so that the current service process can be restored as soon as possible.

[0071] In the above file generation control method, when it is detected that the current service process is abnormal, the current memory state information of the current service process is obtained; then the current memory state information is sent to the file generation control program, and the current file generation strategy is determined from the preset multiple file generation strategies by the file generation control program, and the file corresponding to the current memory state information is generated based on the current file generation strategy; the current file generation strategy is the strategy that the file generation time required by the file generation control program for the same memory state information is less than the file generation time required by the system corresponding to the current service process; in this way, the purpose of selecting the strategy with shorter file generation time by the file generation control program and generating the file corresponding to the current memory state information in the case of abnormality of the current service process is achieved, which is beneficial to shorten the file generation time of the current memory state information, so that the current service process can be restored as soon as possible, avoiding the defect that the file generation time is long in the traditional technology, resulting in low recovery efficiency of the service process, thereby improving the recovery efficiency of the service process.

[0072] In an exemplary embodiment, the step S220 of determining the current file generation strategy from the preset multiple file generation strategies by the file generation control program specifically includes: if the information amount occupied by the current memory state information is greater than or equal to the preset information amount, selecting a first file generation strategy from the preset multiple file generation strategies by the file generation control program as the current file generation strategy; the first file generation strategy is used to represent the strategy of compressing the memory state information and generating the file corresponding to the compressed memory state information; if the information amount occupied by the current memory state information is less than the preset information amount, selecting a second file generation strategy from the preset multiple file generation strategies by the file generation control program as the current file generation strategy; the second file generation strategy is used to represent the strategy of generating the file corresponding to the memory state information according to the file generation efficiency greater than the preset file generation efficiency, and the preset file generation efficiency is used to represent the file generation efficiency of the system corresponding to the current service process.

[0073] The information amount occupied by the current memory state information refers to a memory space occupied by the current memory state information, such as several GB, several tens of GB, several hundred GB, and the like. The preset information amount is used to measure whether the file generation control program needs to compress the current memory state information, such as 50 GB, and can be adjusted according to actual conditions.

[0074] The compression of the memory state information refers to compression of the memory state information to an information amount less than an initial information amount of the memory state information. For example, 100 GB of memory state information is compressed into 10 GB of memory state information, and 10 GB of memory state information is compressed into 2 GB of memory state information.

[0075] The file generation efficiency refers to an efficiency of generating a file corresponding to the memory state information, and specifically refers to an information amount of files that can be generated per unit time. For example, the file generation control program rapidly generates a file corresponding to the memory state information according to a file generation efficiency of 1 GB of file per second, and shortens the unavailable time of the current service process.

[0076] The preset file generation efficiency refers to an efficiency of generating a file corresponding to the memory state information by the operating system corresponding to the current service process, and specifically refers to an information amount of files that can be generated per unit time. For example, in general, the operating system corresponding to the current service process generates a file corresponding to memory state information with an information amount of 100 GB, which needs 30 minutes, while the file generation control program generates a file corresponding to the memory state information with the information amount of 100 GB, which may only need 10 minutes.

[0077] It should be noted that the preset plurality of file generation strategies further include a third file generation strategy. The third file generation strategy is used to represent a strategy of first compressing the memory state information, and then generating a file corresponding to the compressed memory state information according to a file generation efficiency greater than the preset file generation efficiency.

[0078] Specifically, if the information amount of the current memory state information is greater than or equal to the preset information amount, it indicates that the information amount of the current memory state information is large and needs to be compressed, and the file generation control program selects a first file generation strategy from the preset multiple file generation strategies, which represents "compressing the memory state information and generating a file corresponding to the compressed memory state information", and takes it as the current file generation strategy; if the information amount of the current memory state information is less than the preset information amount, it indicates that the information amount of the current memory state information is small and does not need to be compressed, and the file generation control program selects a second file generation strategy from the preset multiple file generation strategies, which represents "generating a file corresponding to the memory state information according to a file generation efficiency greater than the file generation efficiency of the system corresponding to the current service process", and takes it as the current file generation strategy.

[0079] For example, if the information amount of the current memory state information is greater than 50 GB, the file generation control program selects the first file generation strategy from the preset multiple file generation strategies; if the information amount of the current memory state information is less than 50 GB, the file generation control program selects the second file generation strategy from the preset multiple file generation strategies.

[0080] The technical scheme provided by the embodiments of the present disclosure determines the optimal file generation strategy corresponding to the information amount of the current memory state information from the preset multiple file generation strategies as the current file generation strategy through the file generation control program, which is beneficial to quickly generate a file corresponding to the current memory state information based on the current file generation strategy, thereby shortening the file generation time corresponding to the current memory state information and enabling the current service process to be used as soon as possible.

[0081] In an exemplary embodiment, in the step S230, the file corresponding to the current memory state information is generated based on the current file generation strategy, specifically including: if the current file generation strategy is the first file generation strategy, the file generation control program compresses the current memory state information to obtain compressed current memory state information, and generates a file corresponding to the compressed current memory state information; if the current file generation strategy is the second file generation strategy, the file generation control program determines a target file generation efficiency greater than the preset file generation efficiency, and generates a file corresponding to the current memory state information according to the target file generation efficiency.

[0082] Specifically, the file generation control program identifies the current file generation strategy, and if the current file generation strategy is identified as the first file generation strategy, the first file generation strategy is followed to first compress the current memory state information according to a preset compression manner to obtain compressed current memory state information, and then generate a file corresponding to the compressed current memory state information; if the current file generation strategy is identified as the second file generation strategy, the second file generation strategy is followed to first adjust the preset file generation efficiency to obtain a file generation efficiency greater than the preset file generation efficiency as a target file generation efficiency, and then generate a file corresponding to the current memory state information according to the target file generation efficiency.

[0083] For example, assuming that the information amount of the current memory state information is 100 GB, which is relatively large, the file generation control program first compresses the 100 GB current memory state information into 10 GB current memory state information, and then generates a file corresponding to the 10 GB current memory state information; assuming that the information amount of the current memory state information is 10 GB, which is relatively small, the file generation control program quickly generates a file corresponding to the 10 GB current memory state information according to a file generation efficiency of 1 GB per second.

[0084] It should be noted that the current memory state information is compressed to obtain compressed current memory state information, and a file corresponding to the compressed current memory state information is generated, which can specifically be that the current memory state information is first compressed to obtain compressed current memory state information, and then a file corresponding to the compressed memory state information is generated according to a file generation efficiency greater than the preset file generation efficiency.

[0085] The technical scheme provided by the embodiments of the present disclosure is based on the current file generation strategy to quickly generate a file corresponding to the current memory state information, which is beneficial to shorten the file generation time corresponding to the current memory state information, so that the current service process can be restored for use as soon as possible, thereby improving the recovery efficiency of the service process.

[0086] In an exemplary embodiment, in the step S220, the current file generation strategy is determined from the preset multiple file generation strategies by the file generation control program, specifically including: obtaining, by the file generation control program, the cumulative file generation number of the current service process in a preset time period; if the cumulative file generation number is less than a preset file generation number, determining, by the file generation control program, the current file generation strategy from the preset multiple file generation strategies.

[0087] The accumulated file generation number of the current service process in the preset time period is a cumulative number of files corresponding to the memory state information of the current service process generated by the file generation control program in the preset time period; and the preset file generation number is a highest allowed number of files corresponding to the memory state information of the current service process generated by the file generation control program in the preset time period, for example, 2, which can be adjusted according to actual conditions.

[0088] Specifically, the accumulated file generation number of the current service process in the preset time period is obtained from the local log by the file generation control program; the accumulated file generation number is compared with the preset file generation number to obtain a comparison result; and if the comparison result is that the accumulated file generation number is less than the preset file generation number, the current file generation strategy is determined from the preset multiple file generation strategies by the file generation control program.

[0089] For example, if the accumulated file generation number of the current service process in the preset time period is 2, and the preset file generation number is 3, it indicates that the accumulated file generation number of the current service process in the preset time period has not reached the preset file generation number, and the current file generation strategy is determined from the preset multiple file generation strategies by the file generation control program.

[0090] Further, if the comparison result is that the accumulated file generation number is equal to the preset file generation number, it indicates that the accumulated file generation number of the current service process in the preset time period has reached the preset file generation number, and a file corresponding to the current memory state information does not need to be generated, and a corresponding result is returned to the current service process, so that the current service process can be restored for use as soon as possible.

[0091] The technical scheme provided by the embodiments of the present disclosure comprehensively considers the accumulated file generation number of the current service process in the preset time period and the data amount corresponding to the current memory state information, which is beneficial to further shorten the file generation time corresponding to the current memory state information, thereby improving the recovery efficiency of the service process.

[0092] In an example embodiment, as shown in FIG. 10, the file generation control method provided by the present disclosure further includes a configuration step of the preset multiple file generation strategies, specifically including the following steps: Figure 3

[0093] In step S310, file generation configuration information is obtained.

[0094] ​The file generation configuration information is configuration information related to a file generation strategy of the current service process, such as information related to "first compressing the memory state information, and then generating a file corresponding to the compressed memory state information", information related to "generating a file corresponding to the memory state information according to a file generation efficiency greater than a file generation efficiency of a system corresponding to the current service process", information related to "generating an empty file", and the like.

[0095] Specifically, the server receives an operation request of an operation account on the configuration platform, and parses the operation request to obtain the file generation configuration information of the current service process.

[0096] In step S320, a plurality of file generation strategies corresponding to the file generation configuration information are determined; and a file generation time of each file generation strategy is less than a preset file generation time.

[0097] The file generation strategy refers to a strategy that, for the same memory state information, a file generation time required by the file generation control program is less than a file generation time required by an operating system corresponding to the current service process, and specifically refers to a strategy of first compressing the memory state information, then generating a file corresponding to the compressed memory state information, a strategy of generating a file corresponding to the memory state information according to a file generation efficiency greater than a file generation efficiency of a system corresponding to the current service process, or a strategy of generating an empty file.

[0098] Specifically, the server determines, according to the file generation configuration information, a plurality of file generation strategies that, for the same memory state information, a file generation time required by the file generation control program is less than a file generation time required by an operating system corresponding to the current service process, as the plurality of file generation strategies corresponding to the file generation configuration information.

[0099] For example, the server parses the file generation configuration information to obtain a plurality of file generation strategies that, for the same memory state information, a file generation time required by the file generation control program is less than a file generation time required by an operating system corresponding to the current service process.

[0100] In step S330, the plurality of file generation strategies are preset as a plurality of preset file generation strategies.

[0101] The technical scheme provided by the embodiments of the present disclosure is advantageous in that a plurality of file generation strategies are preconfigured, which facilitates subsequent determination of a current file generation strategy from the plurality of preset file generation strategies by using the file generation control program, rapid generation of a file corresponding to the current memory state information based on the current file generation strategy, and thus shortening of the unavailable time of the service process, thereby improving the recovery efficiency of the service process.

[0102] In an exemplary embodiment, before the current memory state information of the current service process is acquired when the current service process is detected to be abnormal in step S210, the method further comprises: acquiring a configuration file of the current service process; and replacing a preset file path of the memory state information in the configuration file with information processing guide information, the information processing guide information being guide information for sending the memory state information to a file generation control program for processing.

[0103] The configuration file is a file composed of configuration information related to the current service process, and contains the preset file path of the memory state information.

[0104] The information processing guide information is information for sending the memory state information to the file generation control program and processing the memory state information through the file generation control program, such as "|coredump.py", which means that the content of the coredump file is transmitted to the python script through the pipeline, and the generation of the coredump file is performed through the python script.

[0105] Specifically, the server acquires the configuration file of the current service process, identifies the information in the configuration file according to the file path identification instruction, obtains the preset file path of the memory state information in the configuration file, and replaces the preset file path of the memory state information in the configuration file with information processing guide information for sending the memory state information to the file generation control program and processing the memory state information through the file generation control program.

[0106] For example, the default coredump file path of the Linux operating system is configured in / proc / sys / kernel / core_pattern, and the value of / proc / sys / kernel / core_pattern is a file path. The value of / proc / sys / kernel / core_pattern can be transmitted to the python script through the pipeline and processed in the python script, such as modifying the value of / proc / sys / kernel / core_pattern to "|coredump.py".

[0107] It should be noted that different strategies can be freely selected in the coredump.py script, such as writing a full coredump file, writing a compressed coredump file, or not writing a coredump file. The specific strategy can be configured on the platform, such as writing a full coredump file only once a day on a single machine or writing a full coredump file only once an hour for a service, so as to control the frequency of coredump.

[0108] The technical solution provided by the embodiment of the present disclosure is beneficial to subsequent sending of the current memory state information to the corresponding file generation control program for rapid processing according to the information processing guide information, so as to shorten the unavailable time of the service process.

[0109] In an exemplary embodiment, in the step S220, sending the current memory state information to the file generation control program specifically includes: if it is detected that the configuration file includes the information processing guide information, sending the current memory state information to the file generation control program according to the preconfigured information sending mode in the information processing guide information.

[0110] The preconfigured information sending mode refers to an information sending mode provided by an operating system corresponding to the current service process, specifically refers to sending the current memory state information through a pipe provided by a Linux operating system.

[0111] Specifically, the server detects information in the configuration file of the current service process, and if it is detected that the configuration file includes the information processing guide information, sends the current memory state information to the file generation control program according to the preconfigured information sending mode in the information processing guide information, for example, sends the current memory state information to the file generation control program through a pipe provided by a Linux operating system, processes the current memory state information through the file generation control program, and obtains a file corresponding to the current memory state information.

[0112] Further, if it is detected that the configuration file does not include the information processing guide information, generates the file corresponding to the current memory state information through the operating system corresponding to the current service process.

[0113] The technical solution provided by the embodiment of the present disclosure is beneficial to subsequent sending of the current memory state information to the corresponding file generation control program for rapid processing according to the information processing guide information, so as to shorten the unavailable time of the service process.

[0114] Figure 4 is a flowchart of another file generation control method according to an exemplary embodiment, as shown in Figure 4 The file generation control method is used in the server as shown in Figure 1 The file generation control method includes the following steps:

[0115] In step S410, a configuration file of a current service process is acquired.

[0116] In step S420, a preset file path of memory state information in the configuration file is replaced by information processing guide information; the information processing guide information is guide information for sending the memory state information to a file generation control program for processing.

[0117] In step S430, when it is detected that the current service process is abnormal, current memory state information of the current service process is acquired.

[0118] In step S440, if it is detected that the configuration file includes the information processing guide information, the current memory state information is sent to the file generation control program according to an information sending mode preconfigured in the information processing guide information.

[0119] In step S450, the file generation control program is used to acquire a cumulative file generation number of the current service process in a preset time period.

[0120] In step S460, if the cumulative file generation number is less than a preset file generation number, the file generation control program is used to determine a current file generation strategy from a plurality of preset file generation strategies, and a file corresponding to the current memory state information is generated based on the current file generation strategy.

[0121] In the above file generation control method, the file generation control program selects a strategy with a shorter file generation time when the current service process is abnormal, and generates a file corresponding to the current memory state information, which shortens the file generation time of the file corresponding to the current memory state information, and enables the current service process to be used as soon as possible, thereby avoiding the defect that the file generation time is long in the traditional technology, and the recovery efficiency of the service process is low, and improving the recovery efficiency of the service process.

[0122] It should be understood that, although Figures 2-4 the steps in the flowchart of the method are displayed in sequence according to the arrows, these steps are not necessarily executed in sequence according to the arrows. Unless otherwise specified in this document, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, Figures 2-4 at least part of the steps in the method can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.

[0123] Figure 5is a block diagram of a file generation control apparatus according to an exemplary embodiment. Referring to Figure 5 The apparatus includes an information obtaining unit 510, a policy determining unit 520, and a file generation unit 530.

[0124] The information obtaining unit 510 is configured to perform obtaining current memory state information of a current service process when detecting that the current service process is abnormal.

[0125] The policy determining unit 520 is configured to perform sending the current memory state information to a file generation control program, and determining a current file generation policy from a plurality of preset file generation policies by the file generation control program; the current file generation policy is a policy in which a file generation time required by the file generation control program for the same memory state information is less than a preset file generation time; the preset file generation time is a file generation time required by an operating system corresponding to the current service process.

[0126] The file generation unit 530 is configured to perform generating a file corresponding to the current memory state information based on the current file generation policy

[0127] In an exemplary embodiment, the policy determining unit 520 is further configured to perform selecting a first file generation policy from the plurality of preset file generation policies as the current file generation policy by the file generation control program if an information amount occupied by the current memory state information is greater than or equal to a preset information amount; the first file generation policy is a policy for representing compressing the memory state information and generating a file corresponding to the compressed memory state information; and selecting a second file generation policy from the plurality of preset file generation policies as the current file generation policy by the file generation control program if the information amount occupied by the current memory state information is less than the preset information amount; the second file generation policy is a policy for representing generating the file corresponding to the memory state information according to a file generation efficiency greater than a preset file generation efficiency, the preset file generation efficiency representing a file generation efficiency of the operating system corresponding to the current service process.

[0128] In an exemplary embodiment, the file generation unit 530 is further configured to perform compressing the current memory state information by the file generation control program to obtain compressed current memory state information and generating a file corresponding to the compressed current memory state information if the current file generation policy is the first file generation policy; and determining a target file generation efficiency greater than the preset file generation efficiency by the file generation control program and generating the file corresponding to the current memory state information according to the target file generation efficiency if the current file generation policy is the second file generation policy.

[0129] In an example embodiment, the policy determining unit 520 is further configured to execute the file generation control program to acquire a cumulative file generation number of the current service process in a preset time period; and determine the current file generation policy from the preset plurality of file generation policies by the file generation control program if the cumulative file generation number is less than a preset file generation number.

[0130] In an example embodiment, the file generation control apparatus further comprises a policy configuring unit configured to execute acquiring file generation configuration information; determining a plurality of file generation policies corresponding to the file generation configuration information; and taking the plurality of file generation policies as the preset plurality of file generation policies if a file generation time represented by each of the plurality of file generation policies is less than a preset file generation time.

[0131] In an example embodiment, the file generation control apparatus further comprises an information replacing unit configured to execute acquiring a configuration file of the current service process; and replacing a preset file path of the memory state information in the configuration file with information processing guide information; the information processing guide information being guide information for sending the memory state information to the file generation control program for processing.

[0132] In an example embodiment, the policy determining unit 520 is further configured to execute sending the current memory state information to the file generation control program according to an information sending mode pre-configured in the information processing guide information if detecting that the configuration file includes the information processing guide information.

[0133] As to the apparatus in the above embodiments, the specific manners in which the respective modules perform operations have been described in detail in the embodiments of the method, and thus will not be described in detail here.

[0134] Figure 6 FIG. 6 is a block diagram illustrating an apparatus 600 for performing the file generation control method according to an example embodiment. For example, the apparatus 600 can be a server. Referring to Figure 6 The apparatus 600 includes a processing assembly 620, which further includes one or more processors, and a memory resource represented by a memory 622, for storing instructions, such as an application program, executable by the processing assembly 620. The application program stored in the memory 622 can include one or more than one module each corresponding to a set of instructions. In addition, the processing assembly 620 is configured to execute the instructions to perform the file generation control method described above.

[0135] The device 600 can also include a power supply component 624 configured to perform power management of the device 600, a wired or wireless network interface 626 configured to connect the device 600 to a network, and an input / output (I / O) interface 628. The device 600 can operate based on an operating system stored in the memory 622, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0136] In exemplary embodiments, a computer readable storage medium including instructions, such as the memory 622 including instructions, is also provided, which can be executed by the processor of the device 600 to complete the above-mentioned file generation control method. The computer readable storage medium can be a non-transitory computer readable storage medium, such as a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0137] In exemplary embodiments, a computer program product including instructions, which can be executed by the processor of the device 600 to complete the above-mentioned method, is also provided.

[0138] It should be noted that the above-mentioned apparatus, server, computer readable storage medium, computer program product, etc. according to the description of the method embodiments can also include other implementations, and the specific implementation can refer to the description of the related method embodiments, which will not be described here.

[0139] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features of the present disclosure disclosed herein. It is intended that the present disclosure cover any and all variations of the present disclosure including those variations that can be incorporated into other forms of the present disclosure that fall within the generic scope of the disclosure. It is intended that the specification and examples be considered exemplary only, with the true scope and spirit of the disclosure being indicated by the following claims.

[0140] It should be understood that the present disclosure is not limited to the precise structures herein described and illustrated, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the claims appended hereto.

Claims

1. A file generation control method, characterized in that, include: When an anomaly is detected in the current service process, the current memory state information of the current service process is obtained; The current memory state information is sent to the file generation control program, which then determines the current file generation strategy from a set of preset file generation strategies. This includes: if the amount of information occupied by the current memory state information is greater than or equal to a preset amount, the file generation control program selects a first file generation strategy from the preset strategies as the current file generation strategy. The first file generation strategy represents a strategy for compressing the memory state information and generating a file corresponding to the compressed memory state information. The current file generation strategy is one where, for the same memory state information, the file generation time required by the file generation control program is less than a preset file generation time. The preset file generation time is the file generation time required by the operating system corresponding to the current service process. Based on the current file generation strategy, generating a file corresponding to the current memory state information includes: if the current file generation strategy is the first file generation strategy, then compressing the current memory state information through the file generation control program to obtain compressed current memory state information, and generating a file corresponding to the compressed current memory state information.

2. The file generation control method according to claim 1, characterized in that, The step of determining the current file generation strategy from a set of preset file generation strategies through the file generation control program further includes: If the amount of information occupied by the current memory state information is less than the preset amount of information, then the file generation control program selects a second file generation strategy from the preset multiple file generation strategies as the current file generation strategy; the second file generation strategy is used to characterize the strategy of generating the file corresponding to the memory state information according to the file generation efficiency greater than the preset file generation efficiency, and the preset file generation efficiency is used to characterize the file generation efficiency of the operating system corresponding to the current service process.

3. The file generation control method according to claim 2, characterized in that, The step of generating a file corresponding to the current memory state information based on the current file generation strategy further includes: If the current file generation strategy is the second file generation strategy, then the file generation control program determines a target file generation efficiency that is greater than the preset file generation efficiency, and generates a file corresponding to the current memory state information according to the target file generation efficiency.

4. The file generation control method according to claim 1, characterized in that, The step of determining the current file generation strategy from a set of preset file generation strategies through the file generation control program further includes: The file generation control program obtains the cumulative number of file generation times of the current service process within a preset time period. If the cumulative number of file generation counts is less than the preset number of file generation counts, the file generation control program determines the current file generation strategy from a variety of preset file generation strategies.

5. The file generation control method according to claim 1, characterized in that, The preset multiple file generation strategies are obtained in the following way: Get the file generation configuration information; Multiple file generation strategies corresponding to the file generation configuration information are determined; the file generation time represented by each file generation strategy is less than the preset file generation time; The aforementioned multiple file generation strategies are used as the preset multiple file generation strategies.

6. The file generation control method according to claim 1, characterized in that, Before obtaining the current memory state information of the current service process when an anomaly is detected, the method further includes: Obtain the configuration file of the current service process; Replace the preset file path of the memory status information in the configuration file with information processing guidance information; the information processing guidance information is guidance information that sends the memory status information to the file generation control program for processing.

7. The file generation control method according to claim 6, characterized in that, Sending the current memory state information to the file generation control program includes: If the configuration file is found to contain the information processing guidance information, the current memory status information is sent to the file generation control program according to the information sending method pre-configured in the information processing guidance information.

8. A document generation control device, characterized in that, include: The information acquisition unit is configured to acquire the current memory state information of the current service process when an abnormality is detected in the current service process. The strategy determination unit is configured to send the current memory state information to the file generation control program, and then determine the current file generation strategy from a variety of preset file generation strategies through the file generation control program. The current file generation strategy is a strategy where, for the same memory state information, the file generation control program requires a file generation time that is less than the preset file generation time. The preset file generation time is the file generation time required by the operating system corresponding to the current service process. The file generation unit is configured to execute the current file generation strategy to generate a file corresponding to the current memory state information. The strategy determination unit is further configured to perform the following: if the amount of information occupied by the current memory state information is greater than or equal to a preset amount of information, then the file generation control program selects a first file generation strategy from a preset number of file generation strategies as the current file generation strategy. The first file generation strategy is used to characterize the strategy of compressing memory state information and generating a file corresponding to the compressed memory state information. The file generation unit is further configured to perform the following operation: if the current file generation strategy is the first file generation strategy, compress the current memory state information through the file generation control program to obtain compressed current memory state information, and generate a file corresponding to the compressed current memory state information.

9. The document generation control device according to claim 8, characterized in that, The strategy determination unit is further configured to perform the following: if the amount of information occupied by the current memory state information is less than the preset amount of information, then select a second file generation strategy from the preset multiple file generation strategies through the file generation control program as the current file generation strategy. The second file generation strategy is used to characterize the strategy of generating files corresponding to memory state information according to a file generation efficiency greater than a preset file generation efficiency. The preset file generation efficiency is used to characterize the file generation efficiency of the operating system corresponding to the current service process.

10. The document generation control device according to claim 9, characterized in that, The file generation unit is further configured to, if the current file generation strategy is the second file generation strategy, determine a target file generation efficiency greater than the preset file generation efficiency through the file generation control program, and generate a file corresponding to the current memory state information according to the target file generation efficiency.

11. The document generation control device according to claim 8, characterized in that, The strategy determination unit is further configured to execute the file generation control program to obtain the cumulative number of file generation times of the current service process within a preset time period; If the cumulative number of file generation counts is less than the preset number of file generation counts, the file generation control program determines the current file generation strategy from a variety of preset file generation strategies.

12. The document generation control device according to claim 8, characterized in that, The device further includes a strategy configuration unit, configured to perform the following: acquire file generation configuration information; determine multiple file generation strategies corresponding to the file generation configuration information; and ensure that the file generation time represented by each file generation strategy is less than the preset file generation time. The aforementioned multiple file generation strategies are used as the preset multiple file generation strategies.

13. The document generation control device according to claim 8, characterized in that, The device further includes an information replacement unit, configured to execute the acquisition of the configuration file of the current service process; and replace the preset file path of the memory state information in the configuration file with information processing guidance information; The information processing guidance information is the guidance information that sends the memory status information to the file generation control program for processing.

14. The document generation control device according to claim 13, characterized in that, The strategy determination unit is further configured to send the current memory state information to the file generation control program according to the information sending method pre-configured in the information processing guidance information if the configuration file is found to include the information processing guidance information.

15. A server, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the file generation control method as described in any one of claims 1 to 7.

16. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the server, the server is able to perform the file generation control method as described in any one of claims 1 to 7.

17. A computer program product, the computer program product comprising instructions, characterized in that, When the instruction is executed by the server's processor, it enables the server to perform the file generation control method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Dump file generation method and data probe installing and uninstalling method

    CN108170595A

  • Method for capturing application crash information and related equipment

    CN111258802A