CN116360968A - Resource processing method, device, equipment and storage medium - Google Patents

Resource processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN116360968A
CN116360968A CN202111628164.5A CN202111628164A CN116360968A CN 116360968 A CN116360968 A CN 116360968A CN 202111628164 A CN202111628164 A CN 202111628164A CN 116360968 A CN116360968 A CN 116360968A
Authority
CN
China
Prior art keywords
resource
file descriptor
information
application process
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111628164.5A
Other languages
Chinese (zh)
Inventor
黄涛
闫石
王旭飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202111628164.5A priority Critical patent/CN116360968A/en
Publication of CN116360968A publication Critical patent/CN116360968A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application discloses a resource processing method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by an application process, and screening target file descriptor resources with abnormal occupation states from the file descriptor resources occupied by the application process according to the resource statistical attribute information; determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource; and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the target resource occupancy information. By the method and the device, the running stability of the application process can be improved.

Description

Resource processing method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing resources.
Background
When an application process executes operations such as opening or creating a file, the kernel returns a file descriptor resource to the application process, wherein the file descriptor resource is an index created by the kernel for efficiently managing the file opened by the application process, and is a non-negative integer. In general, the file descriptor resources allowed to be occupied by the application process in the system are limited, so that after the application process finishes accessing the file, the file descriptor resources need to be released so that the application process has available file descriptor resources when opening the file next time, if the application process does not have available file descriptor resources, the system can report errors, and the operation failure of the application process is caused, so that the operation stability of the application process is affected.
Disclosure of Invention
The technical problem to be solved by the embodiments of the present application is to provide a method, an apparatus, a device, and a storage medium for processing resources, which can improve the running stability of an application process.
An aspect of an embodiment of the present application provides a resource processing method, including:
acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by an application process;
screening target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process according to the resource statistical attribute information;
Determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the target resource occupancy information.
An aspect of an embodiment of the present application provides a resource processing device, including:
the acquisition module is used for acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by the application process;
the screening module is used for screening target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process according to the resource statistical attribute information;
the determining module is used for determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource;
and the generation module is used for generating interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state according to the target resource occupation information.
The optional screening module screens the target file descriptor resources with the abnormal occupation state from the file descriptor resources occupied by the application process according to the resource statistical attribute information, and the method comprises the following steps:
from the resource statistical attribute information, analyzing the first resource occupation amount corresponding to the file descriptor resources belonging to the resource type Pi occupied by the application process; i is a positive integer less than or equal to N, and N is the number of resource types corresponding to the file descriptor resources occupied by the application process;
screening out the resource types of which the first resource occupation amount is larger than a first resource occupation amount threshold value from the resource types of the file descriptor resources occupied by the application process;
and determining the file descriptor resources belonging to the screened resource types as target file descriptor resources with the resource occupation state being an abnormal occupation state.
Optionally, the screening module screens out a resource type with a first resource occupation amount greater than a first resource occupation amount threshold from resource types to which the file descriptor resources occupied by the application process belong, including:
accumulating the first resource occupation amount to obtain the total resource occupation amount corresponding to the file descriptor resources occupied by the application process;
Determining the resource occupation state of the application process about file descriptor resources according to the total resource occupation amount;
and if the resource occupation state of the application process about the file descriptor resource is an abnormal occupation state, screening out the resource type of which the first resource occupation amount is larger than a first resource occupation amount threshold from the resource types of the file descriptor resource occupied by the application process.
The screening module is configured to determine, according to the total amount of resource occupation, a resource occupation state of the application process with respect to a file descriptor resource, and includes:
acquiring the occupation amount of the limited resources corresponding to the application process;
determining the ratio of the total occupied resources to the limited occupied resources as the resource occupancy rate of the application process;
and if the resource occupancy rate is larger than the resource occupancy rate threshold value, determining that the resource occupancy state of the application process about the file descriptor resource is an abnormal occupancy state.
Optionally, the determining module determines, according to the resource basic attribute information of the target file descriptor resource, target resource occupation information for describing that the application process occupies the target file descriptor resource, including:
Determining an operation instruction occupying the target file descriptor resource in the application process according to the resource basic attribute information of the target file descriptor resource;
calling a hook function, and acquiring stack information associated with the operation instruction from execution data of the operation instruction;
and determining the stack information associated with the operation instruction as target resource occupation information for describing that the application process occupies the target file descriptor resource.
Optionally, the resource basic attribute information of the target file descriptor resource includes a resource type of the target file descriptor resource; the determining module determines target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource, and the determining module comprises the following steps:
if the resource type of the target file descriptor resource is a socket type or a shared memory type, determining memory snapshot information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource;
if the resource type of the target file descriptor resource is a file type, determining file path description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource;
And if the resource type of the target file descriptor resource is an event type, determining the thread description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource.
Optionally, the target resource occupation information is the stack information, the thread description information or the file path description information; the generating module generates interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state according to the target resource occupation information, and the method comprises the following steps:
object attribute information of a first occupied object occupying the target file descriptor resource in the application process and second resource occupation amount corresponding to the target file descriptor resource occupied by the first occupied object are analyzed from the target resource occupation information;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the first occupancy object and the second resource occupancy amount.
Optionally, the generating module generates, according to the object attribute information of the first occupied object and the second resource occupation amount, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state, including:
Screening out a target occupied object of which the corresponding second resource occupation amount is larger than a second resource occupation amount threshold value from a first occupied object of which the target file descriptor resource is occupied in the application process;
and determining the object attribute information of the target occupied object and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state.
Optionally, the resource type of the target file descriptor resource is a socket type, and the target resource occupation information is memory snapshot information; the generating module generates interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state according to the target resource occupation information, and the method comprises the following steps:
resolving object attribute information of a second occupied object from the memory snapshot information; the second occupied object is an object which occupies the target file descriptor resource in the application process and is associated with socket communication;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the second occupancy object.
Optionally, the resource type of the target file descriptor resource is a shared memory type, and the target resource occupation information is memory snapshot information; the generating module generates interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state according to the target resource occupation information, and the method comprises the following steps:
object attribute information of a third occupied object is analyzed from the memory snapshot information; the third occupied object is an object which occupies the target file descriptor resource in the application process and is associated with database file inquiry;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the third occupancy object.
In one aspect, the present application provides a computer device comprising: a processor and a memory;
wherein the memory is used for storing a computer program, and the processor is used for occupying the computer program to execute the following steps:
acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by an application process;
Screening target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process according to the resource statistical attribute information;
determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the target resource occupancy information.
In one aspect, the present application provides a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, perform the steps of:
acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by an application process;
screening target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process according to the resource statistical attribute information;
Determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the target resource occupancy information.
An aspect of the embodiments of the present application provides a computer program product comprising a computer program/instruction which, when executed by a processor, performs the steps of the method described above:
acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by an application process;
screening target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process according to the resource statistical attribute information;
determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the target resource occupancy information.
In the application, the computer device can detect the resource statistical attribute information and the resource basic attribute information of the file descriptor resources occupied by the application process in real time or periodically, and screen the target file descriptor resources with the abnormal occupied state from the file descriptor resources occupied by the application process according to the resource statistical attribute information, namely, the target file descriptor resources occupy too many file descriptor resources for the application process. Further, the computer device may determine, according to the basic attribute information of the resource, target resource occupation information for describing that the application process occupies a target file description resource, locate, according to the target resource occupation information, a cause of the resource occupation state of the target file descriptor resource being an abnormal occupation state, and generate, according to the cause, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state. That is, according to the basic attribute information of the target file description resource, the analysis data (i.e. the target resource occupation information) for analyzing that the resource occupation state of the target file descriptor resource is the abnormal occupation state is adaptively selected, so that the reason that the resource occupation state of the target file descriptor resource is the abnormal occupation state can be rapidly positioned, the positioning efficiency and accuracy are improved, the abnormal occupation problem of the file descriptor resource is solved in an auxiliary manner, and the running stability of an application process is improved. Meanwhile, in the positioning process, only the target resource occupation information is needed to be analyzed, the analysis of the running data of the whole application process is not needed, the analysis of unnecessary data is avoided, the resources of computer equipment can be saved, and the positioning efficiency is further improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for allocating file descriptor resources for an application process provided herein;
FIG. 2 is a flow chart of a method for allocating file descriptor resources for an application process provided herein;
FIG. 3 is a flow chart of a method for allocating file descriptor resources for an application process provided herein;
FIG. 4 is a schematic diagram of an architecture of a resource processing system provided herein;
FIG. 5 is a schematic flow chart of a first resource processing method provided in the present application;
FIG. 6 is a flow chart of a first resource processing method provided in the present application;
FIG. 7 is a flowchart of locating a resource occupancy state of a target file resource descriptor as a cause of an abnormal occupancy state according to memory snapshot information, thread description information, and file path description information;
FIG. 8 is a flowchart for locating a resource occupancy state of a target file resource descriptor as a cause of an abnormal occupancy state according to stack information provided in the present application;
fig. 9 is a schematic structural diagram of a resource processing device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
First, terms involved in the embodiments of the present application will be described:
application process: is a running activity of an application program with a certain independent function with respect to a certain data set. The system is a basic unit for dynamic execution of an operating system, and in the operating system, application processes are basic allocation units and basic execution units. An application process may generally include several threads, which may utilize resources owned by the application process, in an operating system that introduces the threads, the application process is generally used as a basic unit for allocating resources, and the threads are used as basic units for independent running and independent scheduling, because the threads are smaller than the application process and do not consume resources of the operating system basically, the cost for scheduling the threads is relatively less, and the degree of concurrent execution among multiple application programs in the operating system can be improved more effectively. Applications here include, but are not limited to: social applications, browser applications, gaming applications, payment applications, multimedia playing applications, and so forth.
File descriptor resources: the file descriptor resource is an index created by a kernel for efficiently managing files opened by an application process, and is a non-negative integer; that is, an application process running in the device needs to allocate file descriptor resources for the application process when executing operation instructions related to opening a file. For example, as shown in table 1, the operation instructions associated with opening a file may include, but are not limited to: file read-write operation, thread creation, starting a thread or thread class (HandlerThread), window creation (Window), socket communication, database file inquiry, picture notification sending and other operation instructions. The Handler Thread may be referred to herein as a Thread or a Thread class, which is a subclass of Thread, and the Handler Thread itself carries a Looper so that it can reuse the current Thread through a message queue, saving system resource overhead. Looper is a class used to execute messages in a message queue. Window may refer to an interactive Window including, but not limited to: web windows on browser applications, session windows in social applications, game interaction windows in game applications, and so forth. Socket is an abstraction of endpoints that perform bi-directional communication between application processes on different hosts in a network. One socket is the end of the network where processes communicate, providing a mechanism for application layer processes to exchange data using network protocols. In terms of the position, the socket is connected with the application process in an upper mode, and the socket is connected with the network protocol stack in a lower mode, so that the socket is an interface for the application program to communicate through the network protocol, and is an interface for the application program to interact with the network protocol stack.
When the application process executes File read-write operation, the File description resource allocated to the application process may be referred to as a File descriptor resource of a File (File) type; when the application process executes a Socket communication instruction or creates a Window instruction, the file description resource allocated to the application process can be called a Socket type file descriptor resource; when the application process executes a start Handler Thread instruction, the file description resource allocated to the application process may be referred to as an event (Eventfd/Eventpoll) type file descriptor resource; when the application process executes a Java thread creating instruction, a database inquiring instruction and a message instruction including pictures is sent, file description resources allocated to the application process can be called file descriptor resources of an anonymous shared memory (Ashmem) type, and the file descriptor resources are called shared memory type for short. Eventfd/Eventpoll herein each refer to a file descriptor resource for the event type of the message notification; the Ashmem is Android Shared Memory and is a memory sharing mechanism provided by an Android operating system (Android).
Table 1:
Figure BDA0003439202230000081
Figure BDA0003439202230000091
the following describes an example of allocating file description resources to an application process when the application process executes a start HandlerThread instruction, a create Window instruction, and a database file query instruction.
1. Launch the HandlerThread instruction
As shown in FIG. 1, the Handler Thread creates a Looper in the Thread of the application process, adopts a Looper to poll the message queue, and when a time-consuming task enters the message queue, the new Thread does not need to be started, and the task can be executed in the original Thread. When an application process executes a start Handler Thread instruction, it is necessary to allocate an event type file descriptor resource to the application process, the event type file descriptor resource being used for message notification. When an application process executes a start Handler Thread instruction, a specific process of allocating a file descriptor resource of an event type to the application process may include the following steps 1-3: 1. invoking a loop creation function to create a Message Queue (Message Queue) including a Message ID associated with a Handler Thread, a Message processing object, processed data, and the like; for example, the loop creation function may include a function looper. 2. The Looper object is created at the Native service (Native) layer of the operating system for reading messages from the message queue, i.e. one Looper is required for one message queue, which may be referred to as the Native service layer of the operating system for providing Native services and link libraries etc. 3. A loop function is called, a message loop is entered, and file descriptor resources of two event types, namely one eventfd and one eventpoll, are allocated, which are used to notify messages. For example, the loop function may refer to the loop function looper.
2. Creating Window instruction
As shown in fig. 2, creating Window may refer to creating a Window, for example, an application program corresponding to the application process is a social chat application, and creating the Window may refer to creating a session Window; if the application program corresponding to the application process is a browser application, creating a window may mean opening a web page window of the browser. When an application process executes a create Window instruction, it is necessary to allocate a socket type file descriptor resource to the application process, where the socket type file descriptor resource is used to pass an input (input) event. When an application process executes a create Window instruction, a specific process of allocating a file descriptor resource of a socket type to the application process may include the following steps 4-6: 4. calling a window creation function to create a window; for example, the Window creation function may include calling a Window management service add Window function Window Manager service. 5. Calling an attribute setting function, setting window attributes of a window, wherein the window attributes comprise the size of the window; for example, the attribute setting function may include a Window attribute setting function Window State.
3. Database file query instructions
As shown in fig. 3, the database file query instruction is configured to search a file from a database, and when the application process executes the database file query instruction, it is required to allocate a file descriptor resource of a shared memory type to the application process, where the file descriptor resource of the shared memory type is used to associate an anonymous shared memory, and the anonymous shared memory is used to store a query result. When an application process executes a database file query instruction, a specific process of allocating a file descriptor resource of a shared memory type to the application process comprises the following steps 7-8: the specific flow is as follows: 7. receiving a database file query request; 8. invoking abstract window cursor abstract window classes, and generating a cursor window CursorWindow object on a Native layer of the system; 9. allocating file descriptor resources of a shared memory type for associating an anonymous shared memory, the anonymous shared content being used to store a query result; cursorWindow may be referred to herein as a window for database file queries.
In summary, when the number of application programs running in the computer device increases, the number of file description resources occupied by the application process corresponding to the application program increases, that is, the number of available file description resources of the application process decreases, and if the number of file description resources occupied by the application process is too large, the system may report errors, causing the running failure of the application process and affecting the running stability of the application process. Based on this, the application proposes a resource processing method, which includes: the computer equipment can detect the resource statistical attribute information and the resource basic attribute information of the file descriptor resources occupied by the application process in real time or periodically, and screen out the target file descriptor resources with the resource occupied state being the abnormal occupied state from the file descriptor resources occupied by the application process according to the resource statistical attribute information, namely the target file descriptor resources occupy too many file descriptor resources for the application process. Further, the computer device may determine, according to the basic attribute information of the resource, target resource occupation information for describing that the application process occupies a target file to describe the resource corresponding to the resource occupation information, locate, according to the target resource occupation information, a reason why the resource occupation state of the target file descriptor resource is an abnormal occupation state, and generate, according to the reason, interpretation information for explaining that the resource occupation state of the target file descriptor resource is the abnormal occupation state, that is, where the interpretation information may be used to reflect the reason why the resource occupation state of the target file descriptor resource is the abnormal occupation state, for example, the interpretation information may be used to reflect that file descriptor resources occupying too many target resource types due to a certain thread, a file path, and so on, so that the resource occupation state of the target file descriptor resource is the abnormal occupation state. That is, according to the basic attribute information of the target file description resource, the analysis data (i.e. the target resource occupation information) for analyzing that the resource occupation state of the target file descriptor resource is the abnormal occupation state is adaptively selected, so that the reason that the resource occupation state of the target file descriptor resource is the abnormal occupation state can be rapidly positioned, the positioning efficiency and accuracy are improved, the abnormal occupation problem of the file descriptor resource is solved in an auxiliary manner, and the running stability of an application process is improved. Meanwhile, in the positioning process, only the target resource occupation information is needed to be analyzed, the analysis of the running data of the whole application process is not needed, the analysis of unnecessary data is avoided, the resources of computer equipment can be saved, and the positioning efficiency is further improved.
For a clearer understanding of the present application, a resource processing system implementing the resource processing method of the present application is first described, as shown in fig. 4, where the resource processing system includes a server 10 and a terminal cluster, where the terminal cluster may include one or more terminals, and as shown in fig. 4, the number of the terminals will not be limited. As shown in fig. 4, the terminal cluster may specifically include a terminal 1, a terminal 2, a terminal …, and a terminal n; it will be appreciated that terminals 1, 2, 3, …, n may all be network connected to the server 10, so that each terminal may interact with the server 10 via a network connection.
The server 10 may refer to a device for providing a back-end service for an application program, for example, the server may refer to a back-end device for running or maintaining the application program. Specifically, the server 10 may receive a reason for the abnormal occupation state of the resource occupation state of the file descriptor resource sent by the terminal, and maintain the application according to the reason. Each terminal may refer to a user-oriented device, and a terminal may refer to a device for an application to provide a front-end service. The server 10 may be configured to detect whether a file descriptor resource occupied by an application process corresponding to an application program running in a terminal is in an abnormal occupied state, and if the resource occupied state of the file descriptor resource occupied by the application process is in the abnormal occupied state, locate a reason why the resource occupied state of the file descriptor resource is in the abnormal occupied state according to the resource occupied information.
The server may be an independent physical server, a server cluster or a distributed system formed by at least two physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a medium-volume delivery network (Content Delivery Network, CDN), basic cloud computing services such as big data and an artificial intelligent platform. The terminal may specifically refer to, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a screen speaker, a smart watch, and the like. The terminals and the servers may be directly or indirectly connected through wired or wireless communication, and meanwhile, the number of the terminals and the servers may be one or at least two, which is not limited herein.
Further, please refer to fig. 5, which is a flowchart illustrating a resource processing method according to an embodiment of the present application. As shown in fig. 5, the method may be performed by the terminal in fig. 1, may be performed by the server in fig. 1, or may be performed by both the terminal and the server in fig. 1, where an apparatus for performing the method may be collectively referred to as a computer device in this application. The resource processing method may include the following steps S101 to S104:
S101, acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by an application process.
The computer equipment can detect the file descriptor resources occupied by the application process in real time or periodically to obtain the resource statistical attribute information and the resource basic attribute information of the file descriptor resources; the resource statistical attribute information comprises one or more of the resource quantity corresponding to the file descriptor resources of various resource types occupied by the application process or the resource quantity corresponding to the file descriptor resources occupied by the application process; the resource basic attribute information includes one or more of a resource type, an object in which the file descriptor resource is occupied, a resource identification, and the like, and the resource type includes one or more of a shared memory type, a socket type, an event type, and the like. The application process may refer to any application process of the currently running application processes in the computer device, or the application process may refer to a target application process of the currently running application processes in the computer device; for example, the target application process may refer to an application process with the longest running time in the application processes currently running in the computer device, or an application process with a frequency greater than a frequency threshold when the resource occupation state of the file descriptor resource is detected to be an abnormal occupation state in the historical time period.
S102, according to the resource statistical attribute information, screening out target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process.
The computer equipment can screen out the target file descriptor resources with the resource occupation state being the abnormal occupation state in the following two modes; mode one: the computer equipment can detect whether the resource occupation state of the file descriptor resource occupied by the application process has an abnormal occupation state according to the resource statistical attribute information, and if the abnormal occupation state does not exist, the computer equipment ends the flow; if the abnormal occupation state exists, screening a target resource type corresponding to the file descriptor resource with the abnormal occupation state from the resource types of the file descriptor resource occupied by the application process according to the resource statistical attribute information; determining file description resources belonging to the target resource type as target file descriptor resources with the resource occupation state being an abnormal occupation state; this can improve the efficiency of detection. Mode two: the computer equipment can directly detect the resource occupation state of the file descriptor resources of each resource type according to the resource statistical attribute information to obtain target file descriptor resources with the resource occupation state of abnormal occupation state; therefore, the more detailed detection of the resource occupation state of the file descriptor resource can be realized, and the detection accuracy is improved.
S103, determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource.
After the computer equipment allocates the file descriptor resource for the application process, resource occupation information describing that the application process occupies the file descriptor resource is generated; therefore, when the computer device needs to locate the reason that the resource occupation state of the application process about the file descriptor resource of the target resource type is the abnormal occupation state, the computer device can determine the target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource. That is, different target file descriptor resources are used for describing that the application process occupies different target resource occupation information corresponding to the target file descriptor resources; by adaptively selecting analysis data (i.e., target resource occupation information) for locating the abnormal occupation state of the resource occupation state of the target file descriptor resource according to the basic attribute information of the resource, the whole operation data of the application process does not need to be analyzed, unnecessary data is avoided from being analyzed, the resource of computer equipment can be saved, and the locating efficiency is further improved.
S104, according to the target resource occupation information, generating interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state.
The computer equipment can analyze the target resource occupation information to obtain the reason that the resource occupation state of the target file descriptor resource is the abnormal occupation state, and according to the reason, the explanation information for explaining that the resource occupation state of the target file descriptor resource is the abnormal occupation state is generated, so that the problem that the resource occupation state of the target file descriptor resource is the abnormal occupation state is solved in time by a user, and the running stability of an application process is improved.
In the application, the computer device can detect the resource statistical attribute information and the resource basic attribute information of the file descriptor resources occupied by the application process in real time or periodically, and screen the target file descriptor resources with the abnormal occupied state from the file descriptor resources occupied by the application process according to the resource statistical attribute information, namely, the target file descriptor resources occupy too many file descriptor resources for the application process. Further, the computer device may determine, according to the basic attribute information of the resource, target resource occupation information for describing that the application process occupies a target file description resource, locate, according to the target resource occupation information, a cause of the resource occupation state of the target file descriptor resource being an abnormal occupation state, and generate, according to the cause, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state. That is, according to the basic attribute information of the target file description resource, the analysis data (i.e. the target resource occupation information) for analyzing that the resource occupation state of the target file descriptor resource is the abnormal occupation state is adaptively selected, so that the reason that the resource occupation state of the target file descriptor resource is the abnormal occupation state can be rapidly positioned, the positioning efficiency and accuracy are improved, the abnormal occupation problem of the file descriptor resource is solved in an auxiliary manner, and the running stability of an application process is improved. Meanwhile, in the positioning process, only the target resource occupation information is needed to be analyzed, the analysis of the running data of the whole application process is not needed, the analysis of unnecessary data is avoided, the resources of computer equipment can be saved, and the positioning efficiency is further improved.
Further, please refer to fig. 6, which is a flowchart illustrating a resource processing method according to an embodiment of the present application. As shown in fig. 6, the method may be performed by the terminal in fig. 1, may be performed by the server in fig. 1, or may be performed by both the terminal and the server in fig. 1, where an apparatus for performing the method may be collectively referred to as a computer device in this application. The resource processing method may include the following steps S201 to S207:
s201, acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by an application process.
S202, analyzing the first resource occupation amount corresponding to the file descriptor resources belonging to the resource type Pi occupied by the application process from the resource statistical attribute information; i is a positive integer less than or equal to N, and N is the number of resource types corresponding to the file descriptor resources occupied by the application process.
S203, screening out the resource types of which the first resource occupation amount is larger than a first resource occupation amount threshold value from the resource types of the file descriptor resources occupied by the application process.
Alternatively, the computer device may determine the first resource amount occupancy threshold by: mode one: and determining a first resource quantity occupation threshold corresponding to each resource type according to the application program and the resource type corresponding to the application process, wherein the first resource quantity occupation thresholds corresponding to different resource types in the same application process are different, and the first resource quantity occupation thresholds corresponding to the same resource type in different application processes can be different. For example, in a social application, the number of times the start of the Handler Thread instruction is executed is relatively large, i.e., more event-type file descriptor resources are required; the database file queries are performed a fewer number of times, i.e., fewer shared memory-type file descriptor resources are required. Therefore, in the application process corresponding to the social application program, the first value may be determined as the first resource amount occupation threshold corresponding to the event type, and the second value may be determined as the first resource amount occupation threshold corresponding to the shared memory type, where the first value is greater than the second value. At this time, if in the application process corresponding to the social application program, if the first resource amount corresponding to the file description resource of the event type occupied by the application process is greater than the first numerical value, determining that the resource occupancy state of the file descriptor resource of the event type is an abnormal occupancy state; if the first resource amount corresponding to the file descriptor resources of the shared memory type occupied by the application process is larger than the second value, determining that the resource occupancy state of the file descriptor resources of the shared memory type is in an abnormal occupancy state. For another example, in an application program for querying a database file, the number of times of executing the database file querying instruction is relatively large, that is, more file descriptor resources of the shared memory type are needed, so that a third value may be determined as a first resource amount occupation threshold corresponding to the shared memory type, and the third value may be greater than the second value. At this time, if the application process occupies the file descriptor resource of the shared memory type by more than the third value corresponding to the first resource amount, it is determined that the resource occupancy state of the file descriptor resource of the shared memory type is in an abnormal occupancy state.
Mode two: the computer device may determine, according to an application program corresponding to the application process, a first resource amount occupation threshold corresponding to each resource type, that is, for the same application process, the first resource amount occupation thresholds corresponding to different resource types may be the same, and in different application processes, the first resource amount occupation thresholds corresponding to the same resource type may be different. For example, the computer device may obtain a frequency of use of the application program in a historical time period, and determine a first resource amount occupation threshold corresponding to each resource type according to the frequency of use; such as social applications, are used more frequently than applications for database file queries. Therefore, when the application process of the social application program is running, the fourth value can be determined as a first resource amount occupation threshold corresponding to each resource type; when an application process of the social application program is operated, the fifth numerical value can be determined as a first resource amount occupation threshold corresponding to each resource type; the fifth value is less than the fourth value.
Mode three: the computer device may determine the first resource occupancy threshold according to a first resource occupancy corresponding to each resource type in the application process, for example, the computer device may determine the first resource occupancy threshold according to an average value of first resource occupancy corresponding to each resource type in the application process; or, the computer device may determine the first resource occupation threshold according to the maximum K first resource occupation amounts in the first resource occupation amounts corresponding to the various resource types in the application process, where K is a positive integer.
Optionally, the screening the resource type with the first resource occupation amount greater than the first resource occupation amount threshold from the resource types to which the file descriptor resources occupied by the application process belong includes: accumulating the first resource occupation amount to obtain the total resource occupation amount corresponding to the file descriptor resources occupied by the application process; and determining the resource occupation state of the application process about file descriptor resources according to the total resource occupation amount. And if the resource occupation state of the application process about the file descriptor resource is an abnormal occupation state, screening out the resource type of which the first resource occupation amount is larger than a resource occupation amount threshold value from the resource types of the file descriptor resource occupied by the application process.
The computer equipment can detect wholly and then detect locally, namely detect whether the resource occupation state of the file descriptor resource of the application process is in an abnormal occupation state at first, if the resource occupation state of the file descriptor resource of the application process is not in the abnormal occupation state, the process can be ended; if the resource occupation state of the file descriptor resource of the application process is in the abnormal occupation state, locating the target file descriptor resource of which the resource occupation state is in the abnormal occupation state. Specifically, the computer device may perform summation processing on the first resource occupation amount corresponding to each resource type to obtain a total resource occupation amount corresponding to the file descriptor resource occupied by the application process, and determine, according to the total resource occupation amount, a resource occupation state of the application process with respect to the file descriptor resource. If the resource occupation state of the application process about the file descriptor resource is an abnormal occupation state, which indicates that the total resource occupation amount of the file descriptor resource occupied by the application process is excessive, screening out the resource type of which the first resource occupation amount is larger than the resource occupation amount threshold value from the resource types of the file descriptor resource occupied by the application process; that is, if the application process is not in an abnormal occupation state with respect to the resource occupation state of the file descriptor resource, it is unnecessary to perform the subsequent steps, which can improve the detection efficiency.
Optionally, the determining, according to the total amount of resource occupation, a resource occupation state of the application process about a file descriptor resource includes: and acquiring the limited resource occupation amount corresponding to the application process, determining the ratio between the total resource occupation amount and the limited resource occupation amount as the resource occupation rate of the application process, and if the resource occupation rate is larger than a resource occupation rate threshold value, determining that the resource occupation state of the application process about file descriptor resources is an abnormal occupation state.
The computer device may obtain a limited resource occupation amount corresponding to the application process, where the limited resource occupation amount is the maximum available resource amount of the application process, and the limited resource occupation amount may be determined according to one or more of an operating system version of the computer device and attribute information of an application program corresponding to the application process, where the attribute information of the application program may include a use frequency, an importance, and so on. Further, determining the ratio between the total occupied resource amount and the limited occupied resource amount as the occupied resource rate of the application process, and if the occupied resource rate is smaller than or equal to the threshold value of the occupied resource rate, indicating that the occupied file descriptor resource of the application process does not reach the upper limit, thereby determining that the occupied resource state of the application process about the file descriptor resource is a normal occupied state; if the resource occupancy is greater than the resource occupancy threshold, indicating that the occupied file descriptor resource of the application process reaches an upper limit, and therefore determining that the resource occupancy state of the application process with respect to the file descriptor resource is an abnormal occupancy state.
S204, determining the file descriptor resources belonging to the screened resource types as target file descriptor resources with the resource occupation state being an abnormal occupation state.
In steps S202 to S204, if the application process occupies too many file descriptor resources of a certain resource type, it indicates that the application process does not timely recover or release the file descriptor resources of the resource type after occupying the corpus descriptor resources of the resource type, and at this time, it may be said that the resource occupancy state of the file descriptor resources of the resource type occupied by the application process is in an abnormal occupancy state, or it may be said that the file descriptor resources of the resource type have leakage. Therefore, the computer device may parse the resource occupation amount corresponding to the file descriptor resource of the resource type Pi occupied by the application process from the resource statistical attribute information, and determine the parsed resource occupation amount as the first resource occupation amount. Further, from the resource types to which the file descriptor resources occupied by the application process belong, the resource types to which the first resource occupation amount is larger than the first resource occupation amount threshold value can be screened out, the screened resource types are determined to be the resource types corresponding to the file descriptor resources with the abnormal occupation state, and the file descriptor resources belonging to the screened resource types are determined to be the target file descriptor resources with the abnormal occupation state.
S205, determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource.
The computer device may determine the target resource occupancy information describing that the application process occupies the target file descriptor resource in any one or a combination of the following two ways; mode one: the computer equipment can determine an operation instruction occupying the target file descriptor resource in the application process according to the resource basic attribute information of the target file descriptor resource, call a hook function and acquire stack information associated with the operation instruction from execution data of the operation instruction; and determining the stack information associated with the operation instruction as target resource occupation information for describing that the application process occupies the target file descriptor resource.
In a first mode, the computer device may determine, according to the basic attribute information of the resource, an operation instruction of occupying the file descriptor resource of the target resource type in the application process, where the operation instruction includes an operation instruction related to opening open, socket, eventfd, creating anonymous memory sharing ashmem_create_region, and the like, and then call a hook function to obtain stack information related to the operation instruction from execution data of the operation instruction, where the stack information may refer to resource occupancy information of storing the file descriptor resource related to the occupation of the operation instruction in a data structure corresponding to the stack. Thus, the stack information associated with the operation instruction may be determined as target resource occupancy information for describing that the application process occupies the target file descriptor resource; the reason that the resource occupation state of the target file descriptor resource is the abnormal state can be comprehensively positioned through the stack information, and the positioning accuracy is improved.
Mode two: the resource basic attribute information of the target file descriptor resource comprises the resource type of the target file descriptor resource; if the resource type of the target file descriptor resource is a socket type or a shared memory type, determining memory snapshot information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource; if the resource type of the target file descriptor resource is a file type, determining file path description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource; if the resource type of the target file descriptor resource is an event type, determining the thread description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource.
In the second mode, as shown in table 2, when the application process is executing the Socket communication instruction, if the application process includes 19 Socket objects and 11 Window objects, 34 Socket type file description resources need to be allocated. When an application process is executing operation instructions such as database file inquiry and the like, if the application process comprises 16 CursorWindow objects, 16 file descriptor resources (i.e. per dev/ashmem) with shared memory types need to be created. In general, execution data of operation instructions such as socket communication and database file inquiry are recorded in memory snapshot information related to an application process, so if the target resource type is a socket type or a shared memory type, the memory snapshot information related to the application process can be determined as target resource occupation information for describing that the application process occupies the target file descriptor resource. Similarly, as shown in table 2, when the application process performs the file read-write operation, file description resources of file types such as/data/data/,/storage/scheduled/,/apex/,/system/, etc. need to be allocated to the application process, and the file path description information is used for recording the execution data of the file read-write operation; therefore, if the target resource type is the file type, determining the file path description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource. Similarly, as in table 2, when the start Handler Thread instruction is executed generally, it is necessary to allocate a file description resource of an event type for an application process, and Thread description information is generally used to record execution data of the start Handler Thread instruction, so if the target resource type is the event type, thread description information associated with the application process is determined as target resource occupation information for describing that the application process occupies the target file descriptor resource. The analysis data (namely, the target resource occupation information) for analyzing the abnormal occupation state of the resource occupation state of the target file descriptor resource is adaptively selected according to the resource type corresponding to the target file description resource, so that the accuracy and the positioning efficiency of positioning are improved.
Table 2:
Figure BDA0003439202230000191
s206, according to the target resource occupation information, generating explanation information for explaining that the resource occupation state of the target file descriptor resource is abnormal occupation state.
Optionally, the target resource occupation information is the thread description information or the file path description information; the step S206 includes: object attribute information of a first occupied object occupying file descriptor resources of the target resource type in the application process and second resource occupation quantity corresponding to the file descriptor resources of the target resource type occupied by the first occupied object are analyzed from the target resource occupation information; and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the first occupancy object and the second resource occupancy amount.
For example, when the target resource occupation information is thread description information, the first occupation object is a thread in an application process, and the computer device may parse, from the thread description information, object attribute information of the thread occupying the target file description resource in the application process, and a second resource occupation amount corresponding to the target file descriptor resource occupied by the thread, where the object attribute information of the thread includes an identifier of the thread, an execution time of the thread, and so on. The computer device may determine the object attribute information of all threads and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state, or may determine the object attribute information of the thread corresponding to the second resource occupation amount which is topn (n may be a positive integer) and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state. That is, the reason why the interpretation information is used to indicate that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state is: as a result of the thread occupying too many object file descriptor resources; by analyzing the thread description information, the reason that the resource occupation state of the target file descriptor resource is an abnormal occupation state due to the fact that the thread occupies too many target file descriptor resources can be located.
For another example, when the target resource occupation information is file path description information, the first occupation object is a file path, and the computer device may parse, from the file path description information, object attribute information of the file path occupying the target file description resource in the application process, and a second resource occupation amount corresponding to the target file descriptor resource occupied by the file path, where the object attribute information of the file path includes an identifier, a port, and the like of the file path. The computer device may determine the object attribute information of all the file paths and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state, or may determine the object attribute information of the file path corresponding to the second resource occupation amount which is topn (n may be a positive integer) and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state. That is, the reason why the interpretation information is used to indicate that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state is: as the file path occupies excessive target file descriptor resources; by analyzing the file path description information, the reason that the resource occupation state of the target file descriptor resource is an abnormal occupation state due to the fact that the file path occupies too many target file descriptor resources can be located.
For another example, when the target resource occupation information is stack information, the first occupation object is a stack, and the computer device may parse, from the stack information, object attribute information of the stack occupying the target file description resource in the application process, and a second resource occupation amount corresponding to the target file descriptor resource occupied by the stack, where the object attribute information of the stack includes a name of the stack, and so on. The computer device may determine the object attribute information of all stacks and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state, or may determine the object attribute information of stacks corresponding to the second resource occupation amount of topn (n may be a positive integer) and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state. That is, the reason why the interpretation information is used to indicate that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state is: due to the stack occupying excessive target file descriptor resources; by analyzing the stack information, the reason that the resource occupation state of the target file descriptor resource is an abnormal occupation state due to the fact that the stack occupies too many target file descriptor resources can be located.
Optionally, the generating, according to the object attribute information of the first occupied object and the second resource occupation amount, the interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state includes: screening out a target occupied object of which the corresponding second resource occupation amount is larger than a second resource occupation amount threshold value from a first occupied object of the file descriptor resource occupying the target resource type in the application process; and determining the object attribute information of the target occupied object and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state.
For example, when the target resource occupation information is thread description information, the computing device may screen out a target thread whose corresponding second resource occupation amount is greater than a second resource occupation amount threshold value from threads occupying the target file descriptor resource in the application process, that is, screen out n threads whose corresponding second resource occupation amount is the largest from threads occupying the file descriptor resource of the target resource type in the application process, as the target threads. Further, the object attribute information of the target thread and the second resource occupation amount are determined as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state.
For another example, when the target resource occupation information is file path description information, the computing device may screen out a target file path corresponding to the second resource occupation amount greater than the second resource occupation amount threshold from file paths occupying the target file descriptor resource in the application process, that is, screen out n file paths corresponding to the second resource occupation amount with the largest value from file paths occupying the file descriptor resource of the target resource type in the application process, as target file paths. Further, the object attribute information of the target file path and the second resource occupation amount are determined as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state.
For another example, when the target resource occupation information is stack information, the computing device may screen out a target stack corresponding to the second resource occupation amount greater than the second resource occupation amount threshold from among stacks occupying the target file descriptor resource in the application process, that is, screen out n stacks corresponding to the second resource occupation amount with the largest second resource occupation amount from among stacks occupying the file descriptor resource of the target resource type in the application process, as the target stack. Further, the object attribute information of the target stack and the second resource occupation amount are determined as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state.
Optionally, the resource type of the target file descriptor resource is a socket type, and the target resource occupation information is memory snapshot information; the generating, according to the target resource occupation information, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state includes: resolving object attribute information of a second occupied object from the memory snapshot information; and the second occupied object is a file descriptor resource occupying the target resource type in the application process, and an object associated with socket communication generates interpretation information for interpreting that the resource occupied state of the target file descriptor resource is an abnormal occupied state according to the object attribute information of the second occupied object.
The computer equipment can analyze the object attribute information of the second occupied object from the memory snapshot information; the second occupied object is a file descriptor resource occupying the target resource type in the application process, and is an object associated with Socket communication, for example, the second occupied object may refer to any one or two of a Socket object and a session Window (PhoneWindow) object, and object attribute information of the second occupied object includes a domain name port feature of the Socket, a type of the Window and a title feature; further, according to the object attribute information of the second occupied object, interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state is generated. That is, by analyzing the Socket object and the PhoneWindow object, the reason that the resource occupation state of the Socket type file descriptor resource is the abnormal occupation state can be located.
Optionally, the resource type of the target file descriptor resource is a shared memory type, and the target resource occupation information is memory snapshot information; the generating, according to the target resource occupation information, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state includes: object attribute information of a third occupied object is analyzed from the memory snapshot information; the third occupied object is an object which occupies the file descriptor resource of the target resource type in the application process and is associated with database file inquiry; and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the third occupancy object.
The computer equipment can analyze the object attribute information of the third occupied object from the memory snapshot information; the third occupied object is an object which occupies file descriptor resources of the target resource type in the application process and is associated with database file inquiry; if the third occupied object is a CursorWindow object, the CursorWindow object may refer to a window object created in the database file query process, and the object attribute information of the third occupied object includes the number of CursorWindow objects and a file path (i.e. db file path) of the database file query. Further, according to the object attribute information of the third occupied object, interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state is generated. That is, by analyzing the CursorWindow object, the reason that the resource occupation state of the file descriptor resource of the shared memory type is the abnormal occupation state can be located.
The computer equipment can detect the resource statistical attribute information and the resource basic attribute information of the file descriptor resources occupied by the application process in real time or periodically, and screen out the target file descriptor resources with the resource occupied state being the abnormal occupied state from the file descriptor resources occupied by the application process according to the resource statistical attribute information, namely the target file descriptor resources occupy too many file descriptor resources for the application process. Further, the computer device may determine, according to the basic attribute information of the resource, target resource occupation information for describing that the application process occupies a target file description resource, locate, according to the target resource occupation information, a cause of the resource occupation state of the target file descriptor resource being an abnormal occupation state, and generate, according to the cause, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state. That is, according to the basic attribute information of the target file description resource, the analysis data (i.e. the target resource occupation information) for analyzing that the resource occupation state of the target file descriptor resource is the abnormal occupation state is adaptively selected, so that the reason that the resource occupation state of the target file descriptor resource is the abnormal occupation state can be rapidly positioned, the positioning efficiency and accuracy are improved, the abnormal occupation problem of the file descriptor resource is solved in an auxiliary manner, and the running stability of an application process is improved. Meanwhile, in the positioning process, only the target resource occupation information is needed to be analyzed, the analysis of the running data of the whole application process is not needed, the analysis of unnecessary data is avoided, the resources of computer equipment can be saved, and the positioning efficiency is further improved.
The method and the device can be applied to determining the resource occupation state of the file descriptor resources occupied by the application program in the computer equipment, and locating the reason that the file descriptor resources of the application program are in the abnormal state when the resource occupation state is in the abnormal state. Specifically, as shown in fig. 7, the computer device may locate, according to the memory snapshot information, the file path description information, and the thread description information, a cause of the abnormal state of the resource occupation state of the file description resource of the application, where the specific implementation process includes steps s11 to s15: s11, the total fd number occupied by the application process can be checked by the computer device, where fd refers to the file descriptor resource, and the total fd number refers to the total occupied resource mentioned above. And s12, judging whether the total fd number reaches 90% of the upper limit of the application process, namely acquiring the ratio between the total fd number and the limited resource occupation amount corresponding to the application process, determining the resource occupation rate of the file descriptor resource of the application process, if the resource occupation rate is smaller than or equal to 90%, determining that the total fd number does not reach 90% of the upper limit of the application process, determining that the resource occupation state of the file description resource of the application process is a normal state, and continuously determining the total resource occupation amount of the file descriptor resource of the application process. If the resource occupancy rate is greater than 90%, determining that the total fd number reaches 90% of the upper limit of the application process, determining that the resource occupancy state of the file description resource of the application process is an abnormal state, and executing step s 13. And s13, acquiring file description information, thread description information and memory snapshot information associated with the application process. And S14, clustering to obtain the fd type with the largest occupied amount of resources, namely, the target file descriptor resource with the largest occupied amount of resources and the abnormal occupied state of the file descriptor resource.
Further, as in fig. 7, s15, determining target resource occupation information (i.e. analysis material) for describing that the application process occupies the target resource descriptor resource according to the fd type, if the target file descriptor resource belongs to an event type, i.e. the application process occupies file descriptor resources of excessive event types, the thread description information may be determined as analysis material. And analyzing the target thread with the most file descriptor resources occupying the event type from the thread description information, and generating analysis information for explaining that the resource occupying state of the file descriptor resources occupying the event type of the application process is an abnormal state according to the name of the target thread and the resource occupying amount corresponding to the file descriptor resources occupied by the target thread. If the target file descriptor resource belongs to the shared memory type, i.e. the application process occupies the file descriptor resource of the shared memory type, the memory snapshot information can be determined as the analysis material. And analyzing the number of the current objects and the db file path characteristics from the memory snapshot information, and generating analysis information for explaining that the resource occupation state of the file descriptor resource of the application process occupation event type is abnormal according to the number of the current objects and the db file path characteristics. If the target file descriptor resource belongs to a file type, i.e., the application process occupies the file descriptor resource of the file path type, the file path description information may be determined as the analysis material. And analyzing a target file path with the most file descriptor resources occupying the file type from the file path description information, and generating analysis information for explaining that the resource occupation state of the file descriptor resources occupying the event type of the application process is abnormal according to the name of the target file and the resource occupation amount corresponding to the file descriptor resources occupied by the target file path. If the target file descriptor resources are of socket type, i.e., the application process occupies too many socket type of file descriptor resources, the memory snapshot information may be determined to be the analysis material. And resolving the domain name port characteristics of the socket object and the type and title characteristics of the phone Window from the memory snapshot information, and generating resolving information for interpreting that the resource occupation state of the file descriptor resource of the application process occupation event type is an abnormal state according to the domain name port characteristics of the socket object and the type and title characteristics of the phone Window.
Optionally, the computer device may locate, according to the stack information, a reason that the resource occupation state of the file description resource of the application is an abnormal state, as shown in fig. 8, and the specific implementation process includes steps s16 to s18 as follows: s16, the computer device can look at the total fd number occupied by the application process, where fd refers to the file descriptor resource, and the total fd number refers to the total occupied resource mentioned above. Judging whether the total fd number reaches 90% of the upper limit of the application process, namely acquiring the ratio between the total fd number and the limited resource occupation amount corresponding to the application process, determining the resource occupation rate of the file descriptor resource of the application process, if the resource occupation rate is smaller than or equal to 90%, determining that the total fd number does not reach 90% of the upper limit of the application process, determining that the resource occupation state of the file descriptor resource of the application process is a normal state, and continuously determining the total resource occupation amount of the file descriptor resource of the application process. If the resource occupancy rate is greater than 90%, determining that the total fd number reaches 90% of the upper limit of the application process, determining that the resource occupancy state of the file description resource of the application process is an abnormal state, and executing step s 17. And s17, acquiring the fd type with the largest occupied amount of resources, namely acquiring the target file descriptor resource with the abnormal occupied state of the file descriptor resource of the fd type with the largest occupied amount of resources. And s18, determining an operation instruction of the file descriptor resource occupying the target resource type in the application process according to the resource basic attribute information of the target file descriptor resource, wherein the operation instruction comprises an operation instruction related to open, socket, eventfd, ashmem _create_region and the like, then calling a hook function, and acquiring stack information related to the operation instruction from execution data of the operation instruction. And screening out a target stack corresponding to the second resource occupation amount larger than a second resource occupation amount threshold value from stacks occupying the target file descriptor resources in the application process, namely screening out n stacks with the largest corresponding second resource occupation amount from stacks occupying the file descriptor resources of the target resource type in the application process, and taking the n stacks as the target stack. Further, the object attribute information of the target stack and the second resource occupation amount are determined as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state. s19, after the interpretation information is obtained, the computer device may delete the stack to release the memory space occupied by the stack.
Fig. 9 is a schematic structural diagram of a resource processing device according to an embodiment of the present application. The resource processing means may be a computer program (including program code) running in a computer device, for example the resource processing means is an application software; the device can be used for executing corresponding steps in the method provided by the embodiment of the application. As shown in fig. 9, the resource processing device may include: an acquisition module 901, a screening module 902, a determination module 903, and a generation module 904.
The acquisition module is used for acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by the application process;
the screening module is used for screening target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process according to the resource statistical attribute information;
the determining module is used for determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource;
and the generation module is used for generating interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state according to the target resource occupation information.
The optional screening module screens the target file descriptor resources with the abnormal occupation state from the file descriptor resources occupied by the application process according to the resource statistical attribute information, and the method comprises the following steps:
from the resource statistical attribute information, analyzing the first resource occupation amount corresponding to the file descriptor resources belonging to the resource type Pi occupied by the application process; i is a positive integer less than or equal to N, and N is the number of resource types corresponding to the file descriptor resources occupied by the application process;
screening out the resource types of which the first resource occupation amount is larger than a first resource occupation amount threshold value from the resource types of the file descriptor resources occupied by the application process;
and determining the file descriptor resources belonging to the screened resource types as target file descriptor resources with the resource occupation state being an abnormal occupation state.
Optionally, the screening module screens out a resource type with a first resource occupation amount greater than a first resource occupation amount threshold from resource types to which the file descriptor resources occupied by the application process belong, including:
accumulating the first resource occupation amount to obtain the total resource occupation amount corresponding to the file descriptor resources occupied by the application process;
Determining the resource occupation state of the application process about file descriptor resources according to the total resource occupation amount;
and if the resource occupation state of the application process about the file descriptor resource is an abnormal occupation state, screening out the resource type of which the first resource occupation amount is larger than a first resource occupation amount threshold from the resource types of the file descriptor resource occupied by the application process.
The screening module is configured to determine, according to the total amount of resource occupation, a resource occupation state of the application process with respect to a file descriptor resource, and includes:
acquiring the occupation amount of the limited resources corresponding to the application process;
determining the ratio of the total occupied resources to the limited occupied resources as the resource occupancy rate of the application process;
and if the resource occupancy rate is larger than the resource occupancy rate threshold value, determining that the resource occupancy state of the application process about the file descriptor resource is an abnormal occupancy state.
Optionally, the determining module determines, according to the resource basic attribute information of the target file descriptor resource, target resource occupation information for describing that the application process occupies the target file descriptor resource, including:
Determining an operation instruction occupying the target file descriptor resource in the application process according to the resource basic attribute information of the target file descriptor resource;
calling a hook function, and acquiring stack information associated with the operation instruction from execution data of the operation instruction;
and determining the stack information associated with the operation instruction as target resource occupation information for describing that the application process occupies the target file descriptor resource.
Optionally, the resource basic attribute information of the target file descriptor resource includes a resource type of the target file descriptor resource; the determining module determines target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource, and the determining module comprises the following steps:
if the resource type of the target file descriptor resource is a socket type or a shared memory type, determining memory snapshot information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource;
if the resource type of the target file descriptor resource is a file type, determining file path description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource;
And if the resource type of the target file descriptor resource is an event type, determining the thread description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource.
Optionally, the target resource occupation information is the stack information, the thread description information or the file path description information; the generating module generates interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state according to the target resource occupation information, and the method comprises the following steps:
object attribute information of a first occupied object occupying the target file descriptor resource in the application process and second resource occupation amount corresponding to the target file descriptor resource occupied by the first occupied object are analyzed from the target resource occupation information;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the first occupancy object and the second resource occupancy amount.
Optionally, the generating module generates, according to the object attribute information of the first occupied object and the second resource occupation amount, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state, including:
Screening out a target occupied object of which the corresponding second resource occupation amount is larger than a second resource occupation amount threshold value from a first occupied object of which the target file descriptor resource is occupied in the application process;
and determining the object attribute information of the target occupied object and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state.
Optionally, the resource type of the target file descriptor resource is a socket type, and the target resource occupation information is memory snapshot information; the generating module generates interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state according to the target resource occupation information, and the method comprises the following steps:
resolving object attribute information of a second occupied object from the memory snapshot information; the second occupied object is an object which occupies the target file descriptor resource in the application process and is associated with socket communication;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the second occupancy object.
Optionally, the resource type of the target file descriptor resource is a shared memory type, and the target resource occupation information is memory snapshot information; the generating module generates interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state according to the target resource occupation information, and the method comprises the following steps:
object attribute information of a third occupied object is analyzed from the memory snapshot information; the third occupied object is an object which occupies the target file descriptor resource in the application process and is associated with database file inquiry;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the third occupancy object.
According to one embodiment of the present application, the steps involved in the resource processing method shown in fig. 5 may be performed by respective modules in the resource processing apparatus shown in fig. 9. For example, step S101 shown in fig. 5 may be performed by the acquisition module 901 in fig. 9, and step S102 shown in fig. 5 may be performed by the screening module 902 in fig. 9; step S103 shown in fig. 5 may be performed by the determination module 903 in fig. 9; step S104 shown in fig. 5 may be performed by the generating module 904 in fig. 9.
Similarly, according to one embodiment of the present application, the steps involved in the resource processing method shown in fig. 6 may be performed by respective modules in the resource processing device shown in fig. 9. For example, step S201 shown in fig. 6 may be performed by the acquisition module 901 in fig. 9, and steps S202 to S204 shown in fig. 6 may be performed by the screening module 902 in fig. 9; step S205 shown in fig. 6 may be performed by the determination module 903 in fig. 9; step S206 shown in fig. 6 may be performed by the generation module 904 in fig. 9.
According to an embodiment of the present application, each module in the resource processing device shown in fig. 9 may be separately or completely combined into one or several units to form a structure, or some (some) units may be further split into at least two sub-units with smaller functions, so that the same operation may be implemented without affecting the implementation of the technical effects of the embodiments of the present application. The above modules are divided based on logic functions, and in practical application, the functions of one module may be implemented by at least two units, or the functions of at least two modules may be implemented by one unit. In other embodiments of the present application, the resource processing device may also include other units, and in practical applications, these functions may also be implemented with assistance from other units, and may be implemented by cooperation of at least two units.
According to one embodiment of the present application, a resource processing apparatus as shown in fig. 9 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 5 and 6 on a general-purpose computer device such as a computer including a processing element such as a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), and the like, and a storage element, and the resource processing method of the embodiment of the present application is implemented. The computer program may be recorded on, for example, a computer-readable recording medium, and loaded into and executed by the computing device via the computer-readable recording medium.
The computer equipment can detect the resource statistical attribute information and the resource basic attribute information of the file descriptor resources occupied by the application process in real time or periodically, and screen out the target file descriptor resources with the resource occupied state being the abnormal occupied state from the file descriptor resources occupied by the application process according to the resource statistical attribute information, namely the target file descriptor resources occupy too many file descriptor resources for the application process. Further, the computer device may determine, according to the basic attribute information of the resource, target resource occupation information for describing that the application process occupies a target file description resource, locate, according to the target resource occupation information, a cause of the resource occupation state of the target file descriptor resource being an abnormal occupation state, and generate, according to the cause, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state. That is, according to the basic attribute information of the target file description resource, the analysis data (i.e. the target resource occupation information) for analyzing that the resource occupation state of the target file descriptor resource is the abnormal occupation state is adaptively selected, so that the reason that the resource occupation state of the target file descriptor resource is the abnormal occupation state can be rapidly positioned, the positioning efficiency and accuracy are improved, the abnormal occupation problem of the file descriptor resource is solved in an auxiliary manner, and the running stability of an application process is improved. Meanwhile, in the positioning process, only the target resource occupation information is needed to be analyzed, the analysis of the running data of the whole application process is not needed, the analysis of unnecessary data is avoided, the resources of computer equipment can be saved, and the positioning efficiency is further improved.
Fig. 10 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 10, the above-mentioned computer device 1000 may include: processor 1001, network interface1004 and a memory 1005, and the computer device 1000 may further include: a media content interface 1003, and at least one communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The media content interface 1003 may include a Display (Display) and a Keyboard (Keyboard), and the optional media content interface 1003 may further include a standard wired interface and a standard wireless interface. The network interface 1004 may alternatively include a standard wired interface, a wireless interface (e.g., W I -F I An interface). The memory 1005 may be a high-speed RAM memory or a nonvolatile memory (non-volatile memory), such as at least one magnetic disk memory. The memory 1005 may also optionally be at least one storage device remote from the processor 1001. As shown in fig. 10, an operating system, a network communication module, a media content interface module, and a device control application may be included in a memory 1005, which is a computer-readable storage medium.
In the computer device 1000 shown in FIG. 10, the network interface 1004 may provide network communication functions; and the media content interface 1003 is mainly used for providing an interface for inputting media content; and the processor 1001 may be configured to occupy a device control application stored in the memory 1005 to implement:
acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by an application process;
screening target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process according to the resource statistical attribute information;
determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the target resource occupancy information.
Optionally, the processor 1001 may be configured to occupy a device control application stored in the memory 1005, so as to screen, according to the resource statistics attribute information, a target file descriptor resource whose resource occupancy state is an abnormal occupancy state from file descriptor resources occupied by the application process, including:
From the resource statistical attribute information, analyzing the first resource occupation amount corresponding to the file descriptor resources belonging to the resource type Pi occupied by the application process; i is a positive integer less than or equal to N, and N is the number of resource types corresponding to the file descriptor resources occupied by the application process;
screening out the resource types of which the first resource occupation amount is larger than a first resource occupation amount threshold value from the resource types of the file descriptor resources occupied by the application process;
and determining the file descriptor resources belonging to the screened resource types as target file descriptor resources with the resource occupation state being an abnormal occupation state.
Optionally, the processor 1001 may be configured to occupy a device control application stored in the memory 1005, so as to screen out a resource type with a first resource occupation amount greater than a first resource occupation amount threshold from resource types to which a file descriptor resource occupied by the application process belongs, including:
accumulating the first resource occupation amount to obtain the total resource occupation amount corresponding to the file descriptor resources occupied by the application process;
determining the resource occupation state of the application process about file descriptor resources according to the total resource occupation amount;
And if the resource occupation state of the application process about the file descriptor resource is an abnormal occupation state, screening out the resource type of which the first resource occupation amount is larger than a first resource occupation amount threshold from the resource types of the file descriptor resource occupied by the application process.
Optionally, the processor 1001 may be configured to occupy a device control application stored in the memory 1005, so as to determine, according to the total amount of occupied resources, a resource occupancy state of the application process with respect to the file descriptor resources, including:
acquiring the occupation amount of the limited resources corresponding to the application process;
determining the ratio of the total occupied resources to the limited occupied resources as the resource occupancy rate of the application process;
and if the resource occupancy rate is larger than the resource occupancy rate threshold value, determining that the resource occupancy state of the application process about the file descriptor resource is an abnormal occupancy state.
Optionally, the processor 1001 may be configured to occupy a device control application stored in the memory 1005, so as to determine, according to the resource basic attribute information of the target file descriptor resource, target resource occupation information for describing that the application process occupies the target file descriptor resource, including:
Determining an operation instruction occupying the target file descriptor resource in the application process according to the resource basic attribute information of the target file descriptor resource;
calling a hook function, and acquiring stack information associated with the operation instruction from execution data of the operation instruction;
and determining the stack information associated with the operation instruction as target resource occupation information for describing that the application process occupies the target file descriptor resource.
Optionally, the resource basic attribute information of the target file descriptor resource includes a resource type of the target file descriptor resource; the processor 1001 may be configured to occupy a device control application stored in the memory 1005, to determine, according to the resource basic attribute information of the target file descriptor resource, target resource occupation information for describing that the application process occupies the target file descriptor resource, including:
if the resource type of the target file descriptor resource is a socket type or a shared memory type, determining memory snapshot information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource;
If the resource type of the target file descriptor resource is a file type, determining file path description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource;
and if the resource type of the target file descriptor resource is an event type, determining the thread description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource.
Optionally, the target resource occupation information is the stack information, the thread description information or the file path description information; the processor 1001 may be configured to occupy a device control application stored in the memory 1005, so as to generate, according to the target resource occupancy information, interpretation information for interpreting that a resource occupancy state of the target file descriptor resource is an abnormal occupancy state, including:
object attribute information of a first occupied object occupying the target file descriptor resource in the application process and second resource occupation amount corresponding to the target file descriptor resource occupied by the first occupied object are analyzed from the target resource occupation information;
And generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the first occupancy object and the second resource occupancy amount.
Optionally, the processor 1001 may be configured to occupy a device control application stored in the memory 1005, so as to generate, according to the object attribute information of the first occupied object and the second resource occupation amount, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state, including:
screening out a target occupied object of which the corresponding second resource occupation amount is larger than a second resource occupation amount threshold value from a first occupied object of which the target file descriptor resource is occupied in the application process;
and determining the object attribute information of the target occupied object and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state.
Optionally, the resource type of the target file descriptor resource is a socket type, and the target resource occupation information is memory snapshot information; the processor 1001 may be configured to occupy a device control application stored in the memory 1005, so as to generate, according to the target resource occupancy information, interpretation information for interpreting that a resource occupancy state of the target file descriptor resource is an abnormal occupancy state, including:
Resolving object attribute information of a second occupied object from the memory snapshot information; the second occupied object is an object which occupies the target file descriptor resource in the application process and is associated with socket communication;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the second occupancy object.
Optionally, the resource type of the target file descriptor resource is a shared memory type, and the target resource occupation information is memory snapshot information; the processor 1001 may be configured to occupy a device control application stored in the memory 1005, so as to generate, according to the target resource occupancy information, interpretation information for interpreting that a resource occupancy state of the target file descriptor resource is an abnormal occupancy state, including:
object attribute information of a third occupied object is analyzed from the memory snapshot information; the third occupied object is an object which occupies the target file descriptor resource in the application process and is associated with database file inquiry;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the third occupancy object.
The computer equipment can detect the resource statistical attribute information and the resource basic attribute information of the file descriptor resources occupied by the application process in real time or periodically, and screen out the target file descriptor resources with the resource occupied state being the abnormal occupied state from the file descriptor resources occupied by the application process according to the resource statistical attribute information, namely the target file descriptor resources occupy too many file descriptor resources for the application process. Further, the computer device may determine, according to the basic attribute information of the resource, target resource occupation information for describing that the application process occupies a target file description resource, locate, according to the target resource occupation information, a cause of the resource occupation state of the target file descriptor resource being an abnormal occupation state, and generate, according to the cause, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state. That is, according to the basic attribute information of the target file description resource, the analysis data (i.e. the target resource occupation information) for analyzing that the resource occupation state of the target file descriptor resource is the abnormal occupation state is adaptively selected, so that the reason that the resource occupation state of the target file descriptor resource is the abnormal occupation state can be rapidly positioned, the positioning efficiency and accuracy are improved, the abnormal occupation problem of the file descriptor resource is solved in an auxiliary manner, and the running stability of an application process is improved. Meanwhile, in the positioning process, only the target resource occupation information is needed to be analyzed, the analysis of the running data of the whole application process is not needed, the analysis of unnecessary data is avoided, the resources of computer equipment can be saved, and the positioning efficiency is further improved.
It should be understood that the computer device 1000 described in the embodiment of the present application may perform the description of the above-mentioned resource processing method in the embodiment corresponding to fig. 3 and fig. 4, and may also perform the description of the above-mentioned resource processing apparatus in the embodiment corresponding to fig. 9, which is not repeated herein. In addition, the description of the beneficial effects of the same method is omitted.
Furthermore, it should be noted here that: the embodiments of the present application further provide a computer readable storage medium, where the computer readable storage medium stores a computer program executed by the aforementioned resource processing device, and the computer program includes program instructions, when executed by the processor, can execute the description of the resource processing method in the corresponding embodiment of fig. 3 and 4, and therefore, a detailed description will not be given here. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present application, please refer to the description of the method embodiments of the present application.
As an example, the above-described program instructions may be executed on one computer device or at least two computer devices disposed at one site, or alternatively, at least two computer devices distributed at least two sites and interconnected by a communication network, which may constitute a blockchain network.
The computer readable storage medium may be the resource processing device provided in any of the foregoing embodiments or a middle storage unit of the foregoing computer device, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card (flash card) or the like, which are provided on the computer device. Further, the computer-readable storage medium may also include both a central storage unit and an external storage device of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
The terms first, second and the like in the description and in the claims and drawings of the embodiments of the present application are used for distinguishing between different media and not necessarily for describing a particular sequential or chronological order. Furthermore, the term "include" and any variations thereof is intended to cover a non-exclusive inclusion. For example, a process, method, apparatus, article, or device that comprises a list of steps or elements is not limited to the list of steps or modules but may, in the alternative, include other steps or modules not listed or inherent to such process, method, apparatus, article, or device.
The embodiments of the present application further provide a computer program product, which includes a computer program/instruction, where the computer program/instruction, when executed by a processor, implements the description of the above resource processing method in the corresponding embodiments of fig. 4 and fig. 7, and therefore, will not be described in detail herein. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the embodiments of the computer program product according to the present application, reference is made to the description of the method embodiments of the present application.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The methods and related devices provided in the embodiments of the present application are described with reference to the method flowcharts and/or structure diagrams provided in the embodiments of the present application, and each flowchart and/or block of the method flowcharts and/or structure diagrams may be implemented by computer program instructions, and combinations of flowcharts and/or blocks in the flowchart and/or block diagrams. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable resource processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable resource processing device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable resource processing device to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks. These computer program instructions may also be loaded onto a computer or other programmable resource processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or structures.
The foregoing disclosure is only illustrative of the preferred embodiments of the present application and is not intended to limit the scope of the claims herein, as the equivalent of the claims herein shall be construed to fall within the scope of the claims herein.

Claims (14)

1. A method of resource processing, comprising:
acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by an application process;
screening target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process according to the resource statistical attribute information;
determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the target resource occupancy information.
2. The method of claim 1, wherein the screening the target file descriptor resources with the abnormal occupation state from the file descriptor resources occupied by the application process according to the resource statistics attribute information comprises:
From the resource statistical attribute information, analyzing the first resource occupation amount corresponding to the file descriptor resources belonging to the resource type Pi occupied by the application process; i is a positive integer less than or equal to N, and N is the number of resource types corresponding to the file descriptor resources occupied by the application process;
screening out the resource types of which the first resource occupation amount is larger than a first resource occupation amount threshold value from the resource types of the file descriptor resources occupied by the application process;
and determining the file descriptor resources belonging to the screened resource types as target file descriptor resources with the resource occupation state being an abnormal occupation state.
3. The method of claim 2, wherein the screening the resource types having the first resource occupation amount greater than the first resource occupation amount threshold from the resource types to which the file descriptor resources occupied by the application process belong comprises:
accumulating the first resource occupation amount to obtain the total resource occupation amount corresponding to the file descriptor resources occupied by the application process;
determining the resource occupation state of the application process about file descriptor resources according to the total resource occupation amount;
And if the resource occupation state of the application process about the file descriptor resource is an abnormal occupation state, screening out the resource type of which the first resource occupation amount is larger than a first resource occupation amount threshold from the resource types of the file descriptor resource occupied by the application process.
4. The method of claim 3, wherein determining the resource occupancy status of the application process with respect to file descriptor resources based on the total amount of resource occupancy comprises:
acquiring the occupation amount of the limited resources corresponding to the application process;
determining the ratio of the total occupied resources to the limited occupied resources as the resource occupancy rate of the application process;
and if the resource occupancy rate is larger than the resource occupancy rate threshold value, determining that the resource occupancy state of the application process about the file descriptor resource is an abnormal occupancy state.
5. The method of claim 1, wherein determining target resource occupancy information describing that the application process occupies the target file descriptor resource based on the resource base attribute information of the target file descriptor resource comprises:
determining an operation instruction occupying the target file descriptor resource in the application process according to the resource basic attribute information of the target file descriptor resource;
Calling a hook function, and acquiring stack information associated with the operation instruction from execution data of the operation instruction;
and determining the stack information associated with the operation instruction as target resource occupation information for describing that the application process occupies the target file descriptor resource.
6. The method of claim 1, wherein the resource base attribute information of the target file descriptor resource comprises a resource type of the target file descriptor resource;
the determining, according to the resource basic attribute information of the target file descriptor resource, target resource occupation information for describing that the application process occupies the target file descriptor resource, includes:
if the resource type of the target file descriptor resource is a socket type or a shared memory type, determining memory snapshot information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource;
if the resource type of the target file descriptor resource is a file type, determining file path description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource;
And if the resource type of the target file descriptor resource is an event type, determining the thread description information associated with the application process as target resource occupation information for describing that the application process occupies the target file descriptor resource.
7. The method of claim 5 or 6, wherein the target resource occupancy information is the stack information, the thread description information, or the file path description information;
the generating, according to the target resource occupation information, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state includes:
object attribute information of a first occupied object occupying the target file descriptor resource in the application process and second resource occupation amount corresponding to the target file descriptor resource occupied by the first occupied object are analyzed from the target resource occupation information;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the first occupancy object and the second resource occupancy amount.
8. The method of claim 7, wherein the generating interpretation information for interpreting the resource occupancy state of the target file descriptor resource as an abnormal occupancy state according to the object attribute information of the first occupancy object and the second resource occupancy amount comprises:
screening out a target occupied object of which the corresponding second resource occupation amount is larger than a second resource occupation amount threshold value from a first occupied object of which the target file descriptor resource is occupied in the application process;
and determining the object attribute information of the target occupied object and the second resource occupation amount as interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state.
9. The method of claim 6, wherein the resource type of the target file descriptor resource is a socket type and the target resource occupancy information is memory snapshot information;
the generating, according to the target resource occupation information, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state includes:
resolving object attribute information of a second occupied object from the memory snapshot information; the second occupied object is an object which occupies the target file descriptor resource in the application process and is associated with socket communication;
And generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the second occupancy object.
10. The method of claim 6, wherein the resource type of the target file descriptor resource is a shared memory type and the target resource occupancy information is memory snapshot information;
the generating, according to the target resource occupation information, interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state includes:
object attribute information of a third occupied object is analyzed from the memory snapshot information; the third occupied object is an object which occupies the target file descriptor resource in the application process and is associated with database file inquiry;
and generating interpretation information for interpreting that the resource occupancy state of the target file descriptor resource is an abnormal occupancy state according to the object attribute information of the third occupancy object.
11. A resource processing apparatus, comprising:
the acquisition module is used for acquiring resource statistical attribute information and resource basic attribute information of file descriptor resources occupied by the application process;
The screening module is used for screening target file descriptor resources with abnormal occupation states from file descriptor resources occupied by the application process according to the resource statistical attribute information;
the determining module is used for determining target resource occupation information for describing that the application process occupies the target file descriptor resource according to the resource basic attribute information of the target file descriptor resource;
and the generation module is used for generating interpretation information for interpreting that the resource occupation state of the target file descriptor resource is an abnormal occupation state according to the target resource occupation information.
12. A computer device, comprising: a processor and a memory;
the processor is connected with the memory; the memory is configured to store program code, the processor is configured to occupy the program code to perform the method of any one of claims 1-10.
13. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any of claims 1-10.
14. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the method of any of claims 1-10.
CN202111628164.5A 2021-12-28 2021-12-28 Resource processing method, device, equipment and storage medium Pending CN116360968A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111628164.5A CN116360968A (en) 2021-12-28 2021-12-28 Resource processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111628164.5A CN116360968A (en) 2021-12-28 2021-12-28 Resource processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116360968A true CN116360968A (en) 2023-06-30

Family

ID=86940413

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111628164.5A Pending CN116360968A (en) 2021-12-28 2021-12-28 Resource processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116360968A (en)

Similar Documents

Publication Publication Date Title
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
CN110232010A (en) A kind of alarm method, alarm server and monitoring server
US20070174839A1 (en) Method and system for managing programs within systems
CN110795257A (en) Method, device and equipment for processing multi-cluster operation records and storage medium
CN111447102B (en) SDN network device access method and device, computer device and storage medium
CN110445828B (en) Data distributed processing method based on Redis and related equipment thereof
CN108228322B (en) Distributed link tracking and analyzing method, server and global scheduler
US10831565B2 (en) Fault tolerant adapter system to consume database as a service
CN110956269A (en) Data model generation method, device, equipment and computer storage medium
CN101719852A (en) Method and device for monitoring performance of middle piece
CN111984505A (en) Operation and maintenance data acquisition engine and acquisition method
CN114090580A (en) Data processing method, device, equipment, storage medium and product
CN113722114A (en) Data service processing method and device, computing equipment and storage medium
CN113485999A (en) Data cleaning method and device and server
US7275250B1 (en) Method and apparatus for correlating events
US8984124B2 (en) System and method for adaptive data monitoring
CN113157411B (en) Celery-based reliable configurable task system and device
CN109582439A (en) DCN dispositions method, device, equipment and computer readable storage medium
CN113364857A (en) Service data processing method and device and server
CN116360968A (en) Resource processing method, device, equipment and storage medium
US10348814B1 (en) Efficient storage reclamation for system components managing storage
CN107590199B (en) Memory-oriented multithreading database design method
CN116151631A (en) Service decision processing system, service decision processing method and device
US9659041B2 (en) Model for capturing audit trail data with reduced probability of loss of critical data
CN115499493A (en) Asynchronous transaction processing method and device, storage medium and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination